Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-14366

Duplicate remote_id in ezcontentobject_tree - for LDAP users

    XMLWordPrintable

Details

    Description

      Node takes "remote_id" (field of ezcontentobject_tree table) from "parent_remote_id" field of eznode_assignment table.

      While creating users through eZ LDAP login handler it addes value to "parent_remote_id" field of eznode_assignment table
      from line 741 code in kernel/classes/datatypes/ezuser/ezldapuser.php

      728         //================= common part : end ==========================
       729
       730         if ( $createNewUser )
       731         {
       732             reset( $parentNodeIDs );
       733             //$defaultPlacement = current( $parentNodeIDs );
       734             // prepare node assignments for publishing new user
       735             foreach( $parentNodeIDs as $parentNodeID )
       736             {
       737                 $newNodeAssignment = eZNodeAssignment::create( array( 'contentobject_id' => $contentObjectID,
       738                                                                       'contentobject_version' => 1,
       739                                                                       'parent_node' => $parentNodeID,
       740                                                                       'is_main' => ( $defaultUserPlacement == $parentNodeID ? 1 : 0 ) ) );
       741                 $newNodeAssignment->setAttribute( 'parent_remote_id', "LDAP_" . $parentNodeID );
       742                 $newNodeAssignment->store();
       743             }
       744
       745             //$adminUser = eZUser::fetchByName( 'admin' );
       746             //eZUser::setCurrentlyLoggedInUser( $adminUser, $adminUser->attribute( 'contentobject_id' ) );
       747
       748             //include_once( 'lib/ezutils/classes/ezoperationhandler.php' );
       749             $operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObjectID,
       750                                                                                          'version' => 1 ) );
      

      In above code following line add 'parent_remote_id' to eznode_assignment table.

      741 $newNodeAssignment->setAttribute( 'parent_remote_id', "LDAP_" . $parentNodeID );
      Now the problem is that eZ Publish content -> publish operation handler gives this 'parent_remote_id' from eznode_assignment table to "remote_id" field of ezcontentobject_tree table and if one user group have more than one user then all users get same remote_id and hence ezcontentobject_tree tables get duplicate remote_id.

      Steps to reproduce

      To reproduce set up eZ Publish 4.1.x and create users through LDAP login handlers.
      OR

      We can also try to reproduce it with workflow event and some hack.

      Basic Part
      1. Install ezpublish-4.1.0alpha2 (This time I selected eZ Flow (ver. 1.1-0alpha2) package)
      2. Login to admin interface with admin login.
      3. Go to Setup -> Workflow -> Standard -> [New workflow] -> [Add] "Event/Approve"
      My options are as follow for workflow :
      - Affected sections :: All sections
      - Affected languages :: All languages
      - Affected versions :: All versions
      
      - Users who approve content :: Administrator User
      
      ->Click [ok] to store workflow.
      
      4. Activate "content" --- "publish" --- "before" Workflow trigger -> [Apply changes]
      
      5. Create a new user under "Editor" user group with login name : editor
      

      To reproduce

      1. Login to Admin interface with "editor" login.
      2. Create a object of any class.
      3. Go to database sql prompt and execute following querys.
      
      > select max(id) as id from eznode_assignment;
      > update eznode_assignment set parent_remote_id="99MYOWNREMOTEID99" where id = <value from above query>;
      
      
      4. login to Admin interface with "admin" login
      5. Go to Collaboration (My account -> Collaboration)
      6. Approve the pending content.
      7. execute frequent cron part "php ./runcronjobs.php frequent"
      8. Now check remote_id of created node in ezcontentobject_tree table, it will be same as "99MYOWNREMOTEID99"
      Note : If you follow above procedure one more time and stick to step 3 and give same parent_remote_id then ezcontentobject_tree table will have two row with same remote_id
      

      Attachments

        Activity

          People

            patrick.allaert patrick.allaert
            gv gv
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: