Univention Bugzilla – Attachment 7820 Details for
Bug 41829
modifying boolean extended attribute writes '0' value to ldap
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
41829.patch (text/plain), 5.16 KB, created by
Florian Best
on 2016-07-21 13:55:30 CEST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Florian Best
Created:
2016-07-21 13:55:30 CEST
Size:
5.16 KB
patch
obsolete
>diff --git a/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py b/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >index 502a589..65d7579 100644 >--- a/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >+++ b/management/univention-directory-manager-modules/modules/univention/admin/handlers/__init__.py >@@ -683,18 +683,8 @@ def _create(self): > # evaluate extended attributes > ocs = set() > for prop in getattr(m, 'extended_udm_attributes', []): >- univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'simpleLdap._create: prop.objClass = %s, prop.name = %s'% (prop.objClass, prop.name)) >- if not self.info.get(prop.name): >- continue >- univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'simpleLdap._create: prop.name: info[%s] = %s'% (prop.name, self.info.get(prop.name))) >- >- # do not add object class and value if syntax is boolean and checkbox is disabled >- if prop.syntax == 'boolean' and self.info.get(prop.name) == '0': >- al = [x for x in al if x[0].lower() != prop.ldapMapping.lower()] >- continue >- >- # in all other cases add object class >- if self.has_key(prop.name): >+ univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'simpleLdap._create: info[%s]:%r = %r'% (prop.name, self.has_key(prop.name), self.info.get(prop.name))) >+ if self.has_key(prop.name) and self.info.get(prop.name): > ocs.add(prop.objClass) > > # add object classes of (especially extended) options >@@ -805,14 +795,14 @@ def _ldap_object_classes(self, ml): > for prop in getattr(m, 'extended_udm_attributes', []): > univention.debug.debug(univention.debug.ADMIN, univention.debug.INFO, 'simpleLdap._modify: extended attribute=%r oc=%r'% (prop.name, prop.objClass)) > >- if self.__ea_value_is_set(prop.name): >+ if self.has_key(prop.name) and self.info.get(prop.name): > required_ocs |= set([prop.objClass]) > continue > > if prop.deleteObjClass: > unneeded_ocs |= set([prop.objClass]) > >- # if the value is unset (or a boolean attribute with value == 0) we need to remove the attribute completely >+ # if the value is unset we need to remove the attribute completely > if self.oldattr.get(prop.ldapMapping): > ml = [x for x in ml if x[0].lower() != prop.ldapMapping.lower()] > ml.append((prop.ldapMapping, self.oldattr.get(prop.ldapMapping), '')) >@@ -868,13 +858,6 @@ def _ldap_object_classes(self, ml): > > return ml > >- def __ea_value_is_set(self, name): >- if not self.has_key(name): >- return False >- if self.descriptions[name].syntax == 'boolean' and self.info.get(name) == '0': >- return False >- return self.info.get(name) >- > def _move_in_subordinates(self, olddn): > result = self.lo.search(base=self.lo.base, filter=filter_format('(&(objectclass=person)(secretary=%s))', [olddn]), attr=['dn']) > for subordinate, attr in result: >diff --git a/management/univention-directory-manager-modules/modules/univention/admin/mapping.py b/management/univention-directory-manager-modules/modules/univention/admin/mapping.py >index 490eaf4..07d1cf9 100644 >--- a/management/univention-directory-manager-modules/modules/univention/admin/mapping.py >+++ b/management/univention-directory-manager-modules/modules/univention/admin/mapping.py >@@ -149,6 +149,17 @@ def mapBase64(value): > univention.debug.debug(univention.debug.ADMIN, univention.debug.ERROR, 'ERROR in mapBase64: %s' % e) > return "" > >+def BooleanListToString(list): >+ v = univention.admin.mapping.ListToString(list) >+ if v == '0': >+ return '' >+ return v >+ >+def BooleanUnMap(value): >+ if value == '0': >+ return '' >+ return value >+ > class mapping: > def __init__(self): > self._map={} >diff --git a/management/univention-directory-manager-modules/modules/univention/admin/modules.py b/management/univention-directory-manager-modules/modules/univention/admin/modules.py >index 479dc49..b50db1e 100644 >--- a/management/univention-directory-manager-modules/modules/univention/admin/modules.py >+++ b/management/univention-directory-manager-modules/modules/univention/admin/modules.py >@@ -320,9 +320,14 @@ def update_extended_attributes(lo, module, position): > if attrs.get('univentionUDMPropertyMultivalue', [''])[0] == '1': > multivalue = 1 > map_method = None >+ unmap_method = None > else: > multivalue = 0 > map_method = univention.admin.mapping.ListToString >+ unmap_method = None >+ if propertySyntaxString == 'boolean': >+ map_method = univention.admin.mapping.BooleanListToString >+ unmap_method = univention.admin.mapping.BooleanUnMap > # single value ==> use only first value > propertyDefault = propertyDefault[0] > >@@ -362,7 +367,7 @@ def update_extended_attributes(lo, module, position): > > # add LDAP mapping > if attrs['univentionUDMPropertyLdapMapping'][0].lower() != 'objectClass'.lower(): >- module.mapping.register(pname, attrs['univentionUDMPropertyLdapMapping'][0], None, map_method) >+ module.mapping.register(pname, attrs['univentionUDMPropertyLdapMapping'][0], unmap_method, map_method) > else: > module.mapping.register(pname, attrs['univentionUDMPropertyLdapMapping'][0], univention.admin.mapping.nothing, univention.admin.mapping.nothing) >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 41829
: 7820