Back to index

plone3  3.1.7
portal_groups.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_membership, but for groups.
00025 """
00026 __version__ = "$Revision:  $"
00027 # $Source:  $
00028 # $Id: portal_groups.py 30098 2006-09-08 12:35:01Z encolpe $
00029 __docformat__ = 'restructuredtext'
00030 
00031 
00032 from Interface import Attribute
00033 try:
00034     from Interface import Interface
00035 except ImportError:
00036     # for Zope versions before 2.6.0
00037     from Interface import Base as Interface
00038 
00039 class portal_groups(Interface):
00040     """Defines an interface for working with groups in an abstract manner.
00041     Parallels the portal_membership interface of CMFCore"""
00042 ##    id = Attribute('id','Must be set to "portal_groups"')
00043 
00044     def isGroup(u):
00045         """Test if a user/group object is a group or not.
00046         You must pass an object you get earlier with wrapUser() or wrapGroup()
00047         """
00048 
00049     def getGroupById(id):
00050         """Returns the portal_groupdata-ish object for a group corresponding
00051         to this id."""
00052 
00053     def getGroupsByUserId(userid):
00054         """Returns a list of the groups the user corresponding to 'userid' belongs to."""
00055 
00056     def listGroups():
00057         """Returns a list of the available portal_groupdata-ish objects."""
00058 
00059     def listGroupIds():
00060         """Returns a list of the available groups' ids (WITHOUT prefixes)."""
00061 
00062     def listGroupNames():
00063         """Returns a list of the available groups' names (ie. without prefixes)."""
00064 
00065 ##    def getPureUserNames():
00066 ##        """Get the usernames (ids) of only users. """
00067 
00068 ##    def getPureUsers():
00069 ##        """Get the actual (unwrapped) user objects of only users. """
00070 
00071     def searchForGroups(REQUEST, **kw):    # maybe searchGroups()?
00072         """Return a list of groups meeting certain conditions. """
00073         # arguments need to be better refined?
00074 
00075     def addGroup(id, roles = [], groups = [], **kw):
00076         """Create a group with the supplied id, roles, and groups.
00077 
00078         Underlying user folder must support adding users via the usual Zope API.
00079         Passwords for groups seem to be currently irrelevant in GRUF."""
00080 
00081     def editGroup(id, roles = [], groups = [], **kw):
00082         """Edit the given group with the supplied roles.
00083 
00084         Underlying user folder must support editing users via the usual Zope API.
00085         Passwords for groups seem to be currently irrelevant in GRUF.
00086         One can supply additional named parameters to set group properties."""
00087 
00088     def removeGroups(ids, keep_workspaces=0):
00089         """Remove the group in the provided list (if possible).
00090 
00091         Will by default remove this group's GroupWorkspace if it exists. You may
00092         turn this off by specifying keep_workspaces=true.
00093         Underlying user folder must support removing users via the usual Zope API."""
00094 
00095     def setGroupOwnership(group, object):
00096         """Make the object 'object' owned by group 'group' (a portal_groupdata-ish object)"""
00097 
00098     def setGroupWorkspacesFolder(id=""):
00099         """ Set the location of the Group Workspaces folder by id.
00100 
00101         The Group Workspaces Folder contains all the group workspaces, just like the
00102         Members folder contains all the member folders.
00103 
00104         If anyone really cares, we can probably make the id work as a path as well,
00105         but for the moment it's only an id for a folder in the portal root, just like the
00106         corresponding MembershipTool functionality. """
00107 
00108     def getGroupWorkspacesFolderId():
00109         """ Get the Group Workspaces folder object's id.
00110 
00111         The Group Workspaces Folder contains all the group workspaces, just like the
00112         Members folder contains all the member folders. """
00113 
00114     def getGroupWorkspacesFolder():
00115         """ Get the Group Workspaces folder object.
00116 
00117         The Group Workspaces Folder contains all the group workspaces, just like the
00118         Members folder contains all the member folders. """
00119 
00120     def toggleGroupWorkspacesCreation():
00121         """ Toggles the flag for creation of a GroupWorkspaces folder upon first
00122         use of the group. """
00123 
00124     def getGroupWorkspacesCreationFlag():
00125         """Return the (boolean) flag indicating whether the Groups Tool will create a group workspace
00126         upon the next use of the group (if one doesn't exist). """
00127 
00128     def getGroupWorkspaceType():
00129         """Return the Type (as in TypesTool) to make the GroupWorkspace."""
00130 
00131     def setGroupWorkspaceType(type):
00132         """Set the Type (as in TypesTool) to make the GroupWorkspace. Expects the name of a Type."""
00133 
00134     def createGrouparea(id):
00135         """Create a space in the portal for the given group, much like member home
00136         folders."""
00137 
00138     def getGroupareaFolder(id):
00139         """Returns the object of the group's work area."""
00140 
00141     def getGroupareaURL(id):
00142         """Returns the full URL to the group's work area."""
00143 
00144     # and various roles things...