Class AccessInformationUtil

java.lang.Object
org.opencastproject.authorization.xacml.manager.util.AccessInformationUtil

public final class AccessInformationUtil extends Object
Utility class around access information like ACL.
  • Method Details

    • serializeManagedAcl

      public static org.codehaus.jettison.json.JSONObject serializeManagedAcl(ManagedAcl managedAcl)
      Serializes a ManagedAcl as JSONObject. The JSON structure will look like this
       {
         "id": 56739,
         "name": "ACL name"
       }
       
      Parameters:
      managedAcl - the ACL to serialize
      Returns:
      the ACL as JSON object
      Throws:
      IllegalArgumentException - if the managedAcl parameter is null
    • serializePrivilegesByRole

      public static org.codehaus.jettison.json.JSONObject serializePrivilegesByRole(AccessControlList acl)
      Serialize a AccessControlList as JSONObject. The JSON structure will look like this
       {
         "ROLE_STUDENT": {
           "read": true,
           "write": false
         },
         "ROLE_TEACHER": {
           "read": true,
           "write": true
         }
       }
       
      Parameters:
      acl - the access control list to serialize
      Returns:
      the acl as JSON object
      Throws:
      IllegalArgumentException - if the acl parameter is null
    • matchAcls

      public static Optional<ManagedAcl> matchAcls(List<ManagedAcl> acls, AccessControlList acl)
      Matches the given ACL against the given list of managed ACLs returning the first match.
      Parameters:
      acls - the list of managed ACLs
      acl - the ACL to search
      Returns:
      an Optional wrapping the matching ACL or none if not found
    • matchAclsLenient

      public static Optional<ManagedAcl> matchAclsLenient(List<ManagedAcl> acls, AccessControlList acl, List<String> ignorePrefixes)
      Matches the given ACL against the given list of managed ACLs returning the first match.
      Parameters:
      acls - the list of managed ACLs
      acl - the ACL to search
      ignorePrefixes - list of prefixes that will cause all roles matching a prefix to be ignored in the matching
      Returns:
      an Optional wrapping the matching ACL or none if not found