Thursday 10 March 2005 8:50:38 am
Hello, I would like to write a cronjob to automatically assign users to user groups according to their attributes, after each user creation or modification (using EZ publish 3.5.1).
My main to problems are :
- Flushing all groups of a user (except main location) - Adding a user to an existing node So far I have found a function to add an object to an existing node :
function & copyto (& $object,$node){
$nodeAssignment =& eZNodeAssignment::create( array
(
'contentobject_id' => $object->attribute( 'id' ),
'contentobject_version' => $object->attribute( 'current_version' ),
'parent_node' => $node,
'is_main' => 0
)
);
$nodeAssignment->store();
$treenodegewerk = & eZContentObjectTreeNode::addChild($object->attribute( 'id' ),$node,true);
$operationResult = eZOperationHandler::execute(
'content', 'publish', array(
'object_id' => $object->attribute( 'id' ),
'version' => $object->attribute( 'current_version' ) ) );
return eZContentObjectTreeNode::findNode($node,$object->attribute('id'),true);
}
The function *almost* works fine : when I add a node assignment to a user, the $user->groups() shows me that the group has been added. BUT ... in the admin interface the assignment is not shown : there is just a sort of blank line displayed in the "Location" tab of the user. Thanks for your help.
|