Steven Turoff writes:
I need to find out if a user owns a particular object. More specifically, I would like to present some HTML if the user is the owner of the current page. Something like:
<dtml-call "REQUEST.set('userName',_.SecurityGetUser().getUserName())"> <dtml-with owner_info mapping> <dtml-if "userName == id"> Write some html </dtml-if> </dtml-with>
This works fine if the user is a manager, however if not, I get:
Site Error
An error was encountered while publishing this resource.
Unauthorized
You are not authorized to access owner_info. Whenever, you get such a situation (Unauthorized), you may try "Proxy roles". See the Zope book for details. It most cases, this will work.
In your special case, you might emulate the owner detection by checking whether the current user has the "Owner" role on the object in questions. You can use the "User" method "has_role". Dieter