Uploaded image for project: 'ModeShape'
  1. ModeShape
  2. MODE-2627

Cannot set policy on moved node in new transaction

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 5.1.0.Final
    • Fix Version/s: 5.2.0.Final
    • Component/s: Common
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      add unit test to org.modeshape.jcr.TransactionsTest.java

      @FixFor("MODE-2627")
      @Test
      public void shouldUpdateACLOnMovedNode() throws Exception {
      AccessControlManager acm = session.getAccessControlManager();
      final String childPath2 = "/parent/child2";
      final String childDestinationNode = "/parent/child/child2";
      JcrAccessControlList acl = new JcrAccessControlList(childDestinationNode);
      Privileges privileges = new Privileges(session);
      Privilege[] privilegeArray = new Privilege[]

      {privileges.forName(Privilege.JCR_READ), privileges.forName(Privilege.JCR_WRITE), privileges.forName(Privilege.JCR_READ_ACCESS_CONTROL)}

      ;
      acl.addAccessControlEntry(SimplePrincipal.newInstance("anonymous"), privilegeArray);
      startTransaction();
      Node parent = session.getRootNode().addNode("parent");
      parent.addNode("child");
      parent.addNode("child2");
      session.save();
      commitTransaction();
      startTransaction();
      session.getWorkspace().move(childPath2, childDestinationNode);
      session.save();
      commitTransaction();
      startTransaction();
      acm.setPolicy(childDestinationNode, acl);
      session.save();
      Node movedNode = session.getNode(childDestinationNode);
      assertEquals(childDestinationNode, movedNode.getPath());
      assertEquals(1, acm.getPolicies(childDestinationNode).length);
      assertEquals(acm.getPolicies(childDestinationNode)[0], acl);
      assertNoNode(childPath2);
      session.logout();
      commitTransaction();
      }

      Show
      add unit test to org.modeshape.jcr.TransactionsTest.java @FixFor(" MODE-2627 ") @Test public void shouldUpdateACLOnMovedNode() throws Exception { AccessControlManager acm = session.getAccessControlManager(); final String childPath2 = "/parent/child2"; final String childDestinationNode = "/parent/child/child2"; JcrAccessControlList acl = new JcrAccessControlList(childDestinationNode); Privileges privileges = new Privileges(session); Privilege[] privilegeArray = new Privilege[] {privileges.forName(Privilege.JCR_READ), privileges.forName(Privilege.JCR_WRITE), privileges.forName(Privilege.JCR_READ_ACCESS_CONTROL)} ; acl.addAccessControlEntry(SimplePrincipal.newInstance("anonymous"), privilegeArray); startTransaction(); Node parent = session.getRootNode().addNode("parent"); parent.addNode("child"); parent.addNode("child2"); session.save(); commitTransaction(); startTransaction(); session.getWorkspace().move(childPath2, childDestinationNode); session.save(); commitTransaction(); startTransaction(); acm.setPolicy(childDestinationNode, acl); session.save(); Node movedNode = session.getNode(childDestinationNode); assertEquals(childDestinationNode, movedNode.getPath()); assertEquals(1, acm.getPolicies(childDestinationNode).length); assertEquals(acm.getPolicies(childDestinationNode) [0] , acl); assertNoNode(childPath2); session.logout(); commitTransaction(); }

      Description

      getPolicies returns empty array, but acl was set before.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                hchiorean Horia Chiorean
                Reporter:
                aatamaniv Andrii Atamaniv
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: