changing the owner : is this feature on 3.6 ?

Author Message

Xavier Dutoit

Wednesday 27 July 2005 7:54:04 am

Hi,

I want to be able to change the owner of a node either from an admin interface or from an event.

I've read various informations about it.

On this post, Frederik said it was likely to be in the 3.6 :
http://ez.no/community/forum/general/change_articles_owner_back_to_previous_owner_after_editing

But on the 3.6 doc:
http://ez.no/doc/ez_publish/technical_manual/3_6/concepts_and_basics/content_management/the_content_object
It says that the owner can't be modified.

Any reason for not being able to change the owner, like a security problem on the ACL model or a big problem like that ?

I'd like to give it a shot and try to modify ez, but can't find a way to do it through an ez class. Do I need to run SQL update statement ?

Am I missing something obvious ?

X+

http://www.sydesy.com

Frederik Holljen

Wednesday 27 July 2005 9:12:20 am

It didn't make it unfortunately (not enough time). It should be a nice and simple exercise if someone wants to get into eZ publish development though..

David Eriksson

Thursday 28 July 2005 2:15:37 am

We needed this feature, and implemented is as an action.

if ($http->hasPostVariable("ActionSwitchOwner")) {

       // Fetch the ID of the group to change ownership to
       $groupID = eZHTTPTool::variable('group');

       // Create database connection
       $db =& eZDB::instance();

       // Execute query
       $db->query( "UPDATE ezcontentobject SET owner_id='$groupID' WHERE id='$objectID'" );

}

That was the only way we could find to do it.

/David

Frederik Holljen

Thursday 28 July 2005 2:30:03 am

There you go.. now simply add a GUI for it and you have a patch :)

David Eriksson

Friday 29 July 2005 1:07:39 am

Who knows, I might do that later. But we don't have much use for a gui at the moment, and we are under a tight deadline, so it's not my highest priority. :)

If anyone else wants to do it; feel free.

/David

Xavier Dutoit

Friday 29 July 2005 2:05:24 am

Ok, working on an "owner" extension since nobody was willing to do my job ;)

So far, thinking about 2 views (on module.php) :
- /set/<id> (if you know the id)
- /browse (list all the users, you can pick up one)

and probably an event to be able to set the owner from a workflow.

That's going to be rather rough on the edge and made to fit my needs, as I'm rather busy too.

Let you know...

X+

http://www.sydesy.com

Gabriel Ambuehl

Friday 29 July 2005 2:16:42 am

Ideally, one would have a user selection dropdown on the content/edit view to drive /set/id, thoughts?

Visit http://triligon.org

Xavier Dutoit

Friday 29 July 2005 2:45:40 am

Well, changing the owner shouldn't be granted to every user able to modify the content.

However, that shouldn't be too complicated to test if the user has the right to access the extension "owner/set" from the content edit page and decide to display or not the drop down.

The idea of a separated page to select the user was so it can be extended easily (eg display the users grouped by usergroups, limit the user displayed to a subset...).

X+

http://www.sydesy.com

Gabriel Ambuehl

Friday 29 July 2005 2:56:55 am

Well if you write the separate stuff I might add the dropdown later if you can provide a function to check permissions with?

Visit http://triligon.org

Xavier Dutoit

Friday 29 July 2005 9:24:21 am

Hi all,

I've created a new extension "owner" in the pubsvn

http://pubsvn.ez.no/community/trunk/extension/owner/

To change the owner via GUI : /owner/browse/<nodeid>

To change the owner directly /owner/set/<objectid>/<ownerid>

In the second view, both params are objects.

Frederik, How do I set the url from the view ?

$Result['path'] = array( array( 'url_alias' => '/owner/browse',
                                'text' => "select an owner") );

Doesn't make it. any idea ?

Gabriel, over to you.... ;)

http://www.sydesy.com

Gabriel Ambuehl

Friday 29 July 2005 10:53:06 am

Not this weekend, but I'll look into it some time next week, thanks.

Visit http://triligon.org

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.