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

Martijn Faassen faassen at startifact.com
Mon Sep 24 12:28:22 EDT 2007

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?

You can explicitly check permissions like this:

from zope.security.management import getInteraction

interaction = getInteraction()

interaction.checkPermission('mypermission', object):

To determine if the user has the permission 'mypermission' on the object 
(due to local roles, group membership, etc). object could be a content 
object or a view.



More information about the Grok-dev mailing list