Back to index

plone3  3.1.7
portal_groupdata.py
Go to the documentation of this file.
00001 # -*- coding: utf-8 -*-
00002 ## GroupUserFolder
00003 ## Copyright (C)2006 Ingeniweb
00004 
00005 ## This program is free software; you can redistribute it and/or modify
00006 ## it under the terms of the GNU General Public License as published by
00007 ## the Free Software Foundation; either version 2 of the License, or
00008 ## (at your option) any later version.
00009 
00010 ## This program is distributed in the hope that it will be useful,
00011 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 ## GNU General Public License for more details.
00014 
00015 ## You should have received a copy of the GNU General Public License
00016 ## along with this program; see the file COPYING. If not, write to the
00017 ## Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00018 
00019 ## Copyright (c) 2003 The Connexions Project, All Rights Reserved
00020 ## initially written by J Cameron Cooper, 11 June 2003
00021 ## concept with Brent Hendricks, George Runyan
00022 """Groups tool interface
00023 
00024 Goes along the lines of portal_memberdata, but for groups.
00025 """
00026 __version__ = "$Revision:  $"
00027 # $Source:  $
00028 # $Id: portal_groupdata.py 30098 2006-09-08 12:35:01Z encolpe $
00029 __docformat__ = 'restructuredtext'
00030 
00031 from Interface import Attribute
00032 try:
00033     from Interface import Interface
00034 except ImportError:
00035     # for Zope versions before 2.6.0
00036     from Interface import Base as Interface
00037 
00038 class portal_groupdata(Interface):
00039     """ A helper tool for portal_groups that transparently adds
00040     properties to groups and provides convenience methods"""
00041 
00042 ##    id = Attribute('id', "Must be set to 'portal_groupdata'")
00043 
00044     def wrapGroup(g):
00045         """ Returns an object implementing the GroupData interface"""
00046 
00047 
00048 class GroupData(Interface):
00049     """ An abstract interface for accessing properties on a group object"""
00050 
00051     def setProperties(properties=None, **kw):
00052         """Allows setting of group properties en masse.
00053         Properties can be given either as a dict or a keyword parameters list"""
00054 
00055     def getProperty(id):
00056         """ Return the value of the property specified by 'id' """
00057 
00058     def getProperties():
00059         """ Return the properties of this group. Properties are as usual in Zope."""
00060 
00061     def getGroupId():
00062         """ Return the string id of this group, WITHOUT group prefix."""
00063 
00064     def getMemberId():
00065         """This exists only for a basic user/group API compatibility
00066         """
00067 
00068     def getGroupName():
00069         """ Return the name of the group."""
00070 
00071     def getGroupMembers():
00072         """ Return a list of the portal_memberdata-ish members of the group."""
00073 
00074     def getAllGroupMembers():
00075         """ Return a list of the portal_memberdata-ish members of the group
00076         including transitive ones (ie. users or groups of a group in that group)."""
00077 
00078     def getGroupMemberIds():
00079         """ Return a list of the user ids of the group."""
00080 
00081     def getAllGroupMemberIds():
00082         """ Return a list of the user ids of the group.
00083         including transitive ones (ie. users or groups of a group in that group)."""
00084 
00085     def addMember(id):
00086         """ Add the existing member with the given id to the group"""
00087 
00088     def removeMember(id):
00089         """ Remove the member with the provided id from the group """
00090 
00091     def getGroup():
00092         """ Returns the actual group implementation. Varies by group
00093         implementation (GRUF/Nux/et al)."""