Howto use has_permission (was RE: [Zope] How to test for a user
having a permission?)
Tim Cook
tim@freepm.org
Fri, 16 Mar 2001 09:17:23 -0600
"Mayers, Philip J" wrote:
>
> Maybe I'm being dumb, but this doesn't work for me:
>
> This doesn't work at all: <dtml-if
> "AUTHENTICATED_USER.has_permission('View',subfolder)">
> <dtml-if
> "AUTHENTICATED_USER.has_permission('Access contents
> information',subfolder)">
>
> This always returns false: <dtml-if
> "AUTHENTICATED_USER.has_permission('View','subfolder')">
> <dtml-if
> "AUTHENTICATED_USER.has_permission('Access contents
> information','subfolder')">
>
> How do I use this?
I'll venture a guess that you are wanting to test a level below
where you are actually attempting to use this method?
It works (for me) by calling it from with the document/folder
that I want to check the permission on.
I use a method let's call it can_edit. It could be located in the
root. It contains the code I posted before.
Wherever I want to put the Edit link on the page I call that
method <dtml-var can_edit>. It operates in the context of the
calling document/folder because of the PARENTS[0]. I'm not sure
you can make it work on an object that is not in the aquisition
path?
HTH,
--
Tim Cook, President - FreePM,Inc.
http://www.FreePM.com Office: (901) 884-4126
ONLINE DEMO: http://www.freepm.org:8080/FreePM