Bug 41053 - Extended Attribute Defaults are not taken into account for already created users
Extended Attribute Defaults are not taken into account for already created users
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UDM - Extended Attributes
UCS 4.1
Other Linux
: P5 normal with 2 votes (vote)
: UCS 4.2-0-errata
Assigned To: Florian Best
Johannes Keiser
:
Depends on: 43395
Blocks:
  Show dependency treegraph
 
Reported: 2016-04-14 14:32 CEST by Ingo Steuwer
Modified: 2017-11-08 12:15 CET (History)
6 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?: 3: Will affect average number of installed domains
How will those affected feel about the bug?: 3: A User would likely not purchase the product
User Pain: 0.257
Enterprise Customer affected?:
School Customer affected?:
ISV affected?: Yes
Waiting Support:
Ticket number: 2015112421000635
Bug group (optional): Usability
Max CVSS v3 score:


Attachments
Screenshot (199.88 KB, image/png)
2016-04-18 16:39 CEST, Alexander Kläser
Details
untested patch which always sets default values (1.34 KB, patch)
2016-06-14 13:21 CEST, Florian Best
Details | Diff
patch (2.87 KB, patch)
2016-06-14 13:32 CEST, Florian Best
Details | Diff
patch (744 bytes, patch)
2016-08-17 13:29 CEST, Florian Best
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ingo Steuwer univentionstaff 2016-04-14 14:32:32 CEST
If extended attributes are created i.e. by installing an App they are added to UDM objects once they are opened in UMC. In this case a popup informs the UMC user that additional attributes have been preconfigured - for those attributes that have only a list of allowed values.

In all cases the defaults given with Extended Attributes are ignored. For the OX App Suite this leads to the following situation:


* preconfigured are "Default timezone: Africa/Abidjan" and "Default language: Czech/Czech Republic" -- which makes no sense
* "OX Access" is disabled, default is "premium"
* "OX Display Name" is empty but a required attribute

So activation of existing users for a later installed OX App Suite gets complicated...
Comment 1 Alexander Kläser univentionstaff 2016-04-18 16:39:26 CEST
Created attachment 7595 [details]
Screenshot

A screenshot is worth a thousand words :) ...
Comment 2 Ingo Steuwer univentionstaff 2016-06-14 13:17:16 CEST
reported again by 2015112421000635
Comment 3 Florian Best univentionstaff 2016-06-14 13:21:29 CEST
Created attachment 7742 [details]
untested patch which always sets default values
Comment 4 Florian Best univentionstaff 2016-06-14 13:32:19 CEST
Created attachment 7743 [details]
patch
Comment 5 Florian Best univentionstaff 2016-06-14 13:33:53 CEST
(In reply to Florian Best from comment #3)
> Created attachment 7742 [details]
> untested patch which always sets default values
This patch sets the default values *always* before create() or open() - if the value is unset.

(In reply to Florian Best from comment #4)
> Created attachment 7743 [details]
> patch
This patch adds a new flag to the property which causes that in open() the default value is set - so that it gets displayed correctly in UMC. It required to extend the extended attribute schema.
Comment 6 Florian Best univentionstaff 2016-06-23 13:25:41 CEST
Comment on attachment 7742 [details]
untested patch which always sets default values

self.set_defaults decides whether default values should be set. the logic in __getitem__ makes sure that it is set in the very end. The patch sets it hard, which should not be done.
Comment 7 Florian Best univentionstaff 2016-06-23 13:27:10 CEST
Comment on attachment 7743 [details]
patch

This patch should consider that self.save() is called after setting the attributes - this has side effects when not using via UMC.
Comment 8 Florian Best univentionstaff 2016-08-17 13:29:57 CEST
Created attachment 7885 [details]
patch

Patch against the UDM-UMC module to fill in all default values before sending the data to the frontend.
Comment 9 Florian Best univentionstaff 2017-05-12 13:29:23 CEST
A slightly adapted patch has been applied. This probably makes the OX hooks obsolete.

univention-management-console-module-udm (7.0.10-1):
r79318 | Bug #41053: set default values of objects when receiving form values

univention-management-console-module-udm.yaml:
r79318 | Bug #41053: set default values of objects when receiving form values
Comment 10 Erik Damrose univentionstaff 2017-05-15 16:49:58 CEST
Reopen: Please recheck. If i create a new user from a usertemplate, a default SAML serviceprovider with empty value is set, which fails upon saving the user object.
Comment 11 Florian Best univentionstaff 2017-05-16 14:56:04 CEST
(In reply to Erik Damrose from comment #10)
> Reopen: Please recheck. If i create a new user from a usertemplate, a
> default SAML serviceprovider with empty value is set, which fails upon
> saving the user object.
Yes, for extended attribute (SAML serviceprovider is one) the code which reads the default values from LDAP into the UDM property instance sets always a default of [""] (which is wrong). Instead [None] should be used if no default is set.

univention-directory-manager-modules (12.0.17-7):
r79371 | Bug #41053: fix default value of extended attributes which don't specify a default

univention-directory-manager-modules.yaml:
r79372 | YAML Bug #41053
Comment 12 Erik Damrose univentionstaff 2017-05-18 13:12:47 CEST
(In reply to Florian Best from comment #11)
> Yes, for extended attribute (SAML serviceprovider is one) the code which
> reads the default values from LDAP into the UDM property instance sets
> always a default of [""] (which is wrong). Instead [None] should be used if
> no default is set.

This works for my test case
Comment 13 Johannes Keiser univentionstaff 2017-05-24 16:32:41 CEST
OK: Default values of extended attributes are set for existing users
(Tested with OX, Kopano, OwnCloud, new univentionFreeAttribute)

OK: YAML