Bug 25240 - [UMC]: Optionen/Checkboxen werden beim Speichern nicht übernommen
[UMC]: Optionen/Checkboxen werden beim Speichern nicht übernommen
Status: CLOSED FIXED
Product: UCS
Classification: Unclassified
Component: UMC - Domain management (Generic)
UCS 3.0
Other Linux
: P5 enhancement (vote)
: UCS 4.1-2-errata
Assigned To: Florian Best
Philipp Hahn
:
: 25457 (view as bug list)
Depends on:
Blocks: 41118
  Show dependency treegraph
 
Reported: 2011-12-06 17:42 CET by Florian Best
Modified: 2016-06-15 16:20 CEST (History)
3 users (show)

See Also:
What kind of report is it?: ---
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:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Florian Best univentionstaff 2011-12-06 17:42:49 CET
Beim aktivieren von Checkboxen im Optionen-Reiter, (die z.b. bei Benutzern zusätzliche Eingabefelder hinzufügen) werden die Werte beim Speichern nicht übernommen (mit Meldung: "no changes have been made"). Wenn in den aktivierten Eingabefeldern eine Eingabe gemacht worden ist funktioniert das Speichern.
Comment 1 Andreas Büsching univentionstaff 2011-12-07 09:22:41 CET
Ich denke das ist eigentlich auch vollkommen in Ordnung so da diese Optionen nur dann benötigt werden, wenn auch die entsprechenden Attribute genutzt werden. Oder nicht?
Comment 2 Stefan Gohmann univentionstaff 2011-12-08 08:42:31 CET
(In reply to comment #1)
> Ich denke das ist eigentlich auch vollkommen in Ordnung so da diese Optionen
> nur dann benötigt werden, wenn auch die entsprechenden Attribute genutzt
> werden. Oder nicht?

Nicht zwingend, es kann sein, dass lediglich die Objektklasse hinzugefügt wird.
Comment 3 Andreas Büsching univentionstaff 2011-12-13 14:14:26 CET
*** Bug 25457 has been marked as a duplicate of this bug. ***
Comment 4 Florian Best univentionstaff 2016-05-23 15:40:51 CEST
The mechanism to evaluate the current object classes is wrong. Only activating an option will not cause that the object class is added.

Even worse is that e.g. after enabling the option "Simple authentication account" on a user account without any further modifications will cause an error:
Failed to modify LDAP object ... ldapError: Object class violation: no structural object class provided

The modlist in that case was:
[(0, 'objectClass', 'uidObject'), (0, 'objectClass', 'simpleSecurityObject'), (2, 'objectClass', ['simpleSecurityObject', 'ucsschoolType'])]

It removes all currently present object classes.
Comment 5 Florian Best univentionstaff 2016-05-24 19:57:40 CEST
It is caused by the following code snipped in handlers/__init__.py which accidentally removes entries from the modlist:

 911 »   »   »   »   »   current_ocs = self.oldattr.get('objectClass')
 912 »   »   »   »   »   for i in ml:
 913 »   »   »   »   »   »   if i[0] == 'objectClass' and i[2]:
 914 »   »   »   »   »   »   »   if type(i[2]) == type(''):
 915 »   »   »   »   »   »   »   »   current_ocs = [ i[2] ]
 916 »   »   »   »   »   »   »   elif type(i[2]) == type([]):
 917 »   »   »   »   »   »   »   »   current_ocs = i[2]
 918 »   »   »   »   »   »   »   else:
 919 »   »   »   »   »   »   »   »   univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, 'ERROR in simpleLDAP._modify: i=%s'%i)
 920 »   »   »   »   »   ml.append( ('objectClass', self.oldattr.get('objectClass'), current_ocs+[prop.objClass]) )

This only evaluates the last 'objectClass' entry in the modlist and removes any other changes. It doesn't consider that the modlist may contain MOD_ADD or MOD_DELETE items.
Comment 6 Florian Best univentionstaff 2016-05-24 20:05:22 CEST
The object classes of (extended) options are now added or removed when creating and modifying objects. This code makes a lot of manual adjustments in the specific handlers unnecessary.

univention-directory-manager-modules (11.0.2-30):
r69514 | Bug #25240: fix object class generation; add object classes of options

univention-directory-manager-modules.yaml:
r69515 | YAML Bug #41266 Bug #25240
Comment 7 Florian Best univentionstaff 2016-05-25 10:47:04 CEST
Currently ucs-test is failing due to:
Compiling /usr/lib/pymodules/python2.6/univention/admin/handlers/users/user.py ...
SyntaxError: ('invalid syntax', ('/usr/lib/pymodules/python2.6/univention/admin/handlers/users/user.py', 1964, 55, "\t\t\t\tnew_object_classes |= {'univentionSambaPrivileges',}\n"))

and:
LDAP Error: Type or value exists: modify/add: objectClass: value #0 already exists.

See:
http://jenkins.knut.univention.de:8080/job/UCS-4.1/job/UCS-4.1-2/job/AutotestJoin/25/SambaVersion=s3,Systemrolle=master/testReport/61_udm-users/15_user_modification_set_pwdChangeNextLogin/test/
Comment 8 Florian Best univentionstaff 2016-05-27 13:04:20 CEST
r69535 | Bug #25240: fix typo and python2.6 syntax compatibility
Comment 9 Philipp Hahn univentionstaff 2016-06-09 12:37:12 CEST
FAIL: r69514

>@@ -289,7 +287,7 @@ class base(object):
>-     _d=univention.debug.function('admin.handlers.base.__getitem__ key = %s'%key)
>+     univention.debug.function('admin.handlers.base.__getitem__ key = %s'%key)

Welcome to the UCS crypt: That assignment to _d is by design. u.d.function() returns an object with a destructor (__del__), which is gets called when the last reference is dropped. In this case at the end of the calling function, which then logs a message:

#!/usr/bin/python
"""
09.06.16 10:55:41.399  DEBUG_INIT
UNIVENTION_DEBUG_BEGIN  : main1
09.06.16 10:55:41.399  MAIN        ( PROCESS ) : in main1
UNIVENTION_DEBUG_END    : main1
UNIVENTION_DEBUG_BEGIN  : main2
UNIVENTION_DEBUG_END    : main2
09.06.16 10:55:41.400  MAIN        ( PROCESS ) : in main2
"""
import univention.debug as ud
def main1():
        _d = ud.function('main1')
        ud.debug(ud.MAIN, ud.PROCESS, 'in main1')
def main2():
        ud.function('main2')
        ud.debug(ud.MAIN, ud.PROCESS, 'in main2')
if __name__ == '__main__':
        ud.init('stderr', ud.FLUSH, ud.FUNCTION)
        ud.set_level(ud.MAIN, ud.ALL)
        main1()
        main2()
Comment 10 Florian Best univentionstaff 2016-06-09 12:42:45 CEST
univention-directory-manager-modules (11.0.3-4):
r70021 | Bug #25240: restore univention.debug.function() functionality
Comment 11 Philipp Hahn univentionstaff 2016-06-15 09:18:19 CEST
OK: r70021
OK: Does not work in UCS-4.0
OK: EO is added and removed
OK: dpkg-query -W python-univention-directory-manager # 11.0.3-10.1402.201606141456

OK: errata-announce -V --only univention-directory-manager-modules.yaml
OK: univention-directory-manager-modules.yaml
Comment 12 Janek Walkenhorst univentionstaff 2016-06-15 16:20:35 CEST
<http://errata.software-univention.de/ucs/4.1/199.html>