[Zope] FW: Change roles with python

Andrew R. Halko ahalko@insivia.com
Thu, 29 May 2003 15:21:35 -0400

Well I want to give users with a certain IP range access to objects that
regular visitors are not.  I have a very large organization and I want
everyone in the organization to be able to view certain content and they
all will be within an IP range.  Then I have another level of content
that a user must login to view.  Asking hundreds of people to register
and also administrate them is nightmare/impossible.

So I set up two Roles Intranet User and Internal User.  My objects have
a state associated with them which is also associated to the various
roles.  Now I would like to use an access rule to check the users IP
address and then set the role for them to be an Intranet User.

Administration would be a nightmare otherwise for my needs.  I have
determined this to be the best way if possible.  I figured that since
roles have to be set somewhere, that it would be possible.

Thanks for any help!  This is a huge factor for my project at this
F.Y.I - I am using Plone on top of Zope, but no one on that mailing list
had any responses for this question

Andrew R. Halko

-----Original Message-----
From: Dieter Maurer [mailto:dieter@handshake.de] 
Sent: Thursday, May 29, 2003 2:48 PM
To: Andrew R. Halko
Cc: Zope@zope.org
Subject: Re: [Zope] FW: Change roles with python

Andrew R. Halko wrote at 2003-5-29 07:57 -0400:
 > Does anyone know how to change a role with python?  I want to have
 > of the visitors to my site have a different role than Anonymous
 > having to login to the site.

How do you recognize them when they do not log in?

Your best option (I think) is to make a custom UserFolder that
uses your differentiating information to return separate users.