[Zope-Checkins] CVS: Zope/lib/python/AccessControl - AuthEncoding.py:1.7 DTML.py:1.10 Owned.py:1.18 Permission.py:1.10 PermissionMapping.py:1.13 PermissionRole.py:1.16 Permissions.py:1.5 Role.py:1.55 SecurityInfo.py:1.15 SecurityManagement.py:1.7 SecurityManager.py:1.13 SimpleObjectPolicies.py:1.12 SpecialUsers.py:1.4 User.py:1.170 ZopeGuards.py:1.11 ZopeSecurityPolicy.py:1.19 __init__.py:1.15 unauthorized.py:1.4
Martijn Pieters
mj@zope.com
Wed, 14 Aug 2002 17:29:09 -0400
Update of /cvs-repository/Zope/lib/python/AccessControl
In directory cvs.zope.org:/tmp/cvs-serv12405
Modified Files:
AuthEncoding.py DTML.py Owned.py Permission.py
PermissionMapping.py PermissionRole.py Permissions.py Role.py
SecurityInfo.py SecurityManagement.py SecurityManager.py
SimpleObjectPolicies.py SpecialUsers.py User.py ZopeGuards.py
ZopeSecurityPolicy.py __init__.py unauthorized.py
Log Message:
Clean up indentation and trailing whitespace.
=== Zope/lib/python/AccessControl/AuthEncoding.py 1.6 => 1.7 ===
--- Zope/lib/python/AccessControl/AuthEncoding.py:1.6 Thu Dec 13 09:23:05 2001
+++ Zope/lib/python/AccessControl/AuthEncoding.py Wed Aug 14 17:29:07 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__version__='$Revision$'[11:-2]
=== Zope/lib/python/AccessControl/DTML.py 1.9 => 1.10 ===
--- Zope/lib/python/AccessControl/DTML.py:1.9 Wed Nov 28 10:50:51 2001
+++ Zope/lib/python/AccessControl/DTML.py Wed Aug 14 17:29:07 2002
@@ -1,18 +1,18 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
'''Add security system support to Document Templates
-$Id$'''
+$Id$'''
__version__='$Revision$'[11:-2]
from DocumentTemplate import DT_Util
@@ -46,7 +46,7 @@
'''
A mix-in for derivatives of DT_String.String that adds Zope security.
'''
-
+
# Allow access to unprotected attributes
DT_Util.TemplateDict.__allow_access_to_unprotected_subobjects__=1
@@ -67,15 +67,15 @@
"""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.
-
+
The arguments may be provided as keyword arguments. Some of these
arguments may be ommitted, however, the policy may reject access
in some cases when arguments are ommitted. It is best to provide
@@ -99,9 +99,9 @@
the given object.
Arguments:
-
+
permission -- A permission name
-
+
object -- The object being accessed according to the permission
"""
return (SecurityManagement
@@ -127,4 +127,3 @@
return r
DT_Util.TemplateDict.__dict__.update(DTMLSecurityAPI.__dict__)
-
=== Zope/lib/python/AccessControl/Owned.py 1.17 => 1.18 ===
--- Zope/lib/python/AccessControl/Owned.py:1.17 Wed Jun 12 14:14:39 2002
+++ Zope/lib/python/AccessControl/Owned.py Wed Aug 14 17:29:07 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__doc__='''Support for owned objects
@@ -39,14 +39,14 @@
('manage_takeOwnership','manage_changeOwnershipType'),
("Owner",)),
)
-
+
manage_options=({'label': 'Ownership',
'action': 'manage_owner',
'help': ('OFSP','Ownership.stx'),
'filter': ownableFilter
},
)
-
+
manage_owner=Globals.DTMLFile('dtml/owner', globals())
def owner_info(self):
@@ -60,7 +60,7 @@
getSecurityManager().checkPermission('Take ownership', self)
}
return d
-
+
getOwner__roles__=()
def getOwner(self, info=0,
aq_get=aq_get, None=None,
@@ -108,7 +108,7 @@
else:
# make ownership explicit
child._owner=new
-
+
if old is not UnownableOwner:
self._owner=new
@@ -134,7 +134,7 @@
if (want_referer != got_referer or security.calledByExecutable()):
raise Unauthorized, (
'manage_takeOwnership was called from an invalid context'
- )
+ )
self.changeOwnership(security.getUser(), recursive)
@@ -159,7 +159,7 @@
del self._owner
if RESPONSE is not None: RESPONSE.redirect(REQUEST['HTTP_REFERER'])
-
+
def _deleteOwnershipAfterAdd(self):
# Only delete _owner if it is an instance attribute.
@@ -172,7 +172,7 @@
try: object._deleteOwnershipAfterAdd()
except: pass
if s is None: object._p_deactivate()
-
+
def manage_fixupOwnershipAfterAdd(self):
# Sigh, get the parent's _owner
@@ -216,7 +216,7 @@
except: pass
if s is None: object._p_deactivate()
-
+
Globals.default__class_init__(Owned)
class EmergencyUserCannotOwn(Exception):
@@ -224,7 +224,7 @@
class EditUnowned(Exception):
"Can't edit unowned executables"
-
+
def absattr(attr):
if callable(attr): return attr()
@@ -253,4 +253,3 @@
path.reverse()
return path, uid
-
=== Zope/lib/python/AccessControl/Permission.py 1.9 => 1.10 ===
--- Zope/lib/python/AccessControl/Permission.py:1.9 Thu Dec 13 09:24:26 2001
+++ Zope/lib/python/AccessControl/Permission.py Wed Aug 14 17:29:07 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__doc__='''short description
@@ -79,7 +79,7 @@
if roles is None: return ['Manager','Anonymous']
if roles is _marker: return ['Manager']
-
+
return roles
def setRoles(self, roles):
@@ -89,7 +89,7 @@
if hasattr(obj, self._p): delattr(obj, self._p)
else:
setattr(obj, self._p, roles)
-
+
for name in self.data:
if name=='': attr=obj
else: attr=getattr(obj, name)
@@ -112,7 +112,7 @@
if type(roles) is ListType: roles.append(role)
else: roles=roles+(role,)
self.setRoles(roles)
-
+
def __len__(self): return 1
def __str__(self): return self.name
=== Zope/lib/python/AccessControl/PermissionMapping.py 1.12 => 1.13 ===
--- Zope/lib/python/AccessControl/PermissionMapping.py:1.12 Thu Aug 1 12:00:39 2002
+++ Zope/lib/python/AccessControl/PermissionMapping.py Wed Aug 14 17:29:07 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Permission Mapping
@@ -40,14 +40,14 @@
perms={}
for p in self.possible_permissions():
perms[pname(p)]=p
-
+
r=[]
a=r.append
for ac_perms in self.ac_inherited_permissions(1):
p=perms.get(getPermissionMapping(ac_perms[0], wrapper), '')
a({'permission_name': ac_perms[0], 'class_permission': p})
return r
-
+
def manage_setPermissionMapping(self,
permission_names=[],
class_permissions=[], REQUEST=None):
@@ -66,7 +66,7 @@
"""Attempted to map a permission to a permission, %s,
that is not valid. This should never happen. (Waaa).
""" % escape(p))
-
+
setPermissionMapping(name, wrapper, p)
@@ -74,7 +74,7 @@
if REQUEST is not None:
return self.manage_access(
- REQUEST,
+ REQUEST,
manage_tabs_message='The permission mapping has been updated')
def _isBeingUsedAsAMethod(self, REQUEST =None, wannaBe=0):
@@ -94,9 +94,9 @@
p=getattr(self,'aq_parent',None)
if p is None: return 0 # Not wrapped
base=getattr(p, 'aq_base', None)
- return type(base) is PermissionMapper
-
-
+ return type(base) is PermissionMapper
+
+
def getPermissionMapping(name, obj, st=type('')):
obj=getattr(obj, 'aq_base', obj)
name=pname(name)
@@ -114,13 +114,13 @@
_View_Permission='_View_Permission'
_is_wrapperish = 1
-
+
def __getattr__(self, name):
# We want to make sure that any non-explicitly set methods are
# private!
if name.startswith('_') and name.endswith("_Permission"): return ''
raise AttributeError, escape(name)
-
+
PermissionMapper=PM
def aqwrap(object, wrapper, parent):
=== Zope/lib/python/AccessControl/PermissionRole.py 1.15 => 1.16 ===
--- Zope/lib/python/AccessControl/PermissionRole.py:1.15 Thu Dec 13 09:24:41 2001
+++ Zope/lib/python/AccessControl/PermissionRole.py Wed Aug 14 17:29:07 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__doc__='''Objects that implement Permission-based roles.
@@ -132,7 +132,7 @@
def __getitem__(self, i):
try:
v=self._v
- except:
+ except:
v=self._v=self.__of__(self._pa)
del self._pa
@@ -141,13 +141,13 @@
def __len__(self):
try:
v=self._v
- except:
+ except:
v=self._v=self.__of__(self._pa)
del self._pa
return len(v)
-##############################################################################
+##############################################################################
# Test functions:
#
@@ -177,7 +177,7 @@
a._z_Permission=('zee',)
a.b.c._y_Permission=('Manage',)
a.b._z_Permission=['also']
-
+
print a.x.__roles__, list(a.x.__roles__)
print a.b.x.__roles__
print a.b.c.x.__roles__
@@ -185,7 +185,7 @@
print a.b.q.x.__roles__
print a.b.c.q.x.__roles__
print
-
+
print a.y.__roles__, list(a.y.__roles__)
print a.b.y.__roles__
print a.b.c.y.__roles__
@@ -193,7 +193,7 @@
print a.b.q.y.__roles__
print a.b.c.q.y.__roles__
print
-
+
print a.z.__roles__, list(a.z.__roles__)
print a.b.z.__roles__
print a.b.c.z.__roles__
=== Zope/lib/python/AccessControl/Permissions.py 1.4 => 1.5 ===
--- Zope/lib/python/AccessControl/Permissions.py:1.4 Fri Jul 19 14:33:15 2002
+++ Zope/lib/python/AccessControl/Permissions.py Wed Aug 14 17:29:07 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Constant definitions for built-in Zope permissions"""
=== Zope/lib/python/AccessControl/Role.py 1.54 => 1.55 ===
--- Zope/lib/python/AccessControl/Role.py:1.54 Thu Aug 1 12:00:39 2002
+++ Zope/lib/python/AccessControl/Role.py Wed Aug 14 17:29:07 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Access control support"""
@@ -61,7 +61,7 @@
'filter': _isBeingUsedAsAMethod,
},
)
-
+
__ac_roles__=('Manager', 'Owner', 'Anonymous', 'Authenticated')
permissionMappingPossibleValues=Acquired
@@ -75,19 +75,19 @@
d={}
perms=self.__ac_permissions__
for p in perms: d[p[0]]=None
-
+
r=gather_permissions(self.__class__, [], d)
if all:
- if hasattr(self, '_subobject_permissions'):
- for p in self._subobject_permissions():
- pname=p[0]
- if not d.has_key(pname):
- d[pname]=1
- r.append(p)
-
- r=list(perms)+r
- r.sort()
-
+ if hasattr(self, '_subobject_permissions'):
+ for p in self._subobject_permissions():
+ pname=p[0]
+ if not d.has_key(pname):
+ d[pname]=1
+ r.append(p)
+
+ r=list(perms)+r
+ r.sort()
+
return tuple(r)
def permission_settings(self):
@@ -147,12 +147,12 @@
else: p.setRoles(tuple(roles))
if REQUEST is not None: return self.manage_access(REQUEST)
-
+
manage_permissionForm=DTMLFile('dtml/permissionEdit', globals(),
management_view='Security',
help_topic='Security_Manage-Permission.stx',
help_product='OFSP')
-
+
def manage_permission(self, permission_to_manage,
roles=[], acquire=0, REQUEST=None):
"""Change the settings for the given permission
@@ -172,13 +172,13 @@
return
raise 'Invalid Permission', (
- "The permission <em>%s</em> is invalid." %
+ "The permission <em>%s</em> is invalid." %
escape(permission_to_manage))
-
+
_normal_manage_access=DTMLFile('dtml/access', globals())
_method_manage_access=DTMLFile('dtml/methodAccess', globals())
-
+
def manage_access(self, REQUEST, **kw):
"Return an interface for making permissions settings"
if hasattr(self, '_isBeingUsedAsAMethod') and \
@@ -186,7 +186,7 @@
return apply(self._method_manage_access,(), kw)
else:
return apply(self._normal_manage_access,(), kw)
-
+
def manage_changePermissions(self, REQUEST):
"Change all permissions settings, called by management screen"
self._isBeingUsedAsAMethod(REQUEST, 0)
@@ -244,7 +244,7 @@
'selected': role in roles and 'SELECTED' or '',
},
valid_roles)
-
+
raise 'Invalid Permission', (
"The permission <em>%s</em> is invalid." % escape(permission))
@@ -256,7 +256,7 @@
p=Permission(name,value,self)
roles=p.getRoles()
return type(roles) is ListType and 'CHECKED' or ''
-
+
raise 'Invalid Permission', (
"The permission <em>%s</em> is invalid." % escape(permission))
@@ -268,7 +268,7 @@
# of a particular object (and its children). When a user is given
# extra roles in a particular object, an entry for that user is made
# in the __ac_local_roles__ dict containing the extra roles.
-
+
__ac_local_roles__=None
manage_listLocalRoles=DTMLFile('dtml/listLocalRoles', globals(),
@@ -384,13 +384,13 @@
if key.find('__roles__') >= 0:
_add({'name': key, 'value': value, 'class': 0})
if hasattr(value, '__roles__'):
- _add({'name': '%s.__roles__' % key, 'value': value.__roles__,
+ _add({'name': '%s.__roles__' % key, 'value': value.__roles__,
'class': 0})
for key, value in clas.items():
if key.find('__roles__') >= 0:
_add({'name': key, 'value': value, 'class' : 1})
if hasattr(value, '__roles__'):
- _add({'name': '%s.__roles__' % key, 'value': value.__roles__,
+ _add({'name': '%s.__roles__' % key, 'value': value.__roles__,
'class': 1})
return data
@@ -479,7 +479,7 @@
def _has_user_defined_role(self, role):
return role in self.__ac_roles__
-
+
# Compatibility names only!!
@@ -505,7 +505,7 @@
d=d.keys()
d.sort()
-
+
return d
@@ -562,4 +562,3 @@
seen[name]=None
gather_permissions(base, result, seen)
return result
-
=== Zope/lib/python/AccessControl/SecurityInfo.py 1.14 => 1.15 ===
--- Zope/lib/python/AccessControl/SecurityInfo.py:1.14 Mon Jul 29 09:21:29 2002
+++ Zope/lib/python/AccessControl/SecurityInfo.py Wed Aug 14 17:29:07 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""SecurityInfo objects and access control constants.
@@ -19,7 +19,7 @@
More information on using SecurityInfo and guide to Zope security
for developers can be found in the dev.zope.org "Declarative Security"
project:
-
+
http://dev.zope.org/Wikis/DevSite/Projects/DeclarativeSecurity
While SecurityInfo objects largely remove the need for Python
@@ -28,7 +28,7 @@
must set __roles__ attributes directly. (the constants are also
accessible from the AccessControl namespace). The defined access
control constants and their meanings are:
-
+
ACCESS_PUBLIC: accessible from restricted code and possibly
through the web (if object has a docstring)
@@ -58,7 +58,7 @@
"""Encapsulate security information."""
__security_info__ = 1
-
+
__roles__ = ACCESS_PRIVATE
def __init__(self):
@@ -76,7 +76,7 @@
self._warnings = 1
self.names[name] = access
- declarePublic__roles__=ACCESS_PRIVATE
+ declarePublic__roles__=ACCESS_PRIVATE
def declarePublic(self, *names):
"""Declare names to be publicly accessible."""
self._setaccess(names, ACCESS_PUBLIC)
@@ -91,7 +91,7 @@
"""Declare names to be associated with a permission."""
self._setaccess(names, permission_name)
- declareObjectPublic__roles__=ACCESS_PRIVATE
+ declareObjectPublic__roles__=ACCESS_PRIVATE
def declareObjectPublic(self):
"""Declare the object to be publicly accessible."""
self._setaccess((), ACCESS_PUBLIC)
@@ -144,7 +144,7 @@
apply__roles__ = ACCESS_PRIVATE
def apply(self, classobj):
"""Apply security information to the given class object."""
-
+
dict = classobj.__dict__
# Check the class for an existing __ac_permissions__ and
@@ -244,13 +244,13 @@
access = self.names.get(name, _marker)
if access is not _marker:
return access == ACCESS_PUBLIC
-
+
return getattr(self, 'access', 0)
apply__roles__ = ACCESS_PRIVATE
def apply(self, dict):
"""Apply security information to the given module dict."""
-
+
# Start with default attribute access policy
access = getattr(self, 'access', _marker)
if access is not _marker or len(self.names):
=== Zope/lib/python/AccessControl/SecurityManagement.py 1.6 => 1.7 ===
--- Zope/lib/python/AccessControl/SecurityManagement.py:1.6 Wed Nov 28 10:50:51 2001
+++ Zope/lib/python/AccessControl/SecurityManagement.py Wed Aug 14 17:29:07 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__doc__='''short description
@@ -26,7 +26,7 @@
thread_id,
SecurityContext(SpecialUsers.nobody))
_managers[thread_id]=manager
-
+
return manager
import SpecialUsers
@@ -49,10 +49,10 @@
def noSecurityManager():
try: del _managers[get_ident()]
except: pass
-
+
def setSecurityPolicy(aSecurityPolicy):
- """Set the system default security policy.
+ """Set the system default security policy.
This method should only be caused by system startup code. It should
never, for example, be called during a web request.
@@ -68,5 +68,3 @@
self.stack=[]
self.user=user
self.objectCache = {}
-
-
=== Zope/lib/python/AccessControl/SecurityManager.py 1.12 => 1.13 ===
--- Zope/lib/python/AccessControl/SecurityManager.py:1.12 Thu Dec 13 09:23:44 2001
+++ Zope/lib/python/AccessControl/SecurityManager.py Wed Aug 14 17:29:07 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__doc__='''short description
@@ -30,7 +30,7 @@
_defaultPolicy=ZopeSecurityPolicy.ZopeSecurityPolicy(ownerous=ownerous,
authenticated=authenticated)
def setSecurityPolicy(aSecurityPolicy):
- """Set the system default security policy.
+ """Set the system default security policy.
This method should only be caused by system startup code. It should
never, for example, be called during a web request.
=== Zope/lib/python/AccessControl/SimpleObjectPolicies.py 1.11 => 1.12 ===
--- Zope/lib/python/AccessControl/SimpleObjectPolicies.py:1.11 Tue Mar 12 14:37:14 2002
+++ Zope/lib/python/AccessControl/SimpleObjectPolicies.py Wed Aug 14 17:29:07 2002
@@ -1,19 +1,19 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__doc__='''Collect rules for access to objects that don\'t have roles.
-$Id$'''
-__version__='$Revision$'[11:-2]
+$Id$'''
+__version__='$Revision$'[11:-2]
_noroles=[] # this is imported from various places
@@ -58,4 +58,3 @@
if not (isinstance(allowed, IntType) or isinstance(allowed, DictType)):
raise ValueError, "The 'allowed' argument must be an int or dict."
ContainerAssertions[Type] = allowed
-
=== Zope/lib/python/AccessControl/SpecialUsers.py 1.3 => 1.4 ===
--- Zope/lib/python/AccessControl/SpecialUsers.py:1.3 Wed Nov 28 10:50:52 2001
+++ Zope/lib/python/AccessControl/SpecialUsers.py Wed Aug 14 17:29:07 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__doc__='''Place to find special users
=== Zope/lib/python/AccessControl/User.py 1.169 => 1.170 ===
--- Zope/lib/python/AccessControl/User.py:1.169 Wed Mar 27 16:51:01 2002
+++ Zope/lib/python/AccessControl/User.py Wed Aug 14 17:29:07 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Access control package"""
@@ -42,7 +42,7 @@
# ----------------------------
# Public User object interface
# ----------------------------
-
+
# Maybe allow access to unprotected attributes. Note that this is
# temporary to avoid exposing information but without breaking
# everyone's current code. In the future the security will be
@@ -59,7 +59,7 @@
if name in deny_names:
return 0
return 1
-
+
def __init__(self,name,password,roles,domains):
raise NotImplemented
@@ -71,7 +71,7 @@
"""Get the ID of the user. The ID can be used, at least from
Python, to get the user from the user's
UserDatabase"""
- return self.getUserName()
+ return self.getUserName()
def _getPassword(self):
"""Return the password of the user."""
@@ -117,7 +117,7 @@
# ------------------------------
# Internal User object interface
# ------------------------------
-
+
def authenticate(self, password, request):
passwrd=self._getPassword()
result = AuthEncoding.pw_validate(passwrd, password)
@@ -126,25 +126,25 @@
return result and domainSpecMatch(domains, request)
return result
-
+
def _shared_roles(self, parent):
- r=[]
- while 1:
- if hasattr(parent,'__roles__'):
- roles=parent.__roles__
- if roles is None: return 'Anonymous',
- if 'Shared' in roles:
- roles=list(roles)
- roles.remove('Shared')
- r=r+roles
- else:
- try: return r+list(roles)
- except: return r
- if hasattr(parent, 'aq_parent'):
- while hasattr(parent.aq_self,'aq_self'):
- parent=parent.aq_self
- parent=parent.aq_parent
- else: return r
+ r=[]
+ while 1:
+ if hasattr(parent,'__roles__'):
+ roles=parent.__roles__
+ if roles is None: return 'Anonymous',
+ if 'Shared' in roles:
+ roles=list(roles)
+ roles.remove('Shared')
+ r=r+roles
+ else:
+ try: return r+list(roles)
+ except: return r
+ if hasattr(parent, 'aq_parent'):
+ while hasattr(parent.aq_self,'aq_self'):
+ parent=parent.aq_self
+ parent=parent.aq_parent
+ else: return r
def _check_context(self, object):
# Check that 'object' exists in the acquisition context of
@@ -234,7 +234,7 @@
def hasRole(self, *args, **kw):
"""hasRole is an alias for 'allowed' and has been deprecated.
-
+
Code still using this method should convert to either 'has_role' or
'allowed', depending on the intended behaviour.
@@ -246,7 +246,7 @@
self.allowed(*args, **kw)
domains=[]
-
+
def has_role(self, roles, object=None):
"""Check to see if a user has a given role or roles."""
if type(roles)==type('s'):
@@ -314,7 +314,7 @@
def hasRole(self, *args, **kw):
"""hasRole is an alias for 'allowed' and has been deprecated.
-
+
Code still using this method should convert to either 'has_role' or
'allowed', depending on the intended behaviour.
@@ -366,7 +366,7 @@
def hasRole(self, *args, **kw):
"""hasRole is an alias for 'allowed' and has been deprecated.
-
+
Code still using this method should convert to either 'has_role' or
'allowed', depending on the intended behaviour.
@@ -384,7 +384,7 @@
def has_permission(self, permission, object):
return 0
-
+
def readUserAccessFile(filename):
'''Reads an access file from INSTANCE_HOME.
@@ -471,7 +471,7 @@
# ----------------------------------
# Public UserFolder object interface
# ----------------------------------
-
+
def getUserNames(self):
"""Return a list of usernames"""
raise NotImplemented
@@ -492,8 +492,8 @@
try:
return self.getUser(id)
except:
- if default is _marker: raise
- return default
+ if default is _marker: raise
+ return default
def _doAddUser(self, name, password, roles, domains, **kw):
"""Create a new user. This should be implemented by subclasses to
@@ -503,7 +503,7 @@
raise NotImplemented
def _doChangeUser(self, name, password, roles, domains, **kw):
- """Modify an existing user. This should be implemented by subclasses
+ """Modify an existing user. This should be implemented by subclasses
to make the actual changes to a user. The 'password' will be the
original input password, unencrypted. The implementation of this
method is responsible for performing any needed encryption."""
@@ -658,9 +658,9 @@
# we can't authorize the user, and we either can't authorize
# nobody against the published object or we're not top-level
return None
-
+
if _remote_user_mode:
-
+
def validate(self, request, auth='', roles=_noroles):
v = request['PUBLISHED']
a, c, n, v = self._getobcontext(v, request)
@@ -742,7 +742,7 @@
a = request['PARENTS'][-1]
if c is request_container:
c = request['PARENTS'][-1]
-
+
return a, c, n, v
def _isTop(self):
@@ -830,33 +830,33 @@
def _addUser(self,name,password,confirm,roles,domains,REQUEST=None):
if not name:
return MessageDialog(
- title ='Illegal value',
+ title ='Illegal value',
message='A username must be specified',
action ='manage_main')
if not password or not confirm:
if not domains:
return MessageDialog(
- title ='Illegal value',
+ title ='Illegal value',
message='Password and confirmation must be specified',
action ='manage_main')
if self.getUser(name) or (self._emergency_user and
name == self._emergency_user.getUserName()):
return MessageDialog(
- title ='Illegal value',
+ title ='Illegal value',
message='A user with the specified name already exists',
action ='manage_main')
if (password or confirm) and (password != confirm):
return MessageDialog(
- title ='Illegal value',
+ title ='Illegal value',
message='Password and confirmation do not match',
action ='manage_main')
-
+
if not roles: roles=[]
if not domains: domains=[]
if domains and not self.domainSpecValidate(domains):
return MessageDialog(
- title ='Illegal value',
+ title ='Illegal value',
message='Illegal domain specification',
action ='manage_main')
self._doAddUser(name, password, roles, domains)
@@ -869,23 +869,23 @@
password = confirm = None
if not name:
return MessageDialog(
- title ='Illegal value',
+ title ='Illegal value',
message='A username must be specified',
action ='manage_main')
if password == confirm == '':
if not domains:
return MessageDialog(
- title ='Illegal value',
+ title ='Illegal value',
message='Password and confirmation must be specified',
action ='manage_main')
if not self.getUser(name):
return MessageDialog(
- title ='Illegal value',
+ title ='Illegal value',
message='Unknown user',
action ='manage_main')
if (password or confirm) and (password != confirm):
return MessageDialog(
- title ='Illegal value',
+ title ='Illegal value',
message='Password and confirmation do not match',
action ='manage_main')
@@ -894,7 +894,7 @@
if domains and not self.domainSpecValidate(domains):
return MessageDialog(
- title ='Illegal value',
+ title ='Illegal value',
message='Illegal domain specification',
action ='manage_main')
self._doChangeUser(name, password, roles, domains)
@@ -903,7 +903,7 @@
def _delUsers(self,names,REQUEST=None):
if not names:
return MessageDialog(
- title ='Illegal value',
+ title ='Illegal value',
message='No users specified',
action ='manage_main')
self._doDelUsers(names)
@@ -1131,7 +1131,7 @@
_addr=addr.split('.')
_hlen=len(_host)
_alen=len(_addr)
-
+
for ob in spec:
sz=len(ob)
_ob=ob.split('.')
@@ -1139,7 +1139,7 @@
mo = addr_match(ob)
if mo is not None:
- if mo.end(0)==sz:
+ if mo.end(0)==sz:
fail=0
for i in range(_sz):
a=_addr[i]
=== Zope/lib/python/AccessControl/ZopeGuards.py 1.10 => 1.11 ===
--- Zope/lib/python/AccessControl/ZopeGuards.py:1.10 Fri Jan 11 12:14:27 2002
+++ Zope/lib/python/AccessControl/ZopeGuards.py Wed Aug 14 17:29:07 2002
@@ -1,5 +1,5 @@
#############################################################################
-#
+#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
@@ -8,7 +8,7 @@
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__version__='$Revision$'[11:-2]
=== Zope/lib/python/AccessControl/ZopeSecurityPolicy.py 1.18 => 1.19 ===
--- Zope/lib/python/AccessControl/ZopeSecurityPolicy.py:1.18 Fri Jan 11 12:14:27 2002
+++ Zope/lib/python/AccessControl/ZopeSecurityPolicy.py Wed Aug 14 17:29:07 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
__doc__='''Define Zope\'s default security policy
@@ -59,7 +59,7 @@
The default is true.
authenticated -- Allow access to resources based on the
- privaledges of the authenticated user.
+ privaledges of the authenticated user.
The argument must have a truth value.
The default is true.
@@ -70,7 +70,7 @@
clients allow only public access and other
clients allow full management.
"""
-
+
self._ownerous=ownerous
self._authenticated=authenticated
=== Zope/lib/python/AccessControl/__init__.py 1.14 => 1.15 ===
--- Zope/lib/python/AccessControl/__init__.py:1.14 Fri Jan 11 12:14:27 2002
+++ Zope/lib/python/AccessControl/__init__.py Wed Aug 14 17:29:07 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
from unauthorized import Unauthorized
=== Zope/lib/python/AccessControl/unauthorized.py 1.3 => 1.4 ===
--- Zope/lib/python/AccessControl/unauthorized.py:1.3 Wed Nov 28 10:50:52 2001
+++ Zope/lib/python/AccessControl/unauthorized.py Wed Aug 14 17:29:07 2002
@@ -1,14 +1,14 @@
##############################################################################
#
# Copyright (c) 2001 Zope Corporation and Contributors. All Rights Reserved.
-#
+#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
-#
+#
##############################################################################
"""Access control exceptions
"""
@@ -16,7 +16,7 @@
import zExceptions
class Unauthorized(zExceptions.Unauthorized):
-
+
def getValueName(self):
v=self.value
n=getattr(v, 'getId', v)
@@ -31,4 +31,3 @@
c = getattr(v, '__class__', type(v))
c = getattr(c, '__name__', 'object')
return "a particular %s" % c
-