[Zope-CMF] Object ownership

Tres Seaver tseaver@zope.com
21 May 2002 08:18:18 -0400


On Tue, 2002-05-21 at 04:01, John Morton wrote:
> On Tuesday 21 May 2002 00:34, Tres Seaver wrote:
> > There are two different senses of ownership within Zope:
> >
> >   - "executable" ownership defines the user whose roles mask those of
> >     the invoking user;  this one addresses some server-side trojan
> >     issues, and is mostly interesting for "methodish" objects
> 
> A method that transfers ownership should probably modify this, but otherwise
> I can leave it allow. However, as it's set at object creation, I could use 
> this to determine the object's creator, which is what I'm looking for.
> 
> >     ("Wesleyans"?)
> 
> Nice :-)
> 
> >   - the "Owner" local role defines who has the permissions associtated
> >     with that role for the object:  e.g., who can edit in in the private
> >     state (for the default workflow).  Users can be granted the owner
> >     local role via:
> >
> >     o the ZMI (linked from the "Security" tab)
> >
> >     o The "Local Roles" action for folders (note that the role is
> >       acquired by default)
> >
> >     o Scripts calling 'manage_{add,set,del}LocalRoles' (defined in
> >       'AccessControl/Role.py').
> 
> But no methods for answering the question, "Which users have the local role 
> 'Owner' for this object?".  

This works for roles assigned directly on the object:

  immediate = object.users_with_local_role( 'Owner' )

Because roles can be acquired, asking that question is tougher than it
seems;  you need to troll up the hierarchy, accumulating users until
you get to the root.

> 
> I'll have a look around these places and see what I can come up with, though I 
> think the kludge of saving the workflow actor name at object creation time 
> might do the trick

The 'DublinCore.Creator' method might help, too;  it returns the
userid(s) of the users with 'Owner' local role on the content object. :)

Tres.
-- 
===============================================================
Tres Seaver                                tseaver@zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com