[Zope-CMF] AccessRule doesn't work

Chris McDonough chrism@zope.com
Wed, 31 Jul 2002 11:02:30 -0400


Hi Nicolas,

Maybe you should try to implement this as an external method... then
you can put print statements into the method to see if it gets
called at all (they will be displayed to the console from which you
run Zope).

- C

----- Original Message -----
From: "Keller Nicolas" <nicolas.keller@slb.de>
To: <zope-cmf@zope.org>
Sent: Wednesday, July 31, 2002 9:59 AM
Subject: [Zope-CMF] AccessRule doesn't work


> Hello!
>
> I want to protect an intranet from external access. Everytime a
user comes
> from the internet and not from the intranet, he should be forced
to login
> before he can access other areas of the cmf-instance.
>
> I ended up with this simple python script:
>
> ------
>
> REQUEST=context.REQUEST
>
> if REQUEST.REMOTE_ADDR[:12]!='123.123.123.':
>     if context.portal_membership.isAnonymousUser():
>         return container.login_form(REQUEST)
>
> ------
>
> I placed it in the root of my cmf and put an AccessRule on it.
>
> Now the bad thing: It just don't work :(
>
> It seems as Zope/CMF ignores it. If I put nonsense in it (like
adding a new
> line at the bottom: return "THIS IS CRAP") nothing happens - at
least in the
> normal web view of the CMF, the management interface always sends
me back to
> the root of my Zope if I want to access an object inside the CMF.
The plain
> script above without any nonsense in it just doesn't affect
anything.
>
> This sounds very crazy but I couldn't find a solution for weeks
now. Perhaps
> someone here can help?
>
> Thanx in advance,
>
> Nicolas Keller
>
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@zope.org
> http://lists.zope.org/mailman/listinfo/zope-cmf
>
> See http://collector.zope.org/CMF for bug reports and feature
requests
>