Back to index

plone3  3.1.7
GroupsTool.py
Go to the documentation of this file.
00001 from Products.GroupUserFolder.GroupsTool import GroupsTool as BaseTool
00002 
00003 from Products.CMFPlone import ToolNames
00004 from AccessControl import ClassSecurityInfo
00005 from Globals import InitializeClass
00006 from Products.CMFPlone.PloneBaseTool import PloneBaseTool
00007 from utils import base_hasattr
00008 
00009 class GroupsTool(PloneBaseTool, BaseTool):
00010 
00011     meta_type = ToolNames.GroupsTool
00012     security = ClassSecurityInfo()
00013     toolicon = 'skins/plone_images/group.gif'
00014 
00015     # No group workspaces by default
00016     groupWorkspacesCreationFlag = 0
00017 
00018     __implements__ = (PloneBaseTool.__implements__, BaseTool.__implements__, )
00019 
00020 
00021     security.declarePublic('getGroupInfo')
00022     def getGroupInfo(self, groupId):
00023         """
00024         Return default group info of any group
00025         """
00026         group = self.getGroupById(groupId)
00027 
00028         if group is None:
00029             return None
00030 
00031         groupinfo = { 'title'    : group.getProperty('title'),
00032                       'description' : group.getProperty('description'),
00033                     }
00034 
00035         return groupinfo
00036 
00037     def createGrouparea(self, id):
00038         """
00039         Override the method to make sure the groups folder gets indexed,
00040         GRUF makes a policy decision to unindex the groups folder.
00041         """
00042         workspaces = self.getGroupWorkspacesFolder()
00043         BaseTool.createGrouparea(self, id)
00044         if workspaces is None:
00045             workspaces = self.getGroupWorkspacesFolder()
00046             if base_hasattr(workspaces, 'reindexObject'):
00047                 workspaces.reindexObject()
00048 
00049 GroupsTool.__doc__ = BaseTool.__doc__
00050 
00051 InitializeClass(GroupsTool)