[Zope] Problem with has_permission
Dieter Fischer
dieter.fischer@grid-it.ch
Mon, 26 May 2003 10:46:42 +0200
Hello
If have a simple script (pyhton) called "test.py". I'd like to test the
permission with "has_permission". The print out is the following:
Anonymous User
Permission on test.py not ok
But this is obviously wrong, because I can execute the script.
This is the code:
<cut>
from AccessControl import getSecurityManager
obj = 'test.py'
user = getSecurityManager().getUser()
print user
if user.has_permission('View', obj):
print 'Permission on '+obj+' ok'
else:
print 'Permission on '+obj+' not ok'
return printed
</cut>
What I'm doing wrong?
Regards
Dieter
PS: System is:
Zope Version (Zope 2.6.1 (binary release, python 2.1, win32-x86), python
2.1.3, win32)
Python Version 2.1.3 (#35, Apr 8 2002, 17:47:50) [MSC 32 bit (Intel)]
But doesn't run also on Linux