[Grok-dev] Re: How do I check permissions on a view?

Philipp von Weitershausen philipp at weitershausen.de
Mon Sep 24 12:34:37 EDT 2007


Philipp von Weitershausen wrote:
> Sebastian Ware wrote:
>> To check permissions on an object I can use...
>>
>>   zope.security.canAccess
>>   zope.security.canWrite
>>
>> ...is there a similar way of checking if the current principal may 
>> access a given view? Maybe using the URL?
> 
> zope.security.canAccess(view, '__call__')

Oh, and in case you're wondering, you can get the view via

   zope.component.getMultiAdapter((obj, request), name='index.html')


-- 
http://worldcookery.com -- Professional Zope documentation and training


More information about the Grok-dev mailing list