Univention Bugzilla – Bug 43094
UCR overwritten syntax classes cannot have choices
Last modified: 2017-01-18 13:58:21 CET
Immediately when opening the users module a pop up occurs containing: Validation error An option passed to syntax_choices_info has the wrong type: 1 error(s) occurred: syntax: Argument required This happens when you set: ucr set directory/manager/web/modules/users/user/properties/mailHomeServer/syntax=MailHomeServer The difference between the properties/ request is the following: >>> pprint.pprint(afterwards) [{u'description': u'', u'editable': True, u'id': u'mailHomeServer', u'identifies': False, u'label': u'Mail home server', u'multivalue': False, u'nonempty_is_default': True, u'options': [u'mail'], u'readonly': False, u'readonly_when_synced': False, u'required': False, u'searchable': True, u'size': u'One', u'staticValues': [], u'syntax': u'MailHomeServer', u'threshold': 2000, u'type': u'umc/modules/udm/ComboBox'}] >>> pprint.pprint(before) [{u'description': u'', u'dynamicOptions': {u'syntax': u'MailHomeServer'}, u'dynamicValues': u'udm/syntax/choices', u'dynamicValuesInfo': u'udm/syntax/choices/info', u'editable': True, u'id': u'mailHomeServer', u'identifies': False, u'label': u'Mail home server', u'multivalue': False, u'nonempty_is_default': True, u'options': [u'mail'], u'readonly': False, u'readonly_when_synced': False, u'required': False, u'searchable': True, u'size': u'One', u'syntax': u'MailHomeServer', u'threshold': 2000, u'type': u'umc/modules/udm/ComboBox'}] → So why is the syntax class not detected as inheriting from UDM_Objects?!
Created attachment 8342 [details] patch from univention.management.console.modules.udm import * set_bind_function(lambda lo: lo.bind('uid=Administrator,cn=users,dc=school,dc=local', 'univention')) user = UDM_Module('users/user') props = user.properties [x for x in props if x['id'] == 'mailHomeServer']
The problem was that prior setting the value the syntax was the class MailHomeServer but when setting it via UCR it is an instance of the class MailHomeServer which leads to these problems as there are partly no isinstance-checks.
Created attachment 8343 [details] Script to prove that the changes doesn't introduce any regression Attached is a script to prove that the changes don't affect other syntax classes/properties. It compares the properties-result of all properties of all UDM modules with the applied patch and the not-applied patch. # wget -O 43094.patch 'https://forge.univention.org/bugzilla/attachment.cgi?id=8342' # python bug_43094_proove_no_regressions.py > prior.json # patch -i "$PWD/43094.patch" -d /usr/share/pyshared/univention/management/console/modules/udm/ -p6 # python bug_43094_proove_no_regressions.py > after.json # md5sum prior.json after.json → the hashes are equal
univention-management-console-module-udm (6.0.11-35): r75645 | Bug #43094: allow syntax overriden via UCR to have choices univention-management-console-module-udm.yaml: r75646 | YAML Bug #43094 univention-management-console-module-udm (7.0.3-2): r75647 | Bug #43094: allow syntax overriden via UCR to have choices
*** Bug 34070 has been marked as a duplicate of this bug. ***
Changeset: OK YAML: OK Merge: OK
<http://errata.software-univention.de/ucs/4.1/376.html>