[Grok-dev] Re: Protecting views to allow anonymous access only

Dennis Noordsij dennis.noordsij at movial.fi
Thu Jul 31 06:26:26 EDT 2008

Philipp von Weitershausen schreef:
> Andreas Kaiser wrote:
>> I'm in the progress of developing my first Grok application, so please
>> be patient with me and my maybe stupid questions.
>> Right now I'm stuck with this…
>> I need to protect a view, so that it can be accessed *only* by
>> anonymous users.
> That's going to be hard to impossible to do with Zope's default security
> policy.


You could do the following:

In buildout.cfg,

<unauthenticatedPrincipal id="zope.anybody"
          title="Anonymous user" />

<grant permission="mysite.Anonymous" principal="zope.anybody" />

Then you can protect a view with mysite.Anonymous and only not-logged-in
users can access it.

(I use it to add a "login", "register", etc viewlet to the default layout).

Or am I missing the problem?


More information about the Grok-dev mailing list