Changeset 6202 for main/waeup.sirp/trunk/src/waeup
- Timestamp:
- 26 May 2011, 23:34:04 (14 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/authentication.txt
r6180 r6202 111 111 {} 112 112 113 If one notifies the machinery of a local role removal for an object 114 that cannot have local roles, this will cause no trouble: 115 116 >>> mycontext = None #object() 117 >>> notify(LocalRoleSetEvent( 118 ... mycontext, 'waeup.PortalManager', 'bob', granted=False 119 ... )) is None 120 True 121 113 122 Logging in via side bar 114 123 ======================= -
main/waeup.sirp/trunk/src/waeup/sirp/permissions.py
r6198 r6202 147 147 roles map of the `context` object. 148 148 """ 149 role_map = IPrincipalRoleMap(context) 149 try: 150 role_map = IPrincipalRoleMap(context) 151 except TypeError: 152 # no map no roles. 153 raise StopIteration 150 154 for local_role, user_name, setting in role_map.getPrincipalsAndRoles(): 151 155 user = grok.getSite()['users'].get(user_name,None) -
main/waeup.sirp/trunk/src/waeup/sirp/permissions.txt
r6198 r6202 54 54 >>> list(getWAeUPRoleNames()) 55 55 [u'waeup.ApplicationsOfficer', u'waeup.PortalManager', u'waeup.PortalUser'] 56 57 :func:`get_users_with_local_roles` 58 ---------------------------------- 59 60 We can get all users and their roles for a certain context 61 object. This even works for objects that cannot have local roles as 62 they are not stored in the ZODB: 63 64 >>> from waeup.sirp.permissions import get_users_with_local_roles 65 >>> mycontext = object() 66 >>> people_and_roles = get_users_with_local_roles(mycontext) 67 >>> people_and_roles 68 <generator object at 0x...> 69 70 In this case, the result is empty: 71 72 >>> people_and_roles = list(people_and_roles) 73 >>> people_and_roles 74 [] -
main/waeup.sirp/trunk/src/waeup/sirp/users.py
r6180 r6202 63 63 @grok.subscribe(Interface, grok.IObjectRemovedEvent) 64 64 def handle_local_roles_on_obj_removal(obj, event): 65 role_map = IPrincipalRoleMap(obj) 65 try: 66 role_map = IPrincipalRoleMap(obj) 67 except TypeError: 68 # no map, no roles to remove 69 return 66 70 for local_role, user_name, setting in role_map.getPrincipalsAndRoles(): 67 71 notify(LocalRoleSetEvent(
Note: See TracChangeset for help on using the changeset viewer.