[Zope] has_permission

Amos Latteier amos@aracnet.com
Thu, 05 Aug 1999 16:23:54 -0700


At 06:55 PM 8/5/99 +0200, Florian Mueller wrote:

><!--#if "AUTHENTICATED_USER.has_permission('View', this())"-->
>
>This isn't working.

Florian, we need more information to understand what you want and how the
above is not fulfilling it.

Looking at your previous emails it seems that you want to test if a user
has a permissions on an object. As of Zope 2, you can use the
'has_permission' method of a user object. The arguments it takes are a
permission name, and an object.

Brian suggested using 'this()' to grab the object in the case where your
DTML is in a method which is acquired by the object. If this is not the
case, you need to specify the object explicitly,

  <!--#if "AUTHENTICATED_USER.has_permission('View',myObject)"-->

If this isn't working for you, please explain what you expect to happen and
in what way it is failing, including what version of Zope you are using,
how you have your DTML and object setup and any tracebacks.

Good luck!

-Amos