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

def LDAPMultiPlugins::LDAPMultiPlugin::LDAPMultiPlugin::getGroupsForPrincipal (   self,
  request = None,
  attr = None 

Fulfill GroupsPlugin requirements 

Definition at line 115 of file LDAPMultiPlugin.py.

00115                                                                   :
        """ Fulfill GroupsPlugin requirements """
        view_name = self.getId() + '_getGroupsForPrincipal'
        criteria = {'id':user.getId(), 'attr':attr}

        cached_info = self.ZCacheable_get(view_name = view_name,
                                          keywords = criteria,
                                          default = None)

        if cached_info is not None:
            logger.debug('returning cached results from enumerateUsers')
            return cached_info

        acl = self._getLDAPUserFolder()

        if acl is None:
            return ()

        unmangled_userid = self._demangle(user.getId())
        if unmangled_userid is None:
            return ()

        ldap_user = acl.getUserById(unmangled_userid)

        if ldap_user is None:
            return ()

        groups = acl.getGroups(ldap_user.getUserDN(), attr=attr)

        result = tuple([x[0] for x in groups])
        self.ZCacheable_set(result, view_name=view_name, keywords=criteria)

        return result

    def enumerateUsers( self

Generated by  Doxygen 1.6.0   Back to index