[Zope-CMF] A role to assign local roles.

Luca Olivetti luca@wetron.es
Tue, 26 Mar 2002 16:54:58 +0100


Tres Seaver wrote:

>   - Add a check to the customized version which asserts that the
>     user has one of the roles you prefer, e.g.::
> 
>       member = context.portal_membership.getAuthenticatedMember()
>       if not member.allowed( [ 'Manager', 'Human Resources' ] ):
>           raise Unauthorized


that should be

member.allowed( context, ['Manager', 'Human Resources' ] )
(otherwise, as I've learned, it gives access to any user)

or

member.has_role( ['Manager', 'Human Resources'], context )

Bye
-- 
Luca Olivetti
Wetron Automatización S.A. http://www.wetron.es/
Tel. +34 93 5883004      Fax +34 93 5883007