39f076600e0d0f0af4fdfa36ef807d53092b2125
1 # -*- coding: utf-8 -*-
3 ## Copyright (C)2006 Ingeniweb
5 ## This program is free software; you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation; either version 2 of the License, or
8 ## (at your option) any later version.
10 ## This program is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 ## GNU General Public License for more details.
15 ## You should have received a copy of the GNU General Public License
16 ## along with this program; see the file COPYING. If not, write to the
17 ## Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 ## Copyright (c) 2003 The Connexions Project, All Rights Reserved
20 ## initially written by J Cameron Cooper, 11 June 2003
21 ## concept with Brent Hendricks, George Runyan
22 """Groups tool interface
24 Goes along the lines of portal_membership, but for groups.
26 __version__
= "$Revision: $"
28 # $Id: portal_groups.py 30098 2006-09-08 12:35:01Z encolpe $
29 __docformat__
= 'restructuredtext'
32 from zope
.interface
import Interface
, Attribute
34 class portal_groups(Interface
):
35 """Defines an interface for working with groups in an abstract manner.
36 Parallels the portal_membership interface of CMFCore"""
37 ## id = Attribute('id','Must be set to "portal_groups"')
40 """Test if a user/group object is a group or not.
41 You must pass an object you get earlier with wrapUser() or wrapGroup()
45 """Returns the portal_groupdata-ish object for a group corresponding
48 def getGroupsByUserId(userid
):
49 """Returns a list of the groups the user corresponding to 'userid' belongs to."""
52 """Returns a list of the available portal_groupdata-ish objects."""
55 """Returns a list of the available groups' ids (WITHOUT prefixes)."""
58 """Returns a list of the available groups' names (ie. without prefixes)."""
60 ## def getPureUserNames():
61 ## """Get the usernames (ids) of only users. """
63 ## def getPureUsers():
64 ## """Get the actual (unwrapped) user objects of only users. """
66 def searchForGroups(REQUEST
, **kw
): # maybe searchGroups()?
67 """Return a list of groups meeting certain conditions. """
68 # arguments need to be better refined?
70 def addGroup(id, roles
= [], groups
= [], **kw
):
71 """Create a group with the supplied id, roles, and groups.
73 Underlying user folder must support adding users via the usual Zope API.
74 Passwords for groups seem to be currently irrelevant in GRUF."""
76 def editGroup(id, roles
= [], groups
= [], **kw
):
77 """Edit the given group with the supplied roles.
79 Underlying user folder must support editing users via the usual Zope API.
80 Passwords for groups seem to be currently irrelevant in GRUF.
81 One can supply additional named parameters to set group properties."""
83 def removeGroups(ids
, keep_workspaces
=0):
84 """Remove the group in the provided list (if possible).
86 Will by default remove this group's GroupWorkspace if it exists. You may
87 turn this off by specifying keep_workspaces=true.
88 Underlying user folder must support removing users via the usual Zope API."""
90 def setGroupOwnership(group
, object):
91 """Make the object 'object' owned by group 'group' (a portal_groupdata-ish object)"""
93 def setGroupWorkspacesFolder(id=""):
94 """ Set the location of the Group Workspaces folder by id.
96 The Group Workspaces Folder contains all the group workspaces, just like the
97 Members folder contains all the member folders.
99 If anyone really cares, we can probably make the id work as a path as well,
100 but for the moment it's only an id for a folder in the portal root, just like the
101 corresponding MembershipTool functionality. """
103 def getGroupWorkspacesFolderId():
104 """ Get the Group Workspaces folder object's id.
106 The Group Workspaces Folder contains all the group workspaces, just like the
107 Members folder contains all the member folders. """
109 def getGroupWorkspacesFolder():
110 """ Get the Group Workspaces folder object.
112 The Group Workspaces Folder contains all the group workspaces, just like the
113 Members folder contains all the member folders. """
115 def toggleGroupWorkspacesCreation():
116 """ Toggles the flag for creation of a GroupWorkspaces folder upon first
117 use of the group. """
119 def getGroupWorkspacesCreationFlag():
120 """Return the (boolean) flag indicating whether the Groups Tool will create a group workspace
121 upon the next use of the group (if one doesn't exist). """
123 def getGroupWorkspaceType():
124 """Return the Type (as in TypesTool) to make the GroupWorkspace."""
126 def setGroupWorkspaceType(type):
127 """Set the Type (as in TypesTool) to make the GroupWorkspace. Expects the name of a Type."""
129 def createGrouparea(id):
130 """Create a space in the portal for the given group, much like member home
133 def getGroupareaFolder(id):
134 """Returns the object of the group's work area."""
136 def getGroupareaURL(id):
137 """Returns the full URL to the group's work area."""
139 # and various roles things...