Back to index

plone3  3.1.7
group.py
Go to the documentation of this file.
00001 ##############################################################################
00002 #
00003 # PlonePAS - Adapt PluggableAuthService for use in Plone
00004 # Copyright (C) 2005 Enfold Systems, Kapil Thangavelu, et al
00005 #
00006 # This software is subject to the provisions of the Zope Public License,
00007 # Version 2.1 (ZPL).  A copy of the ZPL should accompany this
00008 # distribution.
00009 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
00010 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00011 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
00012 # FOR A PARTICULAR PURPOSE.
00013 #
00014 ##############################################################################
00015 """
00016 group interfaces for plone, based off existing group usage pre pas.
00017 
00018 """
00019 
00020 from zope.interface import Interface
00021 from Products.PluggableAuthService.interfaces import plugins
00022 
00023 
00024 class IGroupManagement(Interface):
00025 
00026     def addGroup(id, **kw):
00027         """
00028         Create a group with the supplied id, roles, and groups.
00029         return True if the operation suceeded
00030         """
00031 
00032     def addPrincipalToGroup(self, principal_id, group_id):
00033         """
00034         Add a given principal to the group.
00035         return True on success
00036         """
00037 
00038     def updateGroup(id, **kw):
00039         """
00040         Edit the given group. plugin specific
00041         return True on success
00042         """
00043 
00044     def setRolesForGroup(group_id, roles=()):
00045         """
00046         set roles for group
00047         return True on success
00048         """
00049 
00050     def removeGroup(group_id):
00051         """
00052         Remove the given group
00053         return True on success
00054         """
00055 
00056     def removePrincipalFromGroup(principal_id, group_id):
00057         """
00058         remove the given principal from the group
00059         return True on success
00060         """
00061 
00062 class IGroupIntrospection(Interface):
00063 
00064     def getGroupById(group_id):
00065         """
00066         Returns the portal_groupdata-ish object for a group
00067         corresponding to this id.
00068         """
00069 
00070     #################################
00071     # these interface methods are suspect for scalability.
00072     #################################
00073 
00074     def getGroups():
00075         """
00076         Returns an iteration of the available groups
00077         """
00078 
00079     def getGroupIds():
00080         """
00081         Returns a list of the available groups
00082         """
00083 
00084     def getGroupMembers(group_id):
00085         """
00086         return the members of the given group
00087         """
00088 
00089 class IGroupSpaceManagement(Interface):
00090 
00091     def getGroupSpaceContainer(self):
00092         """
00093         return the group space container
00094         """
00095 
00096     def setGroupSpaceCreationFlag(flag):
00097         """
00098         set the creation flag, ie. whether or not to create
00099         group spaces.
00100         """
00101 
00102     def getGroupSpaceForGroup(group_id):
00103         """
00104         return the groupspace for the given group id
00105         """
00106 
00107     def getGroupSpaceURL(group_id):
00108         """
00109         return the url to the groupspace for the given group
00110         """
00111 
00112     def createGroupSpace(group_id):
00113         """
00114         create a groupspace for the given group id
00115         """
00116 
00117 
00118 class IGroupDataTool(Interface):
00119 
00120     def wrapGroup(group):
00121         """
00122         decorate a group with property management capabilities if needed
00123         """
00124 
00125 class IGroupTool(IGroupIntrospection,
00126                   IGroupManagement,
00127                   plugins.IGroupsPlugin,
00128                   IGroupSpaceManagement):
00129 
00130     """
00131     Defines an interface for managing and introspecting and
00132     groups and group membership.
00133     """