[Zope-Checkins] CVS: Zope/lib/python/Products/OFSP/help - AccessControl.py:1.1

Amos Latteier amos@zope.com
Thu, 18 Oct 2001 19:52:10 -0400


Update of /cvs-repository/Zope/lib/python/Products/OFSP/help
In directory cvs.zope.org:/tmp/cvs-serv25976

Added Files:
	AccessControl.py 
Log Message:
Added documentation for the AccessControl.getSecurityManager function and the SecurityManager class. They are usuable from Python-based scripts and ZPT.


=== Added File Zope/lib/python/Products/OFSP/help/AccessControl.py ===
"""
AccessControl: Security functions and classes

  The functions and classes in this module are available to
  Python-based Scripts and Page Templates.

"""

def getSecurityManager():
    """
    Returns the security manager. See the 'SecurityManager' class.
    """

class SecurityManager:
    """
    A security manager provides methods for checking access and
    managing executable context and policies
    """

    def validate(accessed=None, container=None, name=None, value=None,
                 roles=None):
        """
        Validate access.

        Arguments:
        
        accessed -- the object that was being accessed
        
        container -- the object the value was found in
        
        name -- The name used to access the value
        
        value -- The value retrieved though the access.

        roles -- The roles of the object if already known.
        
        The arguments may be provided as keyword arguments. Some of
        these arguments may be omitted, however, the policy may
        reject access in some cases when arguments are omitted.  It
        is best to provide all the values possible.

        permission -- Always available
        """

    def validateValue(self, value, roles=None):
        """
        Convenience for common case of simple value validation.

        permission -- Always available
        """

    def checkPermission(self, permission, object):
        """
        Check whether the security context allows the given permission
        on the given object.

        permission -- Always available
        """

    def getUser(self):
        """
        Get the current authenticated user. See the
        "AuthenticatedUser":AuthenticatedUser.py class.

        permission -- Always available
        """

    def calledByExecutable(self):
        """
        Return a boolean value indicating if this context was called
        by an executable.

        permission -- Always available
        """