Ajout de GroupUserFolder extrait de l'état suivant :
[GroupUserFolder.git] / interfaces / portal_groupdata.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_memberdata, but for groups.
25 """
26 __version__ = "$Revision: $"
27 # $Source: $
28 # $Id: portal_groupdata.py 30098 2006-09-08 12:35:01Z encolpe $
29 __docformat__ = 'restructuredtext'
30
31 from Interface import Attribute
32 try:
33 from Interface import Interface
34 except ImportError:
35 # for Zope versions before 2.6.0
36 from Interface import Base as Interface
37
38 class portal_groupdata(Interface):
39 """ A helper tool for portal_groups that transparently adds
40 properties to groups and provides convenience methods"""
41
42 ## id = Attribute('id', "Must be set to 'portal_groupdata'")
43
44 def wrapGroup(g):
45 """ Returns an object implementing the GroupData interface"""
46
47
48 class GroupData(Interface):
49 """ An abstract interface for accessing properties on a group object"""
50
51 def setProperties(properties=None, **kw):
52 """Allows setting of group properties en masse.
53 Properties can be given either as a dict or a keyword parameters list"""
54
55 def getProperty(id):
56 """ Return the value of the property specified by 'id' """
57
58 def getProperties():
59 """ Return the properties of this group. Properties are as usual in Zope."""
60
61 def getGroupId():
62 """ Return the string id of this group, WITHOUT group prefix."""
63
64 def getMemberId():
65 """This exists only for a basic user/group API compatibility
66 """
67
68 def getGroupName():
69 """ Return the name of the group."""
70
71 def getGroupMembers():
72 """ Return a list of the portal_memberdata-ish members of the group."""
73
74 def getAllGroupMembers():
75 """ Return a list of the portal_memberdata-ish members of the group
76 including transitive ones (ie. users or groups of a group in that group)."""
77
78 def getGroupMemberIds():
79 """ Return a list of the user ids of the group."""
80
81 def getAllGroupMemberIds():
82 """ Return a list of the user ids of the group.
83 including transitive ones (ie. users or groups of a group in that group)."""
84
85 def addMember(id):
86 """ Add the existing member with the given id to the group"""
87
88 def removeMember(id):
89 """ Remove the member with the provided id from the group """
90
91 def getGroup():
92 """ Returns the actual group implementation. Varies by group
93 implementation (GRUF/Nux/et al)."""