Commit d1a9c53b authored by 's avatar

Added SecurityInfo handling to class initializer

parent 642f5418
......@@ -95,7 +95,8 @@ def default__class_init__(self):
dict=self.__dict__
have=dict.has_key
ft=type(default__class_init__)
for name, v in dict.items():
dict_items=dict.items()
for name, v in dict_items:
if hasattr(v,'_need__name__') and v._need__name__:
v.__dict__['__name__']=name
if name=='manage' or name[:7]=='manage_':
......@@ -105,6 +106,17 @@ def default__class_init__(self):
name=name+'__roles__'
if not have(name): dict[name]='Manager',
# Look for a SecurityInfo object on the class. If found, call its
# apply() method to generate __ac_permissions__ for the class. We
# delete the SecurityInfo from the class dict after it has been
# applied out of paranoia.
for key, value in dict_items:
if hasattr(value, '__security_info__'):
security_info=value
security_info.apply(self)
del dict[key]
break
if self.__dict__.has_key('__ac_permissions__'):
AccessControl.Permission.registerPermissions(self.__ac_permissions__)
for acp in self.__ac_permissions__:
......
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