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

def PluggableAuthService-1.4::plugins::DynamicGroupsPlugin::DynamicGroupsPlugin::enumerateGroups (   self,
  id = None,
  exact_match = False,
  sort_by = None,
  max_results = None,
  kw 
)

See IGroupEnumerationPlugin.

Definition at line 208 of file DynamicGroupsPlugin.py.

                        :
        """ See IGroupEnumerationPlugin.
        """
        group_info = []
        group_ids = []
        plugin_id = self.getId()
        view_name = createViewName('enumerateGroups', id)

        # Look in the cache first...
        keywords = copy.deepcopy(kw)
        keywords.update( { 'id' : id
                         , 'exact_match' : exact_match
                         , 'sort_by' : sort_by
                         , 'max_results' : max_results
                         }
                       )
        cached_info = self.ZCacheable_get( view_name=view_name
                                         , keywords=keywords
                                         , default=None
                                         )

        if cached_info is not None:
            return tuple(cached_info)

        if isinstance( id, str ):
            id = [ id ]

        if exact_match and id:
            group_ids.extend( id )

        if group_ids:
            group_filter = None

        else:   # Searching
            group_ids = self.listGroupIds()
            group_filter = _DynamicGroupFilter( id, **kw )

        for group_id in group_ids:

            url = '/%s/%s/manage_propertiesForm' % ( self.absolute_url( 1 )
                                                   , group_id )
            info = {}
            info.update( self.getGroupInfo( group_id ) )

            info[ 'pluginid' ] = plugin_id
            info[ 'properties_url' ] = url
            info[ 'members_url' ] = url

            info[ 'id' ] = '%s%s' % (self.prefix, info['id'])

            if not group_filter or group_filter( info ):
                if info[ 'active' ]:
                    group_info.append( info )

        # Put the computed value into the cache
        self.ZCacheable_set(group_info, view_name=view_name, keywords=keywords)

        return tuple( group_info )

    #
    #   Housekeeping


Generated by  Doxygen 1.6.0   Back to index