[Zope-CVS] CVS: Products/Ape/lib/apelib/zope2 - security.py:1.7
Shane Hathaway
shane at zope.com
Thu Jul 22 01:55:12 EDT 2004
Update of /cvs-repository/Products/Ape/lib/apelib/zope2
In directory cvs.zope.org:/tmp/cvs-serv30542/lib/apelib/zope2
Modified Files:
security.py
Log Message:
Fixed compatibility with the GroupUserFolder product used by Plone.
GroupUserFolder plays games with an __ac_roles__ class attribute.
The workaround is to only serialize instance attributes.
=== Products/Ape/lib/apelib/zope2/security.py 1.6 => 1.7 ===
--- Products/Ape/lib/apelib/zope2/security.py:1.6 Sat Mar 20 01:34:25 2004
+++ Products/Ape/lib/apelib/zope2/security.py Thu Jul 22 01:55:12 2004
@@ -87,8 +87,10 @@
def serialize(self, event):
res = []
- obj = event.obj
- eo = getattr(obj, '_owner', None)
+ # Get security attributes from the instance only, not the class.
+ # There's no need to serialize the class attributes.
+ obj_d = event.obj.__dict__
+ eo = obj_d.get('_owner')
if eo is not None:
event.ignore('_owner')
path, username = eo
@@ -97,28 +99,28 @@
s = '%s/%s' % ('/'.join(path), username)
res.append(('executable-owner', '', '', s))
- roles = getattr(obj, '__ac_roles__', None)
+ roles = obj_d.get('__ac_roles__')
if roles is not None:
event.ignore('__ac_roles__')
for role in roles:
if not STANDARD_ROLES.has_key(role):
res.append(('define-role', role, '', ''))
- local_roles = getattr(obj, '__ac_local_roles__', None)
+ local_roles = obj_d.get('__ac_local_roles__')
if local_roles is not None:
event.ignore('__ac_local_roles__')
for username, roles in local_roles.items():
for role in roles:
res.append(('local-role', role, '', username))
- proxy_roles = getattr(obj, '_proxy_roles', None)
+ proxy_roles = obj_d.get('_proxy_roles')
if proxy_roles is not None:
event.ignore('_proxy_roles')
for role in proxy_roles:
res.append(('proxy-role', role, '', ''))
p_dict = None
- for attr, value in obj.__dict__.items():
+ for attr, value in obj_d.items():
if attr.endswith('_Permission') and attr.startswith('_'):
if p_dict is None:
p_dict = get_permission_dict()
More information about the Zope-CVS
mailing list