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_memberdata, but for groups.
26 __version__
= "$Revision: $"
28 # $Id: portal_groupdata.py 30098 2006-09-08 12:35:01Z encolpe $
29 __docformat__
= 'restructuredtext'
31 from zope
.interface
import Interface
, Attribute
33 class portal_groupdata(Interface
):
34 """ A helper tool for portal_groups that transparently adds
35 properties to groups and provides convenience methods"""
37 ## id = Attribute('id', "Must be set to 'portal_groupdata'")
40 """ Returns an object implementing the GroupData interface"""
43 class GroupData(Interface
):
44 """ An abstract interface for accessing properties on a group object"""
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"""
51 """ Return the value of the property specified by 'id' """
54 """ Return the properties of this group. Properties are as usual in Zope."""
57 """ Return the string id of this group, WITHOUT group prefix."""
60 """This exists only for a basic user/group API compatibility
64 """ Return the name of the group."""
66 def getGroupMembers():
67 """ Return a list of the portal_memberdata-ish members of the group."""
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)."""
73 def getGroupMemberIds():
74 """ Return a list of the user ids of the group."""
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)."""
81 """ Add the existing member with the given id to the group"""
84 """ Remove the member with the provided id from the group """
87 """ Returns the actual group implementation. Varies by group
88 implementation (GRUF/Nux/et al)."""