Bartek Gorny
2006-11-14 17:26:06 UTC
Hi
I have a funny problem: I have an object's path and I have to check if
I have a View permission on the object, but obviously sometimes I
don't have it, nor Access Content Information permission. The problem
is that to check permissions (by getSecurityManager().checkPermission
or other similar ways) I have to get the object, and I am not
authorized to do it. Then the "Unauthorized" exception is thrown.
I could try to catch the exception, but I'm doing it from a ZMI Python
script - to catch the exception I have to import its class, but in ZMI
importing Unauthorized is - well, unauthorized...
And I'm stuck. The only way I can think of to solve this problem is to
search for the object in portal_catalog (by relative_url) and see if
it returns something - does it make sense, or is it a waste of
resources?
Bartek
I have a funny problem: I have an object's path and I have to check if
I have a View permission on the object, but obviously sometimes I
don't have it, nor Access Content Information permission. The problem
is that to check permissions (by getSecurityManager().checkPermission
or other similar ways) I have to get the object, and I am not
authorized to do it. Then the "Unauthorized" exception is thrown.
I could try to catch the exception, but I'm doing it from a ZMI Python
script - to catch the exception I have to import its class, but in ZMI
importing Unauthorized is - well, unauthorized...
And I'm stuck. The only way I can think of to solve this problem is to
search for the object in portal_catalog (by relative_url) and see if
it returns something - does it make sense, or is it a waste of
resources?
Bartek
--
"Software is largely a service industry operating under the persistent
but unfounded delusion that it is a manufacturing industry."
Eric S.Raymond, "The Magic Cauldron"
"Software is largely a service industry operating under the persistent
but unfounded delusion that it is a manufacturing industry."
Eric S.Raymond, "The Magic Cauldron"