[Zope] User Sessions

Chris McDonough chrism@digicool.com
Wed, 31 Jan 2001 18:39:24 -0500


Yeah the "dissociating user objects from their user names" problem is the
hardest one to solve right now because it requires changes to the core that
may have the potential to break 3rd-party user folders which are based on
the Zope basic user folder.  It's definitely required for a (real)
membership system which allows users to change their usernames.

However, if you're not concerned about this, you can use the security
manager to grab the user:

from AccessControl import SecurityManager
sm = getSecurityManager()
u = sm.getUser()

Then you can get the user's folder path (a tuple of path elements plus the
user's name):

db_path =
tuple(list(user.aq_inner.aq_parent.getPhysicalPath())+[user.getId()])

... and use that as the key into another namespace.  It will be guaranteed
unique, but it of course can't be changed without adverse effects on this
coupling.

This is an area of Zope that deserves a lot of attention.

----- Original Message -----
From: "John Morton" <jwm@plain.co.nz>
To: <zope@zope.org>; "Chris Withers" <chrisw@nipltd.com>
Sent: Wednesday, January 31, 2001 6:01 PM
Subject: Re: [Zope] User Sessions


> On Wed, 31 Jan 2001 00:30:40 -0000 Chris Withers <chrisw@nipltd.com>
wrote:
>
> > > state with authenticated users.  It's just not as useful because once
> > > they're authenticated you'd probably be better off associating the
state
> > > with their user object.
> >
> > Wow... I wish Zope supported this. Maybe a proposal for dev.zope.org is
in
> > order?
> >
> > How I'd like to see text box widths and top frame preference stored
against
> > the user, not the domain name/browser... :-S
>
> In principle you could do this by spawning a property sheet off the user
> object for each product and storing attributes in that - and I think
> that's one of the things that Zpatterns would like to make possible,
> however in practice I haven't figured out how to do it the way I'd like to
> without making the LoginManager specialist become the customization
> specialist for each product.
>
> However, Zpatterns talks about products[1] being able to add property
> sheets onto other object without that object 'knowing', so maybe it is
> possible, and I haven't figured it out yet (I don't think I'm the only one
> who finds the jargon make my head spin). On the other hand, they also talk
> about making property sheets act like data managers so you can define data
> plugins to handle their individual attributes as being a feature they'll
> include in 0.50 or something, so maybe it isn't possible just yet.
>
> I'm looking to solve the customization problem in the interim by having a
> given product define a class for their customization data and methods, and
> have a specialist in the aquisition path manage the data, keyed to the
> name of a given user object[2]. As a site integrator, I can modify the
> specialist's data plugins to say something like 'don't get and store the
full
> name and email address in this object, instead, get them from this global
> data specialist over here'. I think this will solve most of my immediate
> problems.
>
> John
>
> [1] Applications/frameworks/whatever-the-kids-call-it-today
> [2] Or better yet, the user object has a method to return a primary key,
>     so that user objects can change their login name with ease.
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>
>