Back to index

plone3  3.1.7
capabilities.py
Go to the documentation of this file.
00001 ##############################################################################
00002 #
00003 # PlonePAS - Adapt PluggableAuthService for use in Plone
00004 # Copyright (C) 2005 Enfold Systems
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 Define certain interfaces that a plugin must meet if it is to allow
00017 certain operations to be done by the Plone UI.
00018 
00019 """
00020 
00021 from Products.PluggableAuthService.interfaces.plugins import Interface
00022 
00023 class 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 
00029     def allowDeletePrincipal(self, id):
00030         """True iff this plugin can delete a certain user/group."""
00031 
00032 class 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 
00038     def 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 
00050 class IGroupCapability(Interface):
00051     """Interface for plugin to say if it allows for deletion of a user.
00052     For Plone UI.
00053     """
00054 
00055     def allowGroupAdd(self, principal_id, group_id):
00056         """True iff this plugin will allow adding a certain principal to a certain group."""
00057 
00058     def allowGroupRemove(self, principal_id, group_id):
00059         """True iff this plugin will allow removing a certain principal from a certain group."""
00060 
00061 
00062 class IAssignRoleCapability(Interface):
00063     """Interface for plugin to say if it allows for deletion of a user.
00064     For Plone UI.
00065     """
00066 
00067     def allowRoleAssign(self, id, role):
00068         """True iff this plugin will allow assigning a certain principal a certain role."""
00069 
00070 
00071 
00072 class IManageCapabilities(Interface):
00073     """Interface for MemberData/GroupData to provide information as to whether or not
00074     the member can be deleted, reset password, modify a property.
00075     """
00076 
00077     def canDelete(self):
00078         """True iff user can be removed from the Plone UI."""
00079 
00080     def canPasswordSet(self):
00081         """True iff user can change password."""
00082 
00083     def passwordInClear(self):
00084         """True iff password can be retrieved in the clear (not hashed.)"""
00085 
00086     def canWriteProperty(self, prop_name):
00087         """True iff the member/group property named in 'prop_name'
00088         can be changed.
00089         """
00090 
00091     def canAddToGroup(self, group_id):
00092         """True iff member can be added to group."""
00093 
00094     def canRemoveFromGroup(self, group_id):
00095         """True iff member can be removed from group."""
00096 
00097     def canAssignRole(self, role):
00098         """True iff member can be assigned role."""