Ejemplo n.º 1
0
 def getGroupsForPrincipal(self, principal, request=None):
     groups = {}
     for relationship in self.context.getGroupRelationships():
         groups.update(dict.fromkeys([g.getUserId() for g in
                                      self.context.getBRefs(relationship)]))
     for parent in aq_chain(aq_inner(self.context)):
         group = IGroup(parent, None)
         if group is not None:
             groups[group.getGroupId()] = 1
     return tuple(groups.keys())
Ejemplo n.º 2
0
 def getGroupsForPrincipal(self, principal, request=None):
     groups = {}
     for relationship in self.context.getGroupRelationships():
         groups.update(dict.fromkeys([g.getUserId() for g in
                                      self.context.getBRefs(relationship)]))
     for parent in aq_chain(aq_inner(self.context)):
         group = IGroup(parent, None)
         if group is not None:
             groups[group.getGroupId()] = 1
     return tuple(groups.keys())
Ejemplo n.º 3
0
 def getGroupsForPrincipal(self, principal, request=None):
     groups = {}
     # Get all BRefs that implement IGroup - slightly expensive
     for obj in self.context.getBRefs():
         group = IGroup(obj, None)
         if group is not None:
             groups[group.getGroupId()] = 1
     for parent in aq_chain(aq_inner(self.context)):
         group = IGroup(parent, None)
         if group is not None:
             groups[group.getGroupId()] = 1
     return tuple(groups.keys())
Ejemplo n.º 4
0
 def reindex(self, obj, attributes=[]):
     if IMembraneUserObject(obj, None) is None and IGroup(obj,
                                                          None) is None:
         return
     mbtool = getToolByName(obj, 'membrane_tool', None)
     if mbtool is not None:
         if getattr(obj, 'portal_type') in mbtool.listMembraneTypes():
             mbtool.reindexObject(obj, attributes or [])
Ejemplo n.º 5
0
 def index(self, obj, attributes=[]):
     if IMembraneUserObject(obj, None) is None and IGroup(obj,
                                                          None) is None:
         return
     mbtool = getToolByName(obj, "membrane_tool", None)
     if mbtool is not None:
         # Verify that the portal_type is part of the catalog map
         if getattr(obj, 'portal_type') in mbtool.listMembraneTypes():
             mbtool.indexObject(obj, attributes or [])
Ejemplo n.º 6
0
    def unindex(self, obj):
        wrapped_obj = obj
        if aq_base(obj).__class__.__name__ == 'PathWrapper':
            # Could be a PathWrapper object from collective.indexing.
            obj = obj.context

        if IMembraneUserObject(obj, None) is None and IGroup(obj,
                                                             None) is None:
            return
        mbtool = getToolByName(obj, 'membrane_tool', None)
        if mbtool is not None:
            if getattr(obj, 'portal_type') in mbtool.listMembraneTypes():
                mbtool.unindexObject(wrapped_obj)
Ejemplo n.º 7
0
    def unindex(self, obj):
        wrapped_obj = obj

        if isinstance(obj, PathProxy):
            # Could be a PathProxy object from CMFCore.indexing
            obj = getProxiedObject(obj)

        if IMembraneUserObject(obj, None) is None and IGroup(obj,
                                                             None) is None:
            return
        mbtool = getToolByName(obj, 'membrane_tool', None)
        if mbtool is not None:
            if getattr(obj, 'portal_type') in mbtool.listMembraneTypes():
                mbtool.unindexObject(wrapped_obj)
Ejemplo n.º 8
0
 def getGroupsForPrincipal(self, principal, request=None):
     groups = {}
     # Get all BRefs that implement IGroup - slightly expensive
     for obj in self.context.getBRefs():
         group = IGroup(obj, None)
         if group is not None:
             groups[group.getGroupId()] = 1
     for parent in aq_chain(aq_inner(self.context)):
         group = IGroup(parent, None)
         if group is not None:
             groups[group.getGroupId()] = 1
     return tuple(groups.keys())
Ejemplo n.º 9
0
def getGroupId(obj):
    obj = IGroup(obj, None)
    if obj is None:
        return None
    return obj.getGroupId()
Ejemplo n.º 10
0
def getGroupId(obj):
    obj = IGroup(obj, None)
    if obj is None:
        return None
    return obj.getGroupId()