Logo Search packages:      
Sourcecode: zope-ldapmultiplugins version File versions  Download package

def LDAPMultiPlugins::ActiveDirectoryMultiPlugin::ActiveDirectoryMultiPlugin::_recurseGroups (   self,
  ldap_results,
  temp = None,
  seen = None,
  depth = 0 
) [private]

Given a set of LDAP result data for a group search, return
the recursive group memberships for each group: arbitrarily
expensive 

Definition at line 223 of file ActiveDirectoryMultiPlugin.py.

00223                                                                          :
        """ Given a set of LDAP result data for a group search, return
        the recursive group memberships for each group: arbitrarily
        expensive """
        if seen is None:
            seen = {}
        if temp is None:
            temp = []
        # Build a single filter so we can do it with a single search.
        filt_bits = []

        for result in ldap_results:
            dn = result['dn']
            
            if seen.has_key(dn):
                continue
            temp.append(result)
            seen[dn] = 1
            
            if result.has_key('memberOf'):
                for parent_dn in result['memberOf']:
                    filt = filter_format('(distinguishedName=%s)', (parent_dn,))
                    if filt in filt_bits:
                        continue
                    filt_bits.append(filt)

        if filt_bits:
            bits_s = ''.join(filt_bits)
            filt = "(&(objectClass=%s)(|%s))" % (self.group_class, bits_s)
            acl = self.acl_users
            delegate = acl._delegate
            R = delegate.search(acl.groups_base, acl.groups_scope, filter=filt)
            if R['exception']:
                logger.error("Failed to recursively search for group in %s "
                             "(scope=%s, filter=%s): %s",
                             acl.groups_base, acl.groups_scope, filt,
                             R['exception'])
            else:
                if depth < self.group_recurse_depth:    
                    self._recurseGroups(R['results'], temp, seen, depth + 1)

        return temp

    security.declarePrivate('enumerateUsers')
    def enumerateUsers( self


Generated by  Doxygen 1.6.0   Back to index