Hi Hermann

> Betreff: Re: [Zope3-Users] How to check access on a view?


> > Hi,
> > For a simple menu, I need to check if the current principal has 
> > permissions to access a view. I understand that I can use the 
> > canAccess()/canWrite() function on object attributes but 
> how could I 
> > do this for views?

import zope.security
zope.security.canAccess(myView, '__call__') should work.
Or if the view provides a render method, you can check
zope.security.canAccess(myView, 'render').

See zope.viewlet, there we use this pattern in the viewlet manager
zope.viewlet.manager line 85.

Roger Ineichen

> > Best Regards,
> > Hermann

Zope3-users mailing list

Reply via email to