Commit fbe06467 authored by Shane Hathaway's avatar Shane Hathaway

Corrected local roles computation (Hotfix 2000-12-15)

parent db311894
...@@ -37,6 +37,8 @@ Zope changes ...@@ -37,6 +37,8 @@ Zope changes
won't work. This was reported by Steve Alexander with a won't work. This was reported by Steve Alexander with a
patch. patch.
- Corrected local role computation (Hotfix 2000-12-15)
Zope 2.3.0 alpha 1 Zope 2.3.0 alpha 1
Features Added Features Added
......
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
############################################################################## ##############################################################################
"""Access control package""" """Access control package"""
__version__='$Revision: 1.118 $'[11:-2] __version__='$Revision: 1.119 $'[11:-2]
import Globals, socket, ts_regex, SpecialUsers import Globals, socket, ts_regex, SpecialUsers
import os import os
...@@ -158,15 +158,17 @@ class BasicUser(Implicit): ...@@ -158,15 +158,17 @@ class BasicUser(Implicit):
local={} local={}
object=getattr(object, 'aq_inner', object) object=getattr(object, 'aq_inner', object)
while 1: while 1:
if hasattr(object, '__ac_local_roles__'): local_roles = getattr(object, '__ac_local_roles__', None)
local_roles=object.__ac_local_roles__ if local_roles:
if callable(local_roles): if callable(local_roles):
local_roles=local_roles() local_roles=local_roles()
dict=local_roles or {} dict=local_roles or {}
for r in dict.get(name, []): for r in dict.get(name, []):
local[r]=1 local[r]=1
if hasattr(object, 'aq_parent'): inner = getattr(object, 'aq_inner', object)
object=object.aq_parent parent = getattr(inner, 'aq_parent', None)
if parent:
object = parent
continue continue
if hasattr(object, 'im_self'): if hasattr(object, 'im_self'):
object=object.im_self object=object.im_self
...@@ -176,7 +178,6 @@ class BasicUser(Implicit): ...@@ -176,7 +178,6 @@ class BasicUser(Implicit):
roles=list(roles) + local.keys() roles=list(roles) + local.keys()
return roles return roles
def getDomains(self): def getDomains(self):
"""Return the list of domain restrictions for a user""" """Return the list of domain restrictions for a user"""
raise NotImplemented raise NotImplemented
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment