[Zope-Checkins] CVS: Zope/lib/python/AccessControl - Role.py:1.61
Andreas Jung
andreas at andreas-jung.com
Mon May 3 05:35:54 EDT 2004
Update of /cvs-repository/Zope/lib/python/AccessControl
In directory cvs.zope.org:/tmp/cvs-serv6800/lib/python/AccessControl
Modified Files:
Role.py
Log Message:
- AccessControl/permission_settings() now has a new optional parameter
'permission' to retrieve the permission settings for a particular
permission.
=== Zope/lib/python/AccessControl/Role.py 1.60 => 1.61 ===
--- Zope/lib/python/AccessControl/Role.py:1.60 Mon Apr 26 04:42:54 2004
+++ Zope/lib/python/AccessControl/Role.py Mon May 3 05:35:53 2004
@@ -90,14 +90,22 @@
return tuple(r)
- def permission_settings(self):
- """Return user-role permission settings
+ def permission_settings(self, permission=None):
+ """Return user-role permission settings. If 'permission'
+ is passed to the method then only the settings for 'permission'
+ is returned.
"""
result=[]
valid=self.valid_roles()
indexes=range(len(valid))
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]
p=Permission(name,value,self)
roles=p.getRoles(default=[])
More information about the Zope-Checkins
mailing list