[Zope3-Users] Re: How to assign a role or permission to users programatically?

Christian Klinger cklinger at novareto.de
Tue Sep 4 02:53:43 EDT 2007


Hi Yuan,

iirc you can subscribe to the

zope.app.authentication.interfaces.IAuthenticatedPrincipalCreated

event.

In your event you can do something like this:

def authenticated_principal_created(event):
     principal = event.principal
     principal.groups.append('zope.Manager')

hth

Christian



> Dear list,
> 
> I have written a custom authenticator plugin to authenticate users
> against a Postgres database. The question is, once a user is
> authenticated, what role or permission does she/he get?
> 
> If I would like to give the permission 'site.MemberPermission' to all
> users when they log in. I don't want to store the permission a a
> persistent folder like object, but just assign them on the fly when
> the log in.
> 
> what shall I do?
> 
> Thanks for helping.
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Zope3-users mailing list
> Zope3-users at zope.org
> http://mail.zope.org/mailman/listinfo/zope3-users



More information about the Zope3-users mailing list