[Zope3-Users] Assigning programmatically a Role to a Principal
paftek
paftek at gmail.com
Tue May 12 05:59:18 EDT 2009
Hi,
I created a Role and a Permission affected to it :
<role id="app.User" title="Utilisateur" />
<permission id="app.Auth" title="Utilisateur authentifié" />
<grant permission="app.Auth" role="app.User" />
My users are store in a PostgreSQL database, not in the ZODB.
I use the Zope authentication system to return a PrincipalInfo when an
user log in.
I do not know how to assign my "app.User" Role to the Principal who log in.
I tried the following, without success :
@adapter(IAuthenticatedPrincipalCreated)
def setPermission(event):
role_map = IPrincipalRoleManager(getSiteManager())
role_map.assignRoleToPrincipal('app.User', event.principal.id)
Thanks for any kind of help !
More information about the Zope3-users
mailing list