[Zope-dev] Re: Using LoginManager with users stored in several Specialists
Itai Tavor
itai@optusnet.com.au
Wed, 25 Oct 2000 12:26:59 +1100
Ty Sarna <tsarna@endicor.com> wrote:
>Itai Tavor <itai@optusnet.com.au> wrote:
>> - I'm not sure how to customize a UserSource to access the
>> propertysheets on the Customer and Reseller classes. The easiest way
>> seems to be to define userExists, userRoles and userAuthenticate
>> methods in a GenericUserSource, but I don't think it's a good idea -
>> I still wouldn't know how to make changes to the propertysheet from
>> the LoginManager (for example, changePassword should be a method of
>> acl_users, not of the user classes, because it does the same thing
>> for all user types), and there is no caching. Should I write my own
>> UserSource? Or can I do it with Data Plug-ins? I'd like to keep the
>> solution simple, but I do want it to be efficient (fast and cached).
>
>Generic User Source is basically for people who are familar with GUF and
>want some degree of backward compatability. There was also a time where
>it was the only choice :-)
>
>Now there is "User Source", which is to LoginManager what Rack is to
>Specialist. It's completely general, defaulting to storing things
>persistently, but overrideable with SkinScript and the "load from
>existence of attribute blah" to do anything you want. It's much more
>Generic than Generic User Source, actually :)
>
>Have a look at the SkinScript reference for the "Object Remapping"
>example (last one under WITH ... COMPUTE ...) of how to make a Rack
>that retrieves proxyies for objects from a different Specialist. You
>can direcly apply this same technique to have a User Source provide
>users based on objects in other Specialists.
I guess I still don't understand enough about object remapping... I
got a CustomerUserSource with this SkinScript:
WITH Customers.getCustomerByName(self.id) COMPUTE login_name,
password, roles, original_object=RESULT
NOTE: I use getCustomerByName rather than getItem because I use
auto-generated codes for the customer objects id's, this lets me
allow users to change their login name - but it means that finding a
user is a more expensive operation than getItem, which is another
reason I worry about speed and caching.
Now I need to set the 'loaded by accessing attribute' bit, because
the UserSource has no persistent items in it, right? What do I set it
to? I tried to set it to 'id' but it does nothing -
CustomerUserSource.getItem(some_user) always returns None. Also, if a
Rack is using object remapping, can I still use
getPersistentItemIDs() on it?
--
Itai Tavor "Je sautille, donc je suis."
C3Works itai@c3works.com - Kermit the Frog
"If you haven't got your health, you haven't got anything"