[Setup] how to test if user is administrator (was: short question)

Rene Pijlman rene at lab.applinet.nl
Thu Aug 3 17:03:49 UTC 2006


Flávio Romão:
>i'm developing a web portal with portal and i would like to know if there is
>a function similar to 'isAnon' (that returns true if the user is anonymus),
>but that returns true is the user is a portal administrator. thanks!

The idiom is:

    member.has_role('Manager')

'member' is defined in
./CMFPlone/skins/plone_templates/global_defines.pt

This checks for the role, not group membership (but normally
your administrator group has the manager role).

You should ask yourself why you're checking for the role, rather
than a particular permission for the acion you're guarding.

Please use a real subject next time.

-- 
Rene Pijlman
http://www.applinet.nl/
  




More information about the Setup mailing list