[Zope-CMF] AccessRule doesn't work

Dieter Maurer dieter@handshake.de
Wed, 31 Jul 2002 23:48:01 +0200


Keller Nicolas writes:
 > 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)
You did not read the AccessRule documentation very carefully.
It tells you:

   Return values are ignored!
   You need to raise an exception (e.g. raise 'Redirect', location)
   when you want to change processing
   (or modify the REQUEST state).


Dieter