Uploaded image for project: 'Jackrabbit Oak'
  1. Jackrabbit Oak
  2. OAK-9494

Check if a privilege name is included in a set/array of Privileges obtained from AccessControlManager.getPrivileges

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.42.0
    • jackrabbit-api, security
    • None

    Description

      I have a case where I need to check for a session if individual privileges are available for a specific node. For performance reasons I want to avoid to execute multiple calls to accessControlManager.hasPrivilege(...), but get all Privileges of that node once and the set various flags based on the presene of certain privileges or not.

      I want to use something like this:

      Set<String> applicablePrivilegeNames = ...(accessControlManager.getPrivileges(path))...
      
      boolean canAddChildNodes = applicablePrivilegeNames.contains(Privilege.JCR_ADD_CHILD_NODES);
      boolean canWrite = applicablePrivilegeNames.contains(Privilege.WRITE);
      

      It should work with aggregates as well.

      Right now it's a bit problematic because privilege.getName() resolves to something like jcr:read, while the value of Privilege.JCR_READ is {http://www.jcp.org/jcr/1.0}read

      Attachments

        Issue Links

          Activity

            People

              angela Angela Schreiber
              joerghoh Joerg Hoh
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: