[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/Security/Grants - PermissionRoles.py:1.3 RolePermissions.py:1.2
Florent Guillaume
fg@nuxeo.com
Tue, 25 Jun 2002 06:56:51 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/Security/Grants
In directory cvs.zope.org:/tmp/cvs-serv26109
Modified Files:
PermissionRoles.py RolePermissions.py
Log Message:
Forgot to checkin one file.
Remove unused function.
=== Zope3/lib/python/Zope/App/Security/Grants/PermissionRoles.py 1.2 => 1.3 ===
return [settings.get(role.getId(), nosetting) for role in self._roles]
- def rolesInfo(self):
- prm = getAdapter(self._context, IRolePermissionManager)
- proles = prm.getRolesForPermission(self._permission.getId())
- proles = [role for role,setting in proles if setting==Allow]
- return [{'id': role.getId(),
- 'title': role.getTitle(),
- 'checked': ((role.getId() in proles) and '1' or None)}
- for role in self._roles]
=== Zope3/lib/python/Zope/App/Security/Grants/RolePermissions.py 1.1 => 1.2 ===
from Zope.App.Security.IRolePermissionManager import IRolePermissionManager
from Zope.App.Security.IRole import IRole
-from Zope.App.Security.Settings import Allow
+from Zope.App.Security.Settings import Unset
class RolePermissions:
@@ -42,12 +42,11 @@
def permissionsInfo(self):
prm = getAdapter(self._context, IRolePermissionManager)
rperms = prm.getPermissionsForRole(self._role.getId())
- rperms = [permission
- for permission,setting in rperms
- if setting==Allow]
+ settings = {}
+ for permission, setting in rperms:
+ settings[permission] = setting.getName()
+ nosetting = Unset.getName()
return [{'id': permission.getId(),
'title': permission.getTitle(),
- 'checked': ((permission.getId() in rperms) and '1' or None)}
- for permission in self._permissions]
-
-
+ 'setting': settings.get(permission.getId(), nosetting)}
+ for permission in self._permissions]