Bug 44847 - Validation error when using overwritten syntax class when creating new user
Validation error when using overwritten syntax class when creating new user
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Users
UCS 4.2
Other Windows NT
: P5 normal (vote)
: UCS 4.2-1-errata
Assigned To: Florian Best
Johannes Keiser
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-06-23 13:29 CEST by Dirk Ahrnke
Modified: 2017-07-05 13:06 CEST (History)
1 user (show)

See Also:
What kind of report is it?: Bug Report
What type of bug is this?: 3: Simply Wrong: The implementation doesn't match the docu
Who will be affected by this bug?: 1: Will affect a very few installed domains
How will those affected feel about the bug?: 4: A User would return the product
User Pain: 0.069
Enterprise Customer affected?:
School Customer affected?:
ISV affected?:
Waiting Support:
Flags outvoted (downgraded) after PO Review:
Ticket number:
Bug group (optional):
Max CVSS v3 score:
best: Patch_Available+


Attachments
patch (930 bytes, patch)
2017-06-23 16:29 CEST, Florian Best
Details | Diff
patch (888 bytes, patch)
2017-06-23 16:34 CEST, Florian Best
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Ahrnke 2017-06-23 13:29:34 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.
Comment 1 Florian Best univentionstaff 2017-06-23 13:49:09 CEST
Hi Dirk, can you please attach the python code of the syntax class?
Comment 2 Florian Best univentionstaff 2017-06-23 13:57:42 CEST
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.
Comment 3 Dirk Ahrnke 2017-06-23 14:08:26 CEST
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
Comment 4 Florian Best univentionstaff 2017-06-23 16:29:13 CEST
Created attachment 8964 [details]
patch
Comment 5 Florian Best univentionstaff 2017-06-23 16:34:08 CEST
Created attachment 8965 [details]
patch
Comment 6 Florian Best univentionstaff 2017-06-28 16:35:47 CEST
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
Comment 7 Johannes Keiser univentionstaff 2017-06-30 11:55:46 CEST
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
Comment 8 Janek Walkenhorst univentionstaff 2017-07-05 13:06:40 CEST
<http://errata.software-univention.de/ucs/4.2/83.html>