RE: [Zope3-Users] assigning roles to principals onAuthenticatedPrincipalCreated event

2006-09-20 Thread Mats Nordgren
As I understand a principal is created and destroyed with each request. This would make your application set the permission at each request which might not be exactly what you had in mind. I use a group folder from pau and set the group with a subscriber when the site object is created. def Sit

Re: [Zope3-Users] Assigning roles to principals

2006-06-14 Thread Frank Burkhardt
Hi, On Wed, Jun 14, 2006 at 09:35:47AM -0500, mats.nordgren wrote: > Frank, > > Try this: > > role_map = IPrincipalRoleManager(context) <== For example root of site. > role_map.assignRoleToPrincipal(u'mpgsite.Authenticated', principal_id) Thank you - It's working :-) Regards, Frank __

Re: [Zope3-Users] Assigning roles to principals

2006-06-14 Thread mats.nordgren
Marco, You need to pass the id not the principal object. principalRoleManager.getRolesForPrincipal(self.request.principal.id) Cheers, Mats On Wed, 14 Jun 2006 20:00:40 +0200, Marco Mariani wrote > How do I get the list of roles for the current principal? > > I've tried > > from zope.app.secu

Re: [Zope3-Users] Assigning roles to principals

2006-06-14 Thread Marco Mariani
How do I get the list of roles for the current principal? I've tried from zope.app.securitypolicy.principalrole import principalRoleManager principalRoleManager.getRolesForPrincipal(self.request.principal) and the list is empty I'm currently defining principals in principals.zcml tnx __

Re: [Zope3-Users] Assigning roles to principals

2006-06-14 Thread mats.nordgren
Frank, Try this: role_map = IPrincipalRoleManager(context) <== For example root of site. role_map.assignRoleToPrincipal(u'mpgsite.Authenticated', principal_id) I use the above code in an event handler when a site has been created. Instead of specifying the user I specify a group and then add ea