[Zope] Problem with has_permission

Dieter Fischer dieter.fischer@grid-it.ch
Mon, 26 May 2003 11:34:56 +0200


Hello

Thanks to Alexis Roda, I've found the solution:

<cut>
from AccessControl import getSecurityManager

obj_name = 'test.py'
obj_id   = getattr(context, obj_name)

user = getSecurityManager().getUser()
print user

if user.has_permission('View', obj_id):
   print 'Permission on '+obj_name+' ok'
else:
   print 'Permission on '+obj_name+' not ok'

return printed
</cut>

The problem was, that I've checked against a string.

Regards

Dieter