[Zope3-checkins] CVS: Zope3/src/zope/security - context.py:1.2 manager.py:1.3 simplepolicies.py:1.2
Albertas Agejevas
alga@codeworks.lt
Thu, 13 Mar 2003 13:49:47 -0500
Update of /cvs-repository/Zope3/src/zope/security
In directory cvs.zope.org:/tmp/cvs-serv1411/src/zope/security
Modified Files:
context.py manager.py simplepolicies.py
Log Message:
An unexpected raid by the Whitespace Police.
Other than fixes of nonconforming whitespace, just a couple of $Id$
docstrings has been added.
=== Zope3/src/zope/security/context.py 1.1 => 1.2 ===
--- Zope3/src/zope/security/context.py:1.1 Mon Dec 30 22:35:13 2002
+++ Zope3/src/zope/security/context.py Thu Mar 13 13:49:16 2003
@@ -30,7 +30,7 @@
)
"""
- def __init__( self, user ):
+ def __init__(self, user):
self.stack = []
self.user = user
=== Zope3/src/zope/security/manager.py 1.2 => 1.3 ===
--- Zope3/src/zope/security/manager.py:1.2 Tue Feb 11 11:35:14 2003
+++ Zope3/src/zope/security/manager.py Thu Mar 13 13:49:16 2003
@@ -11,7 +11,10 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
-""" Default ISecurityManager implementation """
+"""Default ISecurityManager implementation
+
+$Id$
+"""
from zope.security.simplepolicies import ParanoidSecurityPolicy
@@ -27,7 +30,7 @@
addCleanUp(_clear)
-def setSecurityPolicy( aSecurityPolicy ):
+def setSecurityPolicy(aSecurityPolicy):
"""
Set the system default security policy.
@@ -49,11 +52,11 @@
"""
__implements__ = ISecurityManager
- def __init__( self, context ):
+ def __init__(self, context):
self._context = context
self._policy = None
- def _getPolicy( self ):
+ def _getPolicy(self):
"""
Find current policy, or default.
"""
@@ -65,7 +68,7 @@
#
# ISecurityManager implementation
#
- def getPrincipal( self ):
+ def getPrincipal(self):
"""
Return the authenticated user.
@@ -77,7 +80,7 @@
"""
return self._context.user
- def checkPermission( self, permission, object ):
+ def checkPermission(self, permission, object):
"""
Check whether the security context allows the given
permission on the given object. Return a boolean value.
@@ -88,28 +91,28 @@
object -- The object being accessed according to the permission
"""
- return self._getPolicy().checkPermission( permission, object
- , self._context )
+ return self._getPolicy().checkPermission(permission, object
+ , self._context)
- def pushExecutable( self, anExecutableObject ):
+ def pushExecutable(self, anExecutableObject):
"""
Push an ExecutableObject onto the manager's stack, and
activate its custom security policy, if any.
"""
stack=self._context.stack
- if len( stack ) >= MAX_STACK_SIZE:
+ if len(stack) >= MAX_STACK_SIZE:
raise SystemError, 'Excessive recursion'
- stack.append( anExecutableObject )
- p = getattr( anExecutableObject, '_customSecurityPolicy', None )
+ stack.append(anExecutableObject)
+ p = getattr(anExecutableObject, '_customSecurityPolicy', None)
if p is not None:
p = p()
self._policy = p
- def popExecutable( self, anExecutableObject ):
+ def popExecutable(self, anExecutableObject):
"""
Pop the topmost ExecutableObject from the stack, deactivating
any custom security policy it might have installed.
@@ -137,7 +140,7 @@
if stack:
top = stack[-1]
- p = getattr( top, '_customSecurityPolicy', None )
+ p = getattr(top, '_customSecurityPolicy', None)
if p is not None:
p=p()
@@ -146,7 +149,7 @@
else:
self._policy=None
- def calledByExecutable( self ):
+ def calledByExecutable(self):
"""
Return a boolean indicating whether the current request has
invoked any IExecutableObjects.
@@ -155,4 +158,4 @@
(more or less) directly from a URL, or if it was called by
through-the-web provided code.
"""
- return len( self._context.stack )
+ return len(self._context.stack)
=== Zope3/src/zope/security/simplepolicies.py 1.1 => 1.2 ===
--- Zope3/src/zope/security/simplepolicies.py:1.1 Mon Dec 30 22:35:13 2002
+++ Zope3/src/zope/security/simplepolicies.py Thu Mar 13 13:49:16 2003
@@ -23,7 +23,7 @@
"""
__implements__ = ISecurityPolicy
- def checkPermission( sel, permission, object, context ):
+ def checkPermission(self, permission, object, context):
if (context.user is system_user # no user
and not context.stack # no untrusted code
):
@@ -37,5 +37,5 @@
"""
__implements__ = ISecurityPolicy
- def checkPermission( self, permission, object, context ):
+ def checkPermission(self, permission, object, context):
return 1