00001##############################################################################00002 #00003 # PlonePAS - Adapt PluggableAuthService for use in Plone00004 # Copyright (C) 2005 Enfold Systems00005 #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 this00008 # distribution.00009 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED00010 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED00011 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS00012 # FOR A PARTICULAR PURPOSE.00013 #00014 ##############################################################################00015 """00016 Define certain interfaces that a plugin must meet if it is to allow00017 certain operations to be done by the Plone UI.00018 00019 """00020
00021 from Products.PluggableAuthService.interfaces.plugins import Interface
00022
00023class IDeleteCapability(Interface):
00024 """Interface for plugin to say if it allows for deletion of a user.00025 Expected to be found on IUserManagement plugins.00026 For Plone UI.00027 """00028
00029def allowDeletePrincipal(self, id):
00030 """True iff this plugin can delete a certain user/group."""00031
00032class IPasswordSetCapability(Interface):
00033 """Interface for plugin to say if it allows for setting the password of a user.00034 Expected to be found on IUserManagement plugins.00035 For Plone UI.00036 """00037
00038def allowPasswordSet(self, id):
00039 """True iff this plugin can set the password of a certain user."""00040
00041
00042 #class IPasswordClearCapability(Interface):00043 # """Interface for plugin to say if it allows for deletion of a user.00044 # For Plone UI.00045 # """00046 #00047 # def passwordInClear(self, user_id):00048 # """True iff this plugin provides a clear-text password for a certain user."""00049
00050class IGroupCapability(Interface):
00051 """Interface for plugin to say if it allows for deletion of a user.00052 For Plone UI.00053 """00054
00055def allowGroupAdd(self, principal_id, group_id):
00056 """True iff this plugin will allow adding a certain principal to a certain group."""00057
00058def allowGroupRemove(self, principal_id, group_id):
00059 """True iff this plugin will allow removing a certain principal from a certain group."""00060
00061
00062class IAssignRoleCapability(Interface):
00063 """Interface for plugin to say if it allows for deletion of a user.00064 For Plone UI.00065 """00066
00067def allowRoleAssign(self, id, role):
00068 """True iff this plugin will allow assigning a certain principal a certain role."""00069
00070
00071
00072class IManageCapabilities(Interface):
00073 """Interface for MemberData/GroupData to provide information as to whether or not00074 the member can be deleted, reset password, modify a property.00075 """00076
00077def canDelete(self):
00078 """True iff user can be removed from the Plone UI."""00079
00080def canPasswordSet(self):
00081 """True iff user can change password."""00082
00083def passwordInClear(self):
00084 """True iff password can be retrieved in the clear (not hashed.)"""00085
00086def canWriteProperty(self, prop_name):
00087 """True iff the member/group property named in 'prop_name'00088 can be changed.00089 """00090
00091def canAddToGroup(self, group_id):
00092 """True iff member can be added to group."""00093
00094def canRemoveFromGroup(self, group_id):
00095 """True iff member can be removed from group."""00096
00097def canAssignRole(self, role):
00098 """True iff member can be assigned role."""