public final class AccessControlUtil extends Object
AccessControlLists.| Modifier and Type | Field and Description |
|---|---|
static Function<String,Option<AclScope>> |
toAclScope |
| Modifier and Type | Method and Description |
|---|---|
static AccessControlList |
acl(Either<AccessControlEntry,List<AccessControlEntry>>... entries)
Constructor function for ACLs.
|
static Checksum |
calculateChecksum(AccessControlList acl)
Calculate an MD5 checksum for an
AccessControlList. |
static Either<AccessControlEntry,List<AccessControlEntry>> |
entries(String role,
Tuple<String,Boolean>... actions)
Create a list of access control entries for a given role.
|
static Either<AccessControlEntry,List<AccessControlEntry>> |
entry(String role,
String action,
boolean allow)
Create a single access control entry.
|
static boolean |
equals(AccessControlList a,
AccessControlList b)
Define equality on AccessControlLists.
|
static AccessControlList |
extendAcl(AccessControlList acl,
String role,
String action,
boolean allow)
Extends an access control list with an access control entry
|
static boolean |
isAuthorized(AccessControlList acl,
User user,
Organization org,
Object action)
Determines whether the
AccessControlList permits a user to perform an action. |
static boolean |
isAuthorizedAll(AccessControlList acl,
User user,
Organization org,
Object... actions)
Returns true only if all actions are authorized.
|
static boolean |
isAuthorizedOne(AccessControlList acl,
User user,
Organization org,
Object... actions)
Returns true if at least one action is authorized.
|
static boolean |
isProhibitedAll(AccessControlList acl,
User user,
Organization org,
Object... actions)
Returns true if all actions are prohibited.
|
static boolean |
isProhibitedOne(AccessControlList acl,
User user,
Organization org,
Object... actions)
Returns true if at least one action is prohibited.
|
static AccessControlList |
reduceAcl(AccessControlList acl,
String role,
String action)
Reduces an access control list by an access control entry
|
public static boolean isAuthorized(AccessControlList acl, User user, Organization org, Object action)
AccessControlList permits a user to perform an action.
There are three ways a user can be allowed to perform an action:
acl - the AccessControlListuser - the userorg - the organizationaction - The action to perform. action may be an arbitrary object. The authorization check is done on
the string representation of the object (#toString()). This allows to group actions as enums
and use them without converting them to a string manually. See
Permissions.Action.IllegalArgumentException - if any of the arguments are nullpublic static boolean isAuthorizedAll(AccessControlList acl, User user, Organization org, Object... actions)
public static boolean isAuthorizedOne(AccessControlList acl, User user, Organization org, Object... actions)
public static boolean isProhibitedAll(AccessControlList acl, User user, Organization org, Object... actions)
public static boolean isProhibitedOne(AccessControlList acl, User user, Organization org, Object... actions)
public static AccessControlList extendAcl(AccessControlList acl, String role, String action, boolean allow)
acl - the access control list to extendrole - the access control entry roleaction - the access control entry actionallow - whether this access control entry role is allowed to take this actionpublic static AccessControlList reduceAcl(AccessControlList acl, String role, String action)
acl - the access control list to reducerole - the role of the access control entry to removeaction - the action of the access control entry to removepublic static AccessControlList acl(Either<AccessControlEntry,List<AccessControlEntry>>... entries)
public static Either<AccessControlEntry,List<AccessControlEntry>> entry(String role, String action, boolean allow)
public static Either<AccessControlEntry,List<AccessControlEntry>> entries(String role, Tuple<String,Boolean>... actions)
public static boolean equals(AccessControlList a, AccessControlList b)
This has not been implemented in terms of #equals and #hashCode because the list of entries is not immutable and therefore not suitable to be put in a set.
public static Checksum calculateChecksum(AccessControlList acl)
AccessControlList.Copyright © 2009–2020 Opencast Project. All rights reserved.