Changeset 6162
- Timestamp:
- 20 May 2011, 11:02:42 (14 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/permissions.py
r6160 r6162 109 109 110 110 Objects that want to offer certain local roles, can do so by 111 setting a (preferably class-) attribute to a list of dictionaries.111 setting a (preferably class-) attribute to a list of role ids. 112 112 113 113 You can also define different adapters for different contexts to … … 122 122 def __init__(self, context): 123 123 self.context = context 124 self._roles = getattr(context, 'local_roles', self._roles) 124 role_ids = getattr(context, 'local_roles', self._roles) 125 self._roles = [(name, role) for name, role in getRoles() 126 if name in role_ids] 125 127 return 126 128 … … 130 132 to assign each role to). 131 133 """ 132 list_of_dict = [dict(name=x, title=self._roles[x]) for x in self._roles.keys()] 133 return list_of_dict 134 return [ 135 dict( 136 name=name, 137 title=role.title, 138 description =role.description) 139 for name, role in self._roles] 134 140 135 141 def roles(self): 136 142 """Return a list of roles assignable to the context object. 137 143 """ 138 return self._roles.keys()144 return [name for name, role in self._roles] -
main/waeup.sirp/trunk/src/waeup/sirp/university/department.py
r6160 r6162 15 15 @property # Make this method read_only and looking like an attr. 16 16 def local_roles(cls): 17 return { 18 'waeup.local.DepartmentOfficer':'Department Officer', 19 } 17 return ['waeup.local.DepartmentOfficer'] 20 18 21 19 # A simple counter for ids. -
main/waeup.sirp/trunk/src/waeup/sirp/university/faculty.py
r6160 r6162 16 16 @property # Make this method read_only and looking like an attr. 17 17 def local_roles(cls): 18 return { 19 'waeup.local.DepartmentOfficer':'Department Officer', 20 } 18 return ['waeup.local.DepartmentOfficer'] 21 19 22 20 def __init__(self,
Note: See TracChangeset for help on using the changeset viewer.