Task #1821
closedNot possible to edit ldapGroup script with dollar in group name
100%
Description
In version 9.3.0 I was trying to change double quotes to single quote, but I was not able to re-save script in ldapGroup merge attribute on AD group.
I did workaround - delete system on AD group and add again.
I recorded gif which is in attachment.
Files
Updated by Petr Hanák over 5 years ago
- File deleted (
Cant save dollar in ldapGroup script.gif)
Updated by Petr Hanák over 5 years ago
Updated by Vít Švanda over 5 years ago
- Category set to Systems
- Status changed from New to In Progress
- Assignee changed from Radek Tomiška to Vít Švanda
- Target version set to Rhyolite (9.7.5)
Updated by Vít Švanda over 5 years ago
Primary problem is in your script "testDollar$Test". This is not correct script, because groovy try to find variable "Test".
Good question is why was this script successfuly saved, if every saved attribut should be validate. The reason is simple, this script is valid (for example this is unvalid script "testDollar$"), but cannot be evalued (because variable "Test" missing).
So your exception is not throwing during validation of the script, but during evaluation of that script (because I try to save historic value if the attribute was changed).
My advice is: Do not save incorrect scripts :-). If you have some automatically utility for create this attributes (may be some WF), you have to fix it, because generating incorrect scripts.
I want to prevent this situation for next time. So I modified saving of the attribute and script is validate and executed now too. For next time will be not possible to create attribute with incorrect groovy script.
I modified save method for situation when the attribute (script) is already broken. In this case need to obtain old value (for save historic value). If script exception will be throw in this situation I only catch the exception and historic value will be not saved.
Commit: https://github.com/bcvsolutions/CzechIdMng/commit/454933a3d9a728f5f65354d984812ee2f8978ac8
Updated by Vít Švanda over 5 years ago
- Status changed from In Progress to Needs feedback
- Assignee changed from Vít Švanda to Radek Tomiška
Updated by Radek Tomiška over 5 years ago
- Status changed from Needs feedback to Resolved
- Assignee changed from Radek Tomiška to Vít Švanda
- % Done changed from 0 to 100
I did test and review, it works and code is nice. Message with validation error is returned for user and old invalid script can be changed by valid one. Thx!