[Zope] How to test for a user having a permission?

Hamish Lawson hamish_lawson@yahoo.co.uk
Wed, 14 Mar 2001 15:44:48 +0000 (GMT)


I know I can map methods to permissions and so have the Zope machinery
take care of testing whether the user has permission to call a method,
but say I want to decide whether to display an 'Edit' button on the
page depending on whether the user has the appropriate permission for
editing. How do I test for the user having this permission - is there
some kind of hasPermission() method I can use? I could make an
assumption about which roles have which permissions and call hasRole(),
but that doesn't seem right to me* - I don't think my code should care
about what roles the user has, only whether they have the required
permission.

Hamish Lawson

*  The subject of another post of mine ;-)


=====
Hamish Lawson  hamish_lawson@yahoo.co.uk

____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie