How to know who an object's owner is
Hi! I am trying to find a function which determines who an object's owner is. For example, say I want to list all items in a folder like so... Item_Name (owned by User_Name) Can anyone tell me which function to use? Thanks. -- Jérôme Loisel Lévinux: GNU/Linux dans les communautés à Lévis
Jérôme Loisel wrote:
Hi! I am trying to find a function which determines who an object's owner is. For example, say I want to list all items in a folder like so...
Item_Name (owned by User_Name)
Can anyone tell me which function to use? Thanks.
-- Jérôme Loisel Lévinux: GNU/Linux dans les communautés à Lévis
Zope objects have a method called owner_info used to get ownership info in DTML for display. In Python you can use the getOwner method of the object. owner_info returns a dictionary like so: {'userCanChangeOwnershipType': 1, 'id': 'cduncan', 'explicit': 1, 'path': 'acl_users'} So, to print the owner of an object: <dtml-with owner_info mapping><dtml-var id></dtml-with> or <dtml-var expr="owner_info()['id']"> This doesn't work very well for DTML methods though... -- | Casey Duncan | Kaivo, Inc. | cduncan@kaivo.com `------------------>
Le Mardi 27 Février 2001 14:09, vous avez écrit :
Zope objects have a method called owner_info used to get ownership info in DTML for display. In Python you can use the getOwner method of the object.
owner_info returns a dictionary like so:
{'userCanChangeOwnershipType': 1, 'id': 'cduncan', 'explicit': 1, 'path': 'acl_users'}
Interesting, thanks for the info. I did some weird tests I already had a acl_users/jerome user. I created an additional levinux/acl_users/jerome user with a different password and different roles. The path information allows me to distinguish between objects created by one or the other. But what is the equivalent for AUTHENTICATED_USER? How do I know which "jerome" is visiting my site? I know that as long as my permissions are set properly, it does not really matter for security, but I am curious. I would like to show this in the site admin screens. Anecdote: I find it interesting how Zope will try to match my password with all "jerome" users before deciding which account I want to log into... :-) -- Jérôme Loisel Lévinux: GNU/Linux dans les communautés à Lévis
participants (2)
-
Casey Duncan -
Jérôme Loisel