made _is_group() generic

This commit is contained in:
2019-01-31 14:56:41 +01:00
parent 33e83502b8
commit 8b42d2e70f

View File

@@ -649,18 +649,20 @@ class LdapUserDir(object):
for submember in self._get_all_members(cn, include_groups=include_groups, ou=ou, mssfu=mssfu):
yield submember
@staticmethod
def _is_group(dn):
"""Quick check if a DN is a group. That is, if it contains OU=Groups.
This may be a PSI-specific check
def _is_group(self, dn):
"""Quick check if a DN is a group.
Parameters
----------
dn : str
DN of the entry
"""
return "OU=Groups" in dn
# self.logger.debug("_is_group: %s %s:" % (self.group_ou, dn))
# Note that lower() is not a good casefold alternative
# but this is python 2
return self.group_ou.lower() in dn.lower()
def _mod_groupmembers(self, ldapmode, dngroup, usernames):
"""modifies (adds/deletes) members of an LDAP group entry