[Zope-Checkins] CVS: Products/PythonScripts - PythonScript.py:1.36
Evan Simpson
evan@zope.com
Mon, 8 Oct 2001 10:45:51 -0400
Update of /cvs-repository/Products/PythonScripts
In directory cvs.zope.org:/tmp/cvs-serv23612
Modified Files:
PythonScript.py
Log Message:
Use allowed() instead of deprecated hasRole(), and enable proxy roles
by passing self in.
=== Products/PythonScripts/PythonScript.py 1.35 => 1.36 ===
def _validateProxy(self, roles=None):
- if roles is None: roles=self._proxy_roles
+ if roles is None: roles = self._proxy_roles
if not roles: return
- user=u=getSecurityManager().getUser()
- if user is not None:
- user=user.hasRole
- for r in roles:
- if r and not user(None, (r,)):
- user=None
- break
- if user is not None: return
-
+ user = getSecurityManager().getUser()
+ if user is not None and user.allowed(self, roles):
+ return
raise 'Forbidden', ('You are not authorized to change <em>%s</em> '
'because you do not have proxy roles.\n<!--%s, %s-->'
- % (self.id, u, roles))
+ % (self.id, user, roles))
security.declareProtected('Change proxy roles',
'manage_proxyForm', 'manage_proxy')