RE: [Zope-dev] Reference to a user

2000-10-23 Thread Brian Lloyd

 If I want to store a reference to a User in Zope, what's the best way to
 do it?
 
 I'm currently storing just the user's name, which doesn't seem very
 robust.
 
 Perhaps there's a more conrete reference to the user object? How about a
 path or something?
 Is there an interface for this anywhere? I guess something would have
 been needed for the ownership stuff?
 
 Any ideas gratefully recieved :-)

You might want to look at the 'ownerInfo' method in 
lib/python/AccessControl/Owned.py. That produces a 
fully qualified 'path' to identify a user. It probably 
should be made an interface on the user object itself 
(it probably was done this way initially to avoid forcing 
authors of other user sources to implement a new method 
or be broken).


Brian Lloyd[EMAIL PROTECTED]
Software Engineer  540.371.6909  
Digital Creations  http://www.digicool.com 




___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )




Re: [Zope-dev] Reference to a user

2000-10-23 Thread Chris Withers

Brian Lloyd wrote:
 You might want to look at the 'ownerInfo' method in
 lib/python/AccessControl/Owned.py. That produces a
 fully qualified 'path' to identify a user. It probably
 should be made an interface on the user object itself
 (it probably was done this way initially to avoid forcing
 authors of other user sources to implement a new method
 or be broken).
 
 Brian Lloyd[EMAIL PROTECTED]
 Software Engineer  540.371.6909
 Digital Creations  http://www.digicool.com

So, the following code (in a python product ;-) should get me a
persistent reference to the user that I can store, say, in an SQL
database:

from AccessControl import getSecurityManager,Owned

the_current_user_path = Owned.ownerInfo(getSecurityManager().getUser())

Which leaves me with one other question ;-)

How do I turn the_current_user_path into a User object which I can use
in the following:

print the_user.getUserName()
print the_user.getRoles(an_object)

cheers,

Chris

___
Zope-Dev maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope )