Back to index

plone3  3.1.7
plugins.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 """
00017 
00018 from Products.PluggableAuthService.interfaces import plugins
00019 from Products.PluggableAuthService.interfaces.plugins import Interface
00020 
00021 class IUserIntrospection(Interface):
00022     """
00023     Introspect users in a user source, api users need to be careful as
00024     all sources may or not support this interface.
00025 
00026     Realistically this can only be done by authentication sources, or
00027     plugins which have intimate knowledge of such.
00028     """
00029 
00030     def getUserIds(self):
00031         """
00032         Return a list of user ids
00033         """
00034 
00035     def getUserNames(self):
00036         """
00037         Return a list of usernames
00038         """
00039 
00040     def getUsers(self):
00041         """
00042         Return a list of users
00043         """
00044 
00045 class ILocalRolesPlugin(Interface):
00046     """
00047     Plugin for determining a user's local roles and object access
00048     based on local roles.
00049     """
00050 
00051     def getRolesInContext(user, object):
00052         """
00053         Return the list of roles assigned to the user.
00054 
00055         o Include local roles assigned in context of the passed-in object.
00056 
00057         o Include *both* local roles assigned directly to us *and* those
00058           assigned to our groups.
00059 
00060         o Ripped off from AccessControl.User.BasicUser, which provides
00061           no other extension mechanism. :(
00062         """
00063 
00064     def checkLocalRolesAllowed(user, object, object_roles):
00065         """
00066         Check whether the user has access to object based
00067         on local roles. access is determined by a user's local roles
00068         including one of the object roles.
00069         """
00070 
00071     def getAllLocalRolesInContext(object):
00072         """
00073         Return active all local roles in a context.
00074 
00075         The roles are returned in a dictionary mapping a principal (a
00076         user or a group) to the set of roles assigned to it.
00077         """
00078 
00079 
00080 
00081 class IUserManagement(plugins.IUserAdderPlugin):
00082     """
00083     Manage users
00084     """
00085 
00086     def doChangeUser(login, password, **kw):
00087         """
00088         Change a user's password (differs from role) roles are set in
00089         the pas engine api for the same but are set via a role
00090         manager)
00091         """
00092 
00093     def doDeleteUser(login):
00094         """
00095         Remove a user record from a User Manager, with the given login
00096         and password
00097 
00098         o Return a Boolean indicating whether a user was removed or
00099           not
00100         """
00101 
00102 
00103 class IMutablePropertiesPlugin(Interface):
00104     """
00105     Return a property set for a user. Property set can either an
00106     object conforming to the IMutable property sheet interface or a
00107     dictionary (in which case the properties are not persistently
00108     mutable).
00109     """
00110 
00111     def getPropertiesForUser(user, request=None):
00112         """
00113         User -> IMutablePropertySheet || {}
00114 
00115         o User will implement IPropertiedUser.
00116 
00117         o Plugin may scribble on the user, if needed (but must still
00118           return a mapping, even if empty).
00119 
00120         o May assign properties based on values in the REQUEST object, if
00121           present
00122         """
00123 
00124     def setPropertiesForUser(user, propertysheet):
00125         """
00126         Set modified properties on the user persistently.
00127 
00128         Raise a ValueError if the property or property value is invalid
00129         """
00130 
00131     def deleteUser(user_id):
00132         """
00133         Remove properties stored for a user
00134         """
00135 
00136 
00137 class ISchemaMutablePropertiesPlugin(Interface):
00138 
00139     def addProperty(property_type, property_name, default=None):
00140         """
00141         Add a new property to a property provider.
00142         """