Commit 5ec51bc1 authored by Hanno Schlichting's avatar Hanno Schlichting

Stop using the Products packages as a data container for __ac_permissions__

parent 531882a5
...@@ -25,10 +25,6 @@ AccessControl ...@@ -25,10 +25,6 @@ AccessControl
* OFS - as a base class for User.BaseUserFolder * OFS - as a base class for User.BaseUserFolder
* Products (in registerPermissions using it as a data container for
``__ac_permissions__``) - this should use a global inside the module
inside AccessControl.
* App (MessageDialog, DTMLFile, ...) - all need to go - redoing the UI is * App (MessageDialog, DTMLFile, ...) - all need to go - redoing the UI is
hard. We probably need to move it into some other core part of Zope2, like hard. We probably need to move it into some other core part of Zope2, like
the App package, which could serve as a general dumping ground for ZMI the App package, which could serve as a general dumping ground for ZMI
......
...@@ -139,11 +139,11 @@ class Permission: ...@@ -139,11 +139,11 @@ class Permission:
_registeredPermissions = {} _registeredPermissions = {}
_ac_permissions = ()
def getPermissions(): def getPermissions():
import Products return _ac_permissions
return getattr(Products, '__ac_permissions__', ())
def addPermission(perm, default_roles=('Manager', )): def addPermission(perm, default_roles=('Manager', )):
...@@ -151,9 +151,8 @@ def addPermission(perm, default_roles=('Manager', )): ...@@ -151,9 +151,8 @@ def addPermission(perm, default_roles=('Manager', )):
return return
entry = ((perm, (), default_roles), ) entry = ((perm, (), default_roles), )
import Products global _ac_permissions
Products_permissions = getPermissions() _ac_permissions = _ac_permissions + entry
Products.__ac_permissions__ = Products_permissions + entry
_registeredPermissions[perm] = 1 _registeredPermissions[perm] = 1
mangled = pname(perm) # get mangled permission name mangled = pname(perm) # get mangled permission name
if not hasattr(ApplicationDefaultPermissions, mangled): if not hasattr(ApplicationDefaultPermissions, mangled):
......
...@@ -600,7 +600,6 @@ class RoleManager(Base, RoleManager): ...@@ -600,7 +600,6 @@ class RoleManager(Base, RoleManager):
smallRolesWidget=selectedRoles=aclAChecked=aclPChecked=aclEChecked='' smallRolesWidget=selectedRoles=aclAChecked=aclPChecked=aclEChecked=''
validRoles=valid_roles validRoles=valid_roles
#manage_rolesForm=manage_access
def manage_editRoles(self, REQUEST, acl_type='A', acl_roles=[]): def manage_editRoles(self, REQUEST, acl_type='A', acl_roles=[]):
pass pass
...@@ -609,16 +608,15 @@ class RoleManager(Base, RoleManager): ...@@ -609,16 +608,15 @@ class RoleManager(Base, RoleManager):
pass pass
def possible_permissions(self): def possible_permissions(self):
d={} d = {}
Products_permissions = getPermissions() permissions = getPermissions()
for p in Products_permissions: for p in permissions:
d[p[0]]=1 d[p[0]] = 1
for p in self.ac_inherited_permissions(1): for p in self.ac_inherited_permissions(1):
d[p[0]]=1 d[p[0]] = 1
d=d.keys() d = d.keys()
d.sort() d.sort()
return d return d
InitializeClass(RoleManager) InitializeClass(RoleManager)
......
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