[Grok-dev] Small problem removing roles from principals
Sebastian Ware
sebastian at urbantalk.se
Wed Sep 19 07:24:24 EDT 2007
After further examination, the problem probably doesn't reside in the
removing of the role, but rather that the changed permissions isn't
recognised. I need to dig a bit further.
Mvh Sebastian
19 sep 2007 kl. 11.44 skrev Sebastian Ware:
> I am having problems removing roles from principals. I am using the
> following code to "refresh" the roles assigned to a principal:
>
> def touch_user_roles(user):
> pau = getUtility(IAuthentication)
> principals = pau['principals']
> role_manager = IPrincipalRoleManager(user)
> role_manager.removeRoleFromPrincipal('prestatics.editor',
> principals.prefix +
> user.__name__)
> role_manager.removeRoleFromPrincipal('prestatics.manager',
> principals.prefix +
> user.__name__)
> if IWorkflowState(user).getState() == interfaces.PUBLISHED:
> if user.role == 'Manager':
> role_manager.assignRoleToPrincipal('prestatics.manager',
> principals.prefix
> + user.__name__)
> elif user.role == 'Editor':
> role_manager.assignRoleToPrincipal('prestatics.editor',
> principals.prefix
> + user.__name__)
>
> If I remove calls to "removeRoleFromPrincipal" I can add roles
> without any problems. What am I doing wrong with the call to
> "removeRoleFromPrincipal"?
>
> Mvh Sebastian
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> http://mail.zope.org/mailman/listinfo/grok-dev
More information about the Grok-dev
mailing list