Package io.continual.iam.access
Class AccessControlList
java.lang.Object
io.continual.iam.access.AccessControlList
An access control list, which has an owner and an ordered list of ACL entries.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionConstruct an empty ACLConstruct an empty ACLAccessControlList(AclUpdateListener listener) Construct an ACL with the given update listener -
Method Summary
Modifier and TypeMethodDescriptionAdd the given ACL entry to this ACL's list of entries.org.json.JSONObjectasJson()Serialize to JSONstatic AccessControlList.Builderbuilder()Create a builder for an ACLbooleanCan the given user perform the given operation based on this ACL?booleanCan the given user ID or group set perform the given operation based on this ACL?clear()Clear all entries from this ACL and notify the listener if presentClear matching entries.static AccessControlListReturn an ACL that allows any user to perform any operationDeny the given ID from performing the given operations by adding a new entry to the end of the ACL entry list.static AccessControlListdeserialize(String s, AclUpdateListener listener) Deserialize a string created by serialize()static AccessControlListdeserialize(org.json.JSONObject o, AclUpdateListener listener) Deserialize a JSON object created by serialize() or asJson()Get the list of ACL entries on this ACLGet the listener on this ACL if presentgetOwner()Get the owner ID for this ACLstatic AccessControlListinitialize(AclUpdateListener listener) Permit the given ID to perform the given operations by adding a new entry to the end of the ACL entry list.Serialize to a JSON StringSet the owner ID for this ACL.toString()
-
Field Details
-
CREATE
- See Also:
-
READ
- See Also:
-
UPDATE
- See Also:
-
DELETE
- See Also:
-
-
Constructor Details
-
AccessControlList
public AccessControlList()Construct an empty ACL -
AccessControlList
Construct an empty ACL -
AccessControlList
Construct an ACL with the given update listener- Parameters:
listener- a listener, which may be null
-
-
Method Details
-
builder
Create a builder for an ACL- Returns:
- a new builder
-
createOpenAcl
Return an ACL that allows any user to perform any operation- Returns:
- an ACL
-
getOwner
Get the owner ID for this ACL- Returns:
- the owner, which may be null
-
setOwner
Set the owner ID for this ACL. The listener is updated if provided.- Parameters:
userOrGroupId- The ID to use as owner. This may be null.- Returns:
- this ACL
-
permit
Permit the given ID to perform the given operations by adding a new entry to the end of the ACL entry list. Note that a conflicting entry earlier in the list will take precedence.- Parameters:
userOrGroupId- the user or group IDops- one or more operations- Returns:
- this ACL
-
deny
Deny the given ID from performing the given operations by adding a new entry to the end of the ACL entry list. Note that a conflicting entry earlier in the list will take precedence.- Parameters:
userOrGroupId- the user or group IDops- one or more operations- Returns:
- this ACL
-
clear
Clear matching entries. This method removes a matching entry and is different from deny(), which adds an entry that explicitly denies access.- Parameters:
userOrGroupId- the user or group to clear entries forops- the operations to clear entries for- Returns:
- this ACL
-
clear
Clear all entries from this ACL and notify the listener if present- Returns:
- this ACL
-
getEntries
Get the list of ACL entries on this ACL- Returns:
- a list of 0 or more entries
-
canUser
Can the given user perform the given operation based on this ACL?- Parameters:
user- a userop- an operation- Returns:
- true if the user can perform the given operation
- Throws:
IamSvcException- if there's an error during processing
-
canUser
Can the given user ID or group set perform the given operation based on this ACL?- Parameters:
userId- a user IDgroups- a set of 0 or more groupsop- an operation- Returns:
- true if the user or group set can perform the given operation
-
addAclEntry
Add the given ACL entry to this ACL's list of entries.- Parameters:
acle- an ACL entry- Returns:
- this ACL
-
toString
-
asJson
public org.json.JSONObject asJson()Serialize to JSON- Returns:
- a JSON object
-
serialize
Serialize to a JSON String- Returns:
- a string
-
initialize
-
deserialize
Deserialize a string created by serialize()- Parameters:
s- a string serialized ACLlistener- an optional listener- Returns:
- an ACL
-
deserialize
Deserialize a JSON object created by serialize() or asJson()- Parameters:
o- a JSON object serialized ACLlistener- an optional listener- Returns:
- an ACL
-
getListener
Get the listener on this ACL if present- Returns:
- a listener or null
-