Changeset 7173 for main/waeup.sirp
- Timestamp:
- 22 Nov 2011, 20:27:49 (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
r7172 r7173 216 216 def handle_account_added(account, event): 217 217 """When an account is added, the local owner role and the global 218 PortalUser role must be set.219 """ 220 # First we have to set the local owner role of the account object221 role_manager = IPrincipalRoleManager(account)222 role_manager .assignRoleToPrincipal(218 PortalUser role must be set. 219 """ 220 # We set the local Owner role 221 role_manager_account = IPrincipalRoleManager(account) 222 role_manager_account.assignRoleToPrincipal( 223 223 'waeup.local.Owner', account.name) 224 # Then we have to notify the user account that the local role 224 # We set the global PortalUser role 225 site = grok.getSite() 226 role_manager_site = IPrincipalRoleManager(site) 227 role_manager_site.assignRoleToPrincipal( 228 'waeup.PortalUser', account.name) 229 # Finally we have to notify the user account that the local role 225 230 # of the same object has changed 226 231 notify(LocalRoleSetEvent( -
main/waeup.sirp/trunk/src/waeup/sirp/authentication.txt
r7172 r7173 40 40 >>> root['app']['users'].addAccount(alice) 41 41 42 See ``users .txt`` for details about the UsersContainer we use here.42 See ``userscontainer.txt`` for details about the UsersContainer we use here. 43 43 44 44 Users and local roles … … 46 46 47 47 Accounts also hold infos about local roles assigned to a user. In the 48 beginning, users have onlythe local owner role of their own account object:48 beginning, users have the local owner role of their own account object: 49 49 50 50 >>> alice.getLocalRoles() 51 51 {'waeup.local.Owner': [<waeup.sirp.authentication.Account object at 0x...>]} 52 53 Users have also got the global PortalUser role: 54 55 >>> alice.getRoles() 56 ['waeup.PortalUser'] 52 57 53 58 We can tell an account, that Alice got some role for another object:
Note: See TracChangeset for help on using the changeset viewer.