Bug 43094 - UCR overwritten syntax classes cannot have choices
UCR overwritten syntax classes cannot have choices
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Domain management (Generic)
UCS 4.1
Other Linux
: P5 normal (vote)
: UCS 4.1-4-errata
Assigned To: Florian Best
Dirk Wiesenthal
:
: 34070 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2016-12-01 17:50 CET by Florian Best
Modified: 2017-01-18 13:58 CET (History)
2 users (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 5: Major Usability: Impairs usability in key scenarios
Who will be affected by this bug?: 2: Will only affect a few installed domains
How will those affected feel about the bug?: 2: A Pain – users won’t like this once they notice it
User Pain: 0.114
Enterprise Customer affected?: Yes
School Customer affected?:
ISV affected?:
Waiting Support:
Ticket number:
Bug group (optional):
Max CVSS v3 score:
best: Patch_Available+


Attachments
patch (2.59 KB, patch)
2017-01-09 17:17 CET, Florian Best
Details | Diff
Script to prove that the changes doesn't introduce any regression (399 bytes, text/x-python)
2017-01-09 18:00 CET, Florian Best
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2016-12-01 17:50:29 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?!
Comment 1 Florian Best univentionstaff 2017-01-09 17:17:59 CET
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']
Comment 2 Florian Best univentionstaff 2017-01-09 17:21:37 CET
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.
Comment 3 Florian Best univentionstaff 2017-01-09 18:00:38 CET
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
Comment 4 Florian Best univentionstaff 2017-01-10 11:11:22 CET
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
Comment 5 Florian Best univentionstaff 2017-01-10 12:10:03 CET
*** Bug 34070 has been marked as a duplicate of this bug. ***
Comment 6 Dirk Wiesenthal univentionstaff 2017-01-17 17:24:21 CET
Changeset: OK
YAML: OK
Merge: OK
Comment 7 Janek Walkenhorst univentionstaff 2017-01-18 13:58:21 CET
<http://errata.software-univention.de/ucs/4.1/376.html>