Changeset 6163 for main/waeup.sirp/trunk/src/waeup/sirp/permissions.py
- Timestamp:
- 20 May 2011, 12:01:50 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/permissions.py
r6162 r6163 2 2 from zope.component import getUtilitiesFor 3 3 from zope.interface import Interface 4 from zope.securitypolicy.interfaces import IRole 4 from zope.securitypolicy.interfaces import IRole, IPrincipalRoleMap 5 5 from waeup.sirp.interfaces import ILocalRolesAssignable 6 6 … … 136 136 name=name, 137 137 title=role.title, 138 description 138 description=role.description) 139 139 for name, role in self._roles] 140 140 … … 143 143 """ 144 144 return [name for name, role in self._roles] 145 146 def get_users_with_local_roles(context): 147 """Get a list of dicts representing the local roles set for `context`. 148 149 Each dict returns `user_name`, `user_title`, `local_role`, 150 `local_role_title`, and `setting` for each entry in the local 151 roles map of the `context` object. 152 """ 153 role_map = IPrincipalRoleMap(context) 154 for local_role, user_name, setting in role_map.getPrincipalsAndRoles(): 155 user = grok.getSite()['users'].get(user_name,None) 156 user_title = getattr(user, 'description', user_name) 157 local_role_title = getRoles()[local_role].title 158 yield dict(user_name = user_name, 159 user_title = user_title, 160 local_role = local_role, 161 local_role_title = local_role_title, 162 setting = setting)
Note: See TracChangeset for help on using the changeset viewer.