Bug 51002

Summary: optionsUsersUser syntax should have 'default' as valid choice
Product: UCS Reporter: Johannes Keiser <keiser>
Component: UMC (Generic)Assignee: Johannes Keiser <keiser>
Status: CLOSED FIXED QA Contact: Jürn Brodersen <brodersen>
Severity: normal    
Priority: P5 CC: best, bremer
Version: UCS 4.4   
Target Milestone: UCS 4.4-4-errata   
Hardware: Other   
OS: Linux   
What kind of report is it?: Development Internal What type of bug is this?: ---
Who will be affected by this bug?: --- How will those affected feel about the bug?: ---
User Pain: 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:

Description Johannes Keiser univentionstaff 2020-03-24 08:18:49 CET
Problem: initialising a users/user module with an settings/usertemplate has alway 'pki' option set to True as default.

When inittializing a users/user module with an settings/usertemplate, if the template has options set, then the default of the options of the module are set to those of the template. If the template has no options set then the default of all options of the module are set to True.

management/univention-directory-manager-modules/modules/univention/admin/modules.py
def init(lo, position, module, template_object=None, force_reload=False):
  [...]
  if key == '_options':
    if template_object[key] != [''] and template_object[key] != []:
      for option in module.options.keys():
        module.options[option].default = option in template_object[key]
      else:
        for option in module.options.keys():
        module.options[option].default = True
  [...]


The problem is that the only valid choice for the optionsUsersUser syntax of the settings/usertemplate is 'pki' which means the users/user module will always have the default of 'pki' option set to true since the options of the settings/usertemplate are either [] or ['pki']
Comment 1 Florian Best univentionstaff 2020-03-24 08:51:29 CET
Valid point.
User templates in python are currently unused (and maybe also more broken than that). Since UCS 3.0 user templates are evaluated in javascript in the UMC frontend. Does the frontend has the same problem?
→ Otherwise maybe we should not set the default options if the options of the template is empty?!
Comment 2 Johannes Keiser univentionstaff 2020-03-30 12:07:53 CEST
b34139e52b Bug #51002: yaml                                                                                                                                                                                                                  
d689734d9f Bug #51002: yaml
2c70fea359 Bug #51002: Debian changelog
14bb9d6ee0 Bug #51002: keep defaults of module options if usertemplate has none set

Successful build
Package: univention-directory-manager-modules
Version: 14.0.14-24A~4.4.0.202003301205
Comment 3 Jürn Brodersen univentionstaff 2020-04-01 11:18:01 CEST
What I tested:

PKI option is not set for users created with a template (in python) anymore -> OK
Tests -> OK
yaml -> OK

Note:
The behaviour is now the same as using a template on the umc

-> Verified
Comment 4 Erik Damrose univentionstaff 2020-04-02 14:47:37 CEST
<http://errata.software-univention.de/ucs/4.4/504.html>