diff options
author | Jason Madden <jamadden@gmail.com> | 2017-09-14 10:23:43 -0500 |
---|---|---|
committer | Jason Madden <jamadden@gmail.com> | 2017-09-14 10:23:43 -0500 |
commit | e504906ab28fed2decade91f289987dbf7e0d497 (patch) | |
tree | 2f85d3ee900b8b2c5c435749626fe780db9bd11b /src | |
parent | ed8946b75f216eb956f28f5769eb4af9f31b1eb8 (diff) | |
download | zope-security-e504906ab28fed2decade91f289987dbf7e0d497.tar.gz |
Doc cross-refs and cleanup for management.rst/py
Diffstat (limited to 'src')
-rw-r--r-- | src/zope/security/management.py | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/src/zope/security/management.py b/src/zope/security/management.py index 7a77f1a..0c037d0 100644 --- a/src/zope/security/management.py +++ b/src/zope/security/management.py @@ -11,7 +11,11 @@ # FOR A PARTICULAR PURPOSE. # ############################################################################## -"""Default 'ISecurityManagement' and 'IInteractionManagement' implementation +""" +Default :class:`zope.security.interfaces.ISecurityManagement` and +:class:`zope.security.interfaces.IInteractionManagement` implementation. + +Note that this module itself provides those interfaces. """ from zope.interface import moduleProvides @@ -58,6 +62,7 @@ def setSecurityPolicy(aSecurityPolicy): # def queryInteraction(): + """Return a current interaction, if there is one.""" return getattr(thread_local, 'interaction', None) def getInteraction(): @@ -70,7 +75,10 @@ def getInteraction(): class ExistingInteraction(ValueError, AssertionError, #BBB ): - pass + """ + The exception that :func:`newInteraction` will raise if called + during an existing interaction. + """ def newInteraction(*participations): """Start a new interaction.""" @@ -109,16 +117,16 @@ def restoreInteraction(): def checkPermission(permission, object, interaction=None): """Return whether security policy allows permission on object. - 'permission' is a permission name. - - 'object' is the object being accessed according to the permission. - - 'interaction' is an interaction, providing access to information - such as authenticated principals. If it is None, the current - interaction is used. - - checkPermission is guaranteed to return True if permission is - CheckerPublic or None. + :param str permission: A permission name. + :param object: The object being accessed according to the permission. + :param interaction: An interaction, providing access to information + such as authenticated principals. If it is None, the current + interaction is used. + :return: A boolean value. ``checkPermission`` is guaranteed to + return ``True`` if *permission* is + :data:`zope.security.checker.CheckerPublic` or ``None``. + :raise NoInteraction: If there is no current interaction and no + interaction argument was given. """ if permission is CheckerPublic or permission is None: return True |