[Grok-dev] How to assign roles to test user?

Christian Klinger cklinger at novareto.de
Mon Jan 23 10:39:55 UTC 2012


Hi Noe,

it depends you can assign Roles global in your ftesting.zcml for 
example. If you want assign Roles in a test itself you can do something
like this.

prm = IPrincipalRoleManager(YOUR_SITE OR YOUR_CONTEXT)
prm.assignRoleToPrincipal('YOUR_ROLE', principal.id)

HTH
Christian

Noe Nieto schrieb:
> I'm doing some tests which requires permissions.
>
> How do I assign permissions to a user in a test?
>
>
>
> --
> ---
> Noe Nieto
> NNieto Consulting Services
> M: nnieto at noenieto.com <mailto:nnieto at noenieto.com>
> W: http://noenieto.com
> T: @tzicatl <https://twitter.com/#%21/tzicatl>
> Li: Perfil en LinkedIn <http://www.linkedin.com/profile/view?id=84300665>
>
> _______________________________________________
> Grok-dev mailing list
> Grok-dev at zope.org
> https://mail.zope.org/mailman/listinfo/grok-dev



More information about the Grok-dev mailing list