Bug 43094

Summary: UCR overwritten syntax classes cannot have choices
Product: UCS Reporter: Florian Best <best>
Component: UMC - Domain management (Generic)Assignee: Florian Best <best>
Status: CLOSED FIXED QA Contact: Dirk Wiesenthal <wiesenthal>
Severity: normal    
Priority: P5 CC: birkefeld, schwardt
Version: UCS 4.1Flags: best: Patch_Available+
Target Milestone: UCS 4.1-4-errata   
Hardware: Other   
OS: Linux   
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: Flags outvoted (downgraded) after PO Review:
Ticket number: Bug group (optional):
Max CVSS v3 score:
Attachments: patch
Script to prove that the changes doesn't introduce any regression

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>