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

Cannot set policy on moved node in new transaction

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 5.2.0.Final
    • 5.1.0.Final
    • Common
    • None
    • 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(); }

      getPolicies returns empty array, but acl was set before.

              hchiorean Horia Chiorean (Inactive)
              aatamaniv Andrii Atamaniv (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: