Compat zope-2.12 : résolution des problèmes avec les interfaces.
[GroupUserFolder.git] / interfaces / portal_groups.py
1 # -*- coding: utf-8 -*-
2 ## GroupUserFolder
3 ## Copyright (C)2006 Ingeniweb
4
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.
9
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.
14
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.
18
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
23
24 Goes along the lines of portal_membership, but for groups.
25 """
26 __version__ = "$Revision: $"
27 # $Source: $
28 # $Id: portal_groups.py 30098 2006-09-08 12:35:01Z encolpe $
29 __docformat__ = 'restructuredtext'
30
31
32 from zope.interface import Interface, Attribute
33
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"')
38
39 def isGroup(u):
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()
42 """
43
44 def getGroupById(id):
45 """Returns the portal_groupdata-ish object for a group corresponding
46 to this id."""
47
48 def getGroupsByUserId(userid):
49 """Returns a list of the groups the user corresponding to 'userid' belongs to."""
50
51 def listGroups():
52 """Returns a list of the available portal_groupdata-ish objects."""
53
54 def listGroupIds():
55 """Returns a list of the available groups' ids (WITHOUT prefixes)."""
56
57 def listGroupNames():
58 """Returns a list of the available groups' names (ie. without prefixes)."""
59
60 ## def getPureUserNames():
61 ## """Get the usernames (ids) of only users. """
62
63 ## def getPureUsers():
64 ## """Get the actual (unwrapped) user objects of only users. """
65
66 def searchForGroups(REQUEST, **kw): # maybe searchGroups()?
67 """Return a list of groups meeting certain conditions. """
68 # arguments need to be better refined?
69
70 def addGroup(id, roles = [], groups = [], **kw):
71 """Create a group with the supplied id, roles, and groups.
72
73 Underlying user folder must support adding users via the usual Zope API.
74 Passwords for groups seem to be currently irrelevant in GRUF."""
75
76 def editGroup(id, roles = [], groups = [], **kw):
77 """Edit the given group with the supplied roles.
78
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."""
82
83 def removeGroups(ids, keep_workspaces=0):
84 """Remove the group in the provided list (if possible).
85
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."""
89
90 def setGroupOwnership(group, object):
91 """Make the object 'object' owned by group 'group' (a portal_groupdata-ish object)"""
92
93 def setGroupWorkspacesFolder(id=""):
94 """ Set the location of the Group Workspaces folder by id.
95
96 The Group Workspaces Folder contains all the group workspaces, just like the
97 Members folder contains all the member folders.
98
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. """
102
103 def getGroupWorkspacesFolderId():
104 """ Get the Group Workspaces folder object's id.
105
106 The Group Workspaces Folder contains all the group workspaces, just like the
107 Members folder contains all the member folders. """
108
109 def getGroupWorkspacesFolder():
110 """ Get the Group Workspaces folder object.
111
112 The Group Workspaces Folder contains all the group workspaces, just like the
113 Members folder contains all the member folders. """
114
115 def toggleGroupWorkspacesCreation():
116 """ Toggles the flag for creation of a GroupWorkspaces folder upon first
117 use of the group. """
118
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). """
122
123 def getGroupWorkspaceType():
124 """Return the Type (as in TypesTool) to make the GroupWorkspace."""
125
126 def setGroupWorkspaceType(type):
127 """Set the Type (as in TypesTool) to make the GroupWorkspace. Expects the name of a Type."""
128
129 def createGrouparea(id):
130 """Create a space in the portal for the given group, much like member home
131 folders."""
132
133 def getGroupareaFolder(id):
134 """Returns the object of the group's work area."""
135
136 def getGroupareaURL(id):
137 """Returns the full URL to the group's work area."""
138
139 # and various roles things...