[Grok-dev] Help needed setting permissions on an adapter

kevin gill kevin.gill at openapp.ie
Wed Apr 1 13:13:11 EDT 2009


I am using grok in a Zope 2.11 environment.

I created a PathAdapter and attempted to configure it using grok.

class PathAdapter(grok.Adapter):
    """Return a dictionary for the given key
    """
    grok.provides(IPathAdapter)
    grok.context(Interface)
    grok.name('user_preferences')
 
    def __init__(self, context):
        pass
     
    def __getitem__(self, key):
        return "hello"

This gives me a security error, when I use it.

I can avoid the security error by making the __getitem__ method 
available using ZCML....

  <content class=".userpreferences.PathAdapter">
      <require
          permission="zope.Public"
          attributes="__getitem__" />
  </content>

Is there a mechanism to configure this security directly with grok 
directives, or should I just stick to the ZCML configuration.

Thanks

Kevin





More information about the Grok-dev mailing list