/
GroupsTool.py
53 lines (40 loc) · 1.65 KB
/
GroupsTool.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
from Products.GroupUserFolder.GroupsTool import GroupsTool as BaseTool
from Products.CMFPlone import ToolNames
from AccessControl import ClassSecurityInfo
from Globals import InitializeClass
from Products.CMFPlone.PloneBaseTool import PloneBaseTool
from utils import base_hasattr
from Products.CMFPlone.utils import classImplements
class GroupsTool(PloneBaseTool, BaseTool):
meta_type = ToolNames.GroupsTool
security = ClassSecurityInfo()
toolicon = 'skins/plone_images/group.gif'
# No group workspaces by default
groupWorkspacesCreationFlag = 0
__implements__ = (PloneBaseTool.__implements__, BaseTool.__implements__, )
security.declarePublic('getGroupInfo')
def getGroupInfo(self, groupId):
"""
Return default group info of any group
"""
group = self.getGroupById(groupId)
if group is None:
return None
groupinfo = { 'title' : group.getProperty('title'),
'description' : group.getProperty('description'),
}
return groupinfo
def createGrouparea(self, id):
"""
Override the method to make sure the groups folder gets indexed,
GRUF makes a policy decision to unindex the groups folder.
"""
workspaces = self.getGroupWorkspacesFolder()
BaseTool.createGrouparea(self, id)
if workspaces is None:
workspaces = self.getGroupWorkspacesFolder()
if base_hasattr(workspaces, 'reindexObject'):
workspaces.reindexObject()
GroupsTool.__doc__ = BaseTool.__doc__
classImplements(GroupsTool, GroupsTool.__implements__)
InitializeClass(GroupsTool)