Univention Bugzilla – Attachment 7945 Details for
Bug 42167
password reset (student) causes search for every user in LDAP before narrowing it down
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
42167.patch (text/plain), 2.26 KB, created by
Florian Best
on 2016-08-30 14:26:52 CEST
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Florian Best
Created:
2016-08-30 14:26:52 CEST
Size:
2.26 KB
patch
obsolete
>diff --git a/ucs-school-lib/python/models/base.py b/ucs-school-lib/python/models/base.py >index c71ad1e..de3be60 100644 >--- a/ucs-school-lib/python/models/base.py >+++ b/ucs-school-lib/python/models/base.py >@@ -847,7 +847,7 @@ class UCSSchoolHelperAbstractClass(object): > return cls.from_udm_obj(udm_obj, school, lo) > > @classmethod >- def get_only_udm_obj(cls, lo, filter_str, superordinate=None): >+ def get_only_udm_obj(cls, lo, filter_str, superordinate=None, base=None): > '''Returns the one UDM object of class cls._meta.udm_module that > matches a given filter. > If more than one is found, a MultipleObjectsError is raised >@@ -857,7 +857,7 @@ class UCSSchoolHelperAbstractClass(object): > if cls._meta.udm_filter: > filter_str = '(&(%s)(%s))' % (cls._meta.udm_filter, filter_str) > logger.debug('Getting %s UDM object by filter: %s', cls.__name__, filter_str) >- objs = udm_modules.lookup(cls._meta.udm_module, None, lo, scope='sub', base=ucr.get('ldap/base'), filter=str(filter_str), superordinate=superordinate) >+ objs = udm_modules.lookup(cls._meta.udm_module, None, lo, scope='sub', base=base or ucr.get('ldap/base'), filter=str(filter_str), superordinate=superordinate) > if len(objs) == 0: > return None > if len(objs) > 1: >diff --git a/ucs-school-lib/python/schoolldap.py b/ucs-school-lib/python/schoolldap.py >index 248340b..9d6334d 100644 >--- a/ucs-school-lib/python/schoolldap.py >+++ b/ucs-school-lib/python/schoolldap.py >@@ -443,16 +443,11 @@ class SchoolBaseModule(Base): > users = [] > for userdn in set(groupObj['users']): > try: >- user = cls.from_dn(userdn, school, ldap_connection) >+ udm_obj = cls.get_only_udm_obj(ldap_connection, LDAP_Filter.forUsers(pattern), base=userdn) > except noObject: > continue >- if school not in user.schools: >+ if school not in user.schools: # TODO: move into filter?! > continue >- udm_obj = user.get_udm_object(ldap_connection) >- if pattern: >- # check if pattern is part of any of user's common properties (case insensitive) >- if not any([pattern.lower() in udm_obj.info.get(propertyname, '').lower() for propertyname in LDAP_Filter.forUsersSubMatch]): >- continue > users.append(udm_obj) > else: > # be aware that this search opens all user objects of specified type and may take some time!
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 42167
:
7943
|
7944
| 7945