Changeset 4124 for waeup/branches
- Timestamp:
- 10 May 2009, 14:53:46 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
waeup/branches/ulif-rewrite/src/waeup/permissions.py
r4069 r4124 1 1 import grok 2 from zc.sourcefactory.basic import BasicSourceFactory 2 3 3 4 class ManageUniversity(grok.Permission): … … 10 11 grok.name('waeup.facultyread') 11 12 13 class PortalUser(grok.Role): 14 grok.name('waeup.PortalUser') 15 grok.permissions('waeup.facultyread') 16 17 class PortalManager(grok.Role): 18 grok.name('waeup.PortalManager') 19 grok.permissions('waeup.manageUniversity', 'waeup.manageUsers') 20 21 def getRoles(): 22 app = grok.getSite() 23 app = None 24 manager = None 25 if app is not None: 26 from zope.securitypolicy.interfaces import IRolePermissionManager 27 manager = IRolePermissionManager(app, None) 28 else: 29 from zope.securitypolicy.rolepermission import ( 30 rolePermissionManager as manager) 31 role_permission_map = manager.getRolesAndPermissions() 32 result = dict() 33 for item in role_permission_map: 34 if not item[1].startswith('waeup.'): 35 # Ignore non-WAeUP roles... 36 continue 37 result[item[1]] = True 38 return sorted(result.keys()) 39 40 class RoleSource(BasicSourceFactory): 41 def getValues(self): 42 return getRoles() 43 def getTitle(self, value): 44 if isinstance(value, basestring): 45 return value.split('.', 2)[1]
Note: See TracChangeset for help on using the changeset viewer.