Uploaded image for project: 'Jackrabbit Content Repository'
  1. Jackrabbit Content Repository
  2. JCR-643

Own AccessManager + VersionManager : AccesDenied problem

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 1.4, 1.5
    • None
    • jackrabbit-core, versioning
    • None

    Description

      I have implemented my own AccessManager, and everything works fine, until I want to use versioning (mix:versionable).

      When I try this code:

      Node root = session.getRootNode();
      if (root.canAddMixin("mix:referenceable")) root.addMixin("mix:referenceable");

      Node new_node = root.addNode("some_name");
      if (new_node.canAddMixin("mix:referenceable")) new_node.addMixin("mix:referenceable");
      if (new_node.canAddMixin("mix:versionable")) new_node.addMixin("mix:versionable");

      // here I grant privileges to new_node
      handler.addACL(root.getUUID(), new_node.getUUID());

      session.save();

      I have a AccessDeniedException, then I look at jackrabbit sources (VersionManagerImpl.java) and found this:

      public VersionHistory createVersionHistory(Session session, final NodeState node)
      throws RepositoryException {
      InternalVersionHistory history = (InternalVersionHistory)
      escFactory.doSourced((SessionImpl) session, new SourcedTarget(){
      public Object run() throws RepositoryException

      { return createVersionHistory(node); }

      });
      // HERE IS new version node created

      if (history == null)

      { throw new VersionException("History already exists for node " + node.getNodeId()); }

      // AND HERE you want to check privileges for newly created node
      return (VersionHistory) ((SessionImpl) session).getNodeById(history.getId());
      }

      // so, SessionImpl ask ItemManager for NodeImpl,
      // ItemManager ask AccessManager about Item privileges ( session.getAccessManager().isGranted(id, AccessManager.READ) ),
      // and my AccessManager don't know anything about this Item, so it (Item) haven't any privileges,
      // and I have a AccessDeniedException

      Did I miss something? Can I use versioning with own AccessManager?

      Attachments

        1. VersionStorageAccessTest.java
          14 kB
          Angela Schreiber

        Activity

          People

            Unassigned Unassigned
            andryxa Andrey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: