Changeset 6203 for main/waeup.sirp/trunk
- Timestamp:
- 27 May 2011, 02:05:02 (13 years ago)
- Location:
- main/waeup.sirp/trunk/src/waeup/sirp
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/authentication.py
r6182 r6203 174 174 site = grok.getSite() 175 175 return site['users'] 176 177 @grok.subscribe(IUserAccount, grok.IObjectRemovedEvent) 178 def handle_account_removal(account, event): 179 """When an account is removed, local roles might have to be deleted. 180 """ 181 local_roles = account.getLocalRoles() 182 principal = account.name 183 for role_id, object_list in local_roles.items(): 184 for object in object_list: 185 try: 186 role_manager = IPrincipalRoleManager(object) 187 except TypeError: 188 # No role manager, no roles to remove 189 continue 190 role_manager.unsetRoleForPrincipal(role_id, principal) 191 return -
main/waeup.sirp/trunk/src/waeup/sirp/authentication.txt
r6202 r6203 120 120 True 121 121 122 When an account get deleted, also the local roles of the owner get 123 removed. Let's setup a local role for `alice`: 124 125 >>> faculty = Faculty() 126 >>> root['app']['alice_fac'] = faculty 127 >>> role_manager = IPrincipalRoleManager(faculty) 128 >>> role_manager.assignRoleToPrincipal( 129 ... 'waeup.PortalManager', 'alice') 130 >>> notify(LocalRoleSetEvent(faculty, 'waeup.PortalManager', 'alice', 131 ... granted=True)) 132 133 The local role is set now: 134 135 >>> from zope.securitypolicy.interfaces import IPrincipalRoleMap 136 >>> IPrincipalRoleMap(faculty).getPrincipalsAndRoles() 137 [('waeup.PortalManager', 'alice', PermissionSetting: Allow)] 138 139 But when we delete Alices account from ZODB: 140 141 >>> del root['app']['users']['alice'] 142 >>> IPrincipalRoleMap(faculty).getPrincipalsAndRoles() 143 [] 144 145 the local role has gone. 146 147 122 148 Logging in via side bar 123 149 =======================
Note: See TracChangeset for help on using the changeset viewer.