Commit 29c8c57c authored by Andreas Jung's avatar Andreas Jung

- AccessControl/permission_settings() now has a new optional parameter

       'permission' to retrieve the permission settings for a particular
       permission.
parent 78163dca
...@@ -24,6 +24,10 @@ Zope Changes ...@@ -24,6 +24,10 @@ Zope Changes
Features added Features added
- AccessControl/permission_settings() now has a new optional parameter
'permission' to retrieve the permission settings for a particular
permission.
- The obsolete 'SearchIndex' package has been removed - The obsolete 'SearchIndex' package has been removed
- Traversal now supports a "post traversal hook" that get's run - Traversal now supports a "post traversal hook" that get's run
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
############################################################################## ##############################################################################
"""Access control support""" """Access control support"""
__version__='$Revision: 1.60 $'[11:-2] __version__='$Revision: 1.61 $'[11:-2]
from Globals import DTMLFile, MessageDialog, Dictionary from Globals import DTMLFile, MessageDialog, Dictionary
...@@ -90,14 +90,22 @@ class RoleManager(ExtensionClass.Base, PermissionMapping.RoleManager): ...@@ -90,14 +90,22 @@ class RoleManager(ExtensionClass.Base, PermissionMapping.RoleManager):
return tuple(r) return tuple(r)
def permission_settings(self): def permission_settings(self, permission=None):
"""Return user-role permission settings """Return user-role permission settings. If 'permission'
is passed to the method then only the settings for 'permission'
is returned.
""" """
result=[] result=[]
valid=self.valid_roles() valid=self.valid_roles()
indexes=range(len(valid)) indexes=range(len(valid))
ip=0 ip=0
for p in self.ac_inherited_permissions(1):
permissions = self.ac_inherited_permissions(1)
# Filter permissions
if permission:
permissions = [p for p in permissions if p[0] == permission]
for p in permissions:
name, value = p[:2] name, value = p[:2]
p=Permission(name,value,self) p=Permission(name,value,self)
roles=p.getRoles(default=[]) roles=p.getRoles(default=[])
......
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