c0786a23c24f4f03096bf67c38a1e08001fe585d
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 Interface
import Attribute
33 from Interface
import Interface
35 # for Zope versions before 2.6.0
36 from Interface
import Base
as Interface
38 class portal_groupdata(Interface
):
39 """ A helper tool for portal_groups that transparently adds
40 properties to groups and provides convenience methods"""
42 ## id = Attribute('id', "Must be set to 'portal_groupdata'")
45 """ Returns an object implementing the GroupData interface"""
48 class GroupData(Interface
):
49 """ An abstract interface for accessing properties on a group object"""
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"""
56 """ Return the value of the property specified by 'id' """
59 """ Return the properties of this group. Properties are as usual in Zope."""
62 """ Return the string id of this group, WITHOUT group prefix."""
65 """This exists only for a basic user/group API compatibility
69 """ Return the name of the group."""
71 def getGroupMembers():
72 """ Return a list of the portal_memberdata-ish members of the group."""
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)."""
78 def getGroupMemberIds():
79 """ Return a list of the user ids of the group."""
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)."""
86 """ Add the existing member with the given id to the group"""
89 """ Remove the member with the provided id from the group """
92 """ Returns the actual group implementation. Varies by group
93 implementation (GRUF/Nux/et al)."""