@NotThreadSafe public class AccessControlList extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
static class |
AccessControlList.AccessControlListDeserializer
This is a custom json deserializer for AccessControlList class.
|
static class |
AccessControlList.AccessControlListSerializer
This is a custom json serializer for AccessControlList class.
|
Modifier and Type | Field and Description |
---|---|
static AccessControlList |
EMPTY_ACL |
protected ExtendedACLEntries |
mExtendedEntries |
protected short |
mMode |
protected String |
mOwningGroup |
protected String |
mOwningUser |
static String |
OWNER_FIELD
Keys representing owning user and group for proto ser/de.
|
static String |
OWNING_GROUP_FIELD |
static String |
OWNING_GROUP_KEY |
static String |
OWNING_USER_KEY |
static String |
STRING_ENTRY_FIELD |
Constructor and Description |
---|
AccessControlList()
Creates a new instance where owning user and owning group are initialized to empty strings,
and no action is permitted for any user or group.
|
Modifier and Type | Method and Description |
---|---|
boolean |
checkPermission(String user,
List<String> groups,
AclAction action)
Checks whether the user has the permission to perform the action.
|
void |
clearEntries()
Clears out all entries (does not modify the owner name and owning group).
|
boolean |
equals(Object o) |
static AccessControlList |
fromStringEntries(String owner,
String owningGroup,
List<String> stringEntries)
Converts a list of string entries into an AccessControlList or a DefaultAccessControlList.
|
List<AclEntry> |
getEntries()
Returns a list of
AclEntry which represent this ACL instance. |
ExtendedACLEntries |
getExtendedEntries() |
short |
getMode() |
AclActions |
getOtherActions() |
String |
getOwningGroup() |
AclActions |
getOwningGroupActions() |
String |
getOwningUser() |
AclActions |
getOwningUserActions() |
AclActions |
getPermission(String user,
List<String> groups)
Gets the permitted actions for a user.
|
boolean |
hasExtended() |
int |
hashCode() |
void |
removeEntry(AclEntry entry)
Removes the specified entry.
|
void |
removeExtendedEntries()
Removes all of the exnteded entries.
|
void |
setEntry(AclEntry entry)
Sets an entry into the access control list.
|
void |
setMode(short mode)
Sets permitted actions for owning user, owning group, and other based on the mode.
|
void |
setOwningGroup(String group)
Sets owning group.
|
void |
setOwningUser(String user)
Sets owning user.
|
String |
toString() |
List<String> |
toStringEntries() |
void |
updateMask()
Update the mask to be the union of owning group entry, named user entry and named group entry.
|
public static final AccessControlList EMPTY_ACL
public static final String OWNER_FIELD
public static final String OWNING_GROUP_FIELD
public static final String STRING_ENTRY_FIELD
public static final String OWNING_USER_KEY
public static final String OWNING_GROUP_KEY
protected String mOwningUser
protected String mOwningGroup
protected short mMode
protected ExtendedACLEntries mExtendedEntries
public AccessControlList()
public void clearEntries()
public ExtendedACLEntries getExtendedEntries()
public String getOwningUser()
public String getOwningGroup()
public AclActions getOwningUserActions()
public AclActions getOwningGroupActions()
public AclActions getOtherActions()
public short getMode()
Mode
for owning user, owning group, and otherpublic List<AclEntry> getEntries()
AclEntry
which represent this ACL instance. The mask will only be
included if extended ACL entries exist.public boolean hasExtended()
public void removeEntry(AclEntry entry)
entry
- the entry to be removedpublic void removeExtendedEntries()
public void setOwningUser(String user)
user
- the owning userpublic void setOwningGroup(String group)
group
- the owning grouppublic void setMode(short mode)
Mode
.
The update logic is defined in AclActions.updateByModeBits(Mode.Bits)
.mode
- the modepublic void updateMask()
public void setEntry(AclEntry entry)
entry
- the entry to be added or updatedpublic boolean checkPermission(String user, List<String> groups, AclAction action)
user
- the usergroups
- the groups the user belongs toaction
- the actionpublic AclActions getPermission(String user, List<String> groups)
user
- the usergroups
- the groups the user belongs topublic static AccessControlList fromStringEntries(String owner, String owningGroup, List<String> stringEntries)
owner
- the ownerowningGroup
- the owning groupstringEntries
- the list of string representations of the entriesAccessControlList
instanceCopyright © 2023. All Rights Reserved.