Univention Bugzilla – Bug 44847
Validation error when using overwritten syntax class when creating new user
Last modified: 2017-07-05 13:06:40 CEST
full context: https://help.univention.com/t/umc-replace-existing-widgets-error-during-user-creation/5990 When using a self created syntax class a pop-up appears when creating a new user: "Validation error 1 error(s) occurred: syntax: Argument required" Bug #43094 might be related but in my case the error only appears when using the simplified user createn wizard. When opening an existing user no error occurs.
Hi Dirk, can you please attach the python code of the syntax class?
If possible please also attach a copy of the request whichs fails: Open the developer console (e.g. Alt-Shift-I in chrome) → click on network → see the red request with response code 422 → right click → copy as curl.
The syntax appears to be directly derived from http://docs.software-univention.de/developer-reference-4.2.html#udm:ea:select:dynamic : root@ucs-5084:~/sc# cat DS_Title.py class DS_Title(UDM_Objects): udm_modules = ('container/cn',) udm_filter = '(&(objectClass=organizationalRole)(ou:dn:=DS_Title))' simple = True # only one value is selected empty_value = True # allow selecting nothing key = '%(name)s' # this is stored label = '%(description)s' # this is displayed regex = None # no validation in frontend error_message = 'Invalid value' root@ucs-5084:~/sc# cat 02_create_DS_Title.sh syntax='DS_Title' base="cn=univention,$(ucr get ldap/base)" udm container/ou create --position "$base" \ --set name="$syntax" --set description='dynamischer Selektor CBS Title ' dn="ou=$syntax,$base" udm container/cn create --position "$dn" \ --set name="Dr." --set description='Dr.' udm container/cn create --position "$dn" \ --set name="PD. Dr." --set description='PD. Dr.' udm container/cn create --position "$dn" \ --set name="Prof. Dr." --set description='Prof. Dr.' udm container/cn create --ignore_exists --position "$base" \ --set name='udm_syntax' dn="cn=udm_syntax,$base" udm settings/udm_syntax create --position "$dn" \ --set name="$syntax" --set filename="DS_Title.py" \ --set data="$(bzip2 <DS_Title.py | base64)" \ --set package="$syntax" --set packageversion="1" request: curl 'http://192.168.133.168/univention/command/udm/syntax/choices/info' -H 'Cookie: UMCSessionId=6e8f2e03-b784-438c-b25d-2df6d6caed42; UMCUsername=Administrator; _pk_id.14.9d90=b91572d401a6cb17.1498219154.1.1498219174.1498219154.; _pk_ses.14.9d90=*' -H 'Origin: http://192.168.133.168' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: de-DE' -H 'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.109 Safari/537.36' -H 'Content-Type: application/json' -H 'Accept: application/json; q=1.0, text/html; q=0.3; */*; q=0.1' -H 'Referer: http://192.168.133.168/univention/management/' -H 'X-Requested-With: XMLHttpRequest' -H 'X-XSRF-Protection: 6e8f2e03-b784-438c-b25d-2df6d6caed42' -H 'Connection: keep-alive' --data-binary '{"options":{}}' --compressed
Created attachment 8964 [details] patch
Created attachment 8965 [details] patch
Thank you Dirk, for the fast reproducible script. @Johannes: comment #3 is missing the UCR variable which needs to be set: ucr set directory/manager/web/modules/users/user/properties/title/syntax=DS_Title univention-management-console-module-udm (7.0.10-12): r80589 | Bug #44847: fix wizards with overwritten syntax classes univention-management-console-module-udm.yaml: r80589 | Bug #44847: fix wizards with overwritten syntax classes
Tested with: (In reply to Dirk Ahrnke from comment #3) > root@ucs-5084:~/sc# cat DS_Title.py > class DS_Title(UDM_Objects): > udm_modules = ('container/cn',) > udm_filter = '(&(objectClass=organizationalRole)(ou:dn:=DS_Title))' > simple = True # only one value is selected > empty_value = True # allow selecting nothing > key = '%(name)s' # this is stored > label = '%(description)s' # this is displayed > regex = None # no validation in frontend > error_message = 'Invalid value' > root@ucs-5084:~/sc# cat 02_create_DS_Title.sh > syntax='DS_Title' > base="cn=univention,$(ucr get ldap/base)" > > udm container/ou create --position "$base" \ > --set name="$syntax" --set description='dynamischer Selektor CBS > Title ' > dn="ou=$syntax,$base" > > udm container/cn create --position "$dn" \ > --set name="Dr." --set description='Dr.' > udm container/cn create --position "$dn" \ > --set name="PD. Dr." --set description='PD. Dr.' > udm container/cn create --position "$dn" \ > --set name="Prof. Dr." --set description='Prof. Dr.' > > > udm container/cn create --ignore_exists --position "$base" \ > --set name='udm_syntax' > dn="cn=udm_syntax,$base" > udm settings/udm_syntax create --position "$dn" \ > --set name="$syntax" --set filename="DS_Title.py" \ > --set data="$(bzip2 <DS_Title.py | base64)" \ > --set package="$syntax" --set packageversion="1" (In reply to Florian Best from comment #6) > Thank you Dirk, for the fast reproducible script. > > @Johannes: > comment #3 is missing the UCR variable which needs to be set: > ucr set > directory/manager/web/modules/users/user/properties/title/syntax=DS_Title OK No error is shown in the creation wizard of a new user and the modified title widget is correctly set. YAML: OK -> verified
<http://errata.software-univention.de/ucs/4.2/83.html>