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