Class AccessInformationUtil
java.lang.Object
org.opencastproject.authorization.xacml.manager.util.AccessInformationUtil
Utility class around access information like ACL.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Option<ManagedAcl> matchAcls(List<ManagedAcl> acls, AccessControlList acl) Matches the given ACL against the given list of managed ACLs returning the first match.static Option<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.static org.codehaus.jettison.json.JSONObjectserializeManagedAcl(ManagedAcl managedAcl) Serializes aManagedAclasJSONObject.static org.codehaus.jettison.json.JSONObjectSerialize aAccessControlListasJSONObject.
-
Method Details
-
serializeManagedAcl
Serializes aManagedAclasJSONObject. 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 themanagedAclparameter is null
-
serializePrivilegesByRole
public static org.codehaus.jettison.json.JSONObject serializePrivilegesByRole(AccessControlList acl) Serialize aAccessControlListasJSONObject. 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 theaclparameter is null
-
matchAcls
Matches the given ACL against the given list of managed ACLs returning the first match.- Parameters:
acls- the list of managed ACLsacl- the ACL to search- Returns:
- an
Optionwrapping the matching ACL or none if not found
-
matchAclsLenient
public static Option<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 ACLsacl- the ACL to searchignorePrefixes- list of prefixes that will cause all roles matching a prefix to be ignored in the matching- Returns:
- an
Optionwrapping the matching ACL or none if not found
-