Package org.apache.hadoop.fs.permission
Class AclEntry
java.lang.Object
org.apache.hadoop.fs.permission.AclEntry
Defines a single entry in an ACL. An ACL entry has a type (user, group,
mask, or other), an optional name (referring to a specific user or group), a
set of permissions (any combination of read, write and execute), and a scope
(access or default). AclEntry instances are immutable. Use a
AclEntry.Builder
to create a new instance.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classorg.apache.hadoop.fs.permission.AclEntry.BuilderBuilder for creating new AclEntry instances. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringaclSpecToString(List<AclEntry> aclSpec) Convert a List of AclEntries into a string - the reverse of parseAclSpec.booleangetName()Returns the optional ACL entry name.Returns the set of permissions in the ACL entry.getScope()Returns the scope of the ACL entry.getType()Returns the ACL entry type.inthashCode()static AclEntryparseAclEntry(String aclStr, boolean includePermission) Parses a string representation of an ACL into a AclEntry object.
The expected format of ACL entries in the string parameter is the same format produced by thetoStringStable()method.parseAclSpec(String aclSpec, boolean includePermission) Parses a string representation of an ACL spec into a list of AclEntry objects.toString()Returns a string representation guaranteed to be stable across versions to satisfy backward compatibility requirements, such as for shell command output or serialization.
-
Method Details
-
getType
Returns the ACL entry type.- Returns:
- AclEntryType ACL entry type
-
getName
Returns the optional ACL entry name.- Returns:
- String ACL entry name, or null if undefined
-
getPermission
Returns the set of permissions in the ACL entry.- Returns:
- FsAction set of permissions in the ACL entry
-
getScope
Returns the scope of the ACL entry.- Returns:
- AclEntryScope scope of the ACL entry
-
equals
-
hashCode
public int hashCode() -
toString
-
toStringStable
Returns a string representation guaranteed to be stable across versions to satisfy backward compatibility requirements, such as for shell command output or serialization. The format of this string representation matches what is expected by theparseAclSpec(String, boolean)andparseAclEntry(String, boolean)methods.- Returns:
- stable, backward compatible string representation
-
parseAclSpec
Parses a string representation of an ACL spec into a list of AclEntry objects. Example: "user::rwx,user:foo:rw-,group::r--,other::---" The expected format of ACL entries in the string parameter is the same format produced by thetoStringStable()method.- Parameters:
aclSpec- String representation of an ACL spec.includePermission- for setAcl operations this will be true. i.e. AclSpec should include permissions.
But for removeAcl operation it will be false. i.e. AclSpec should not contain permissions.
Example: "user:foo,group:bar"- Returns:
- Returns list of
AclEntryparsed
-
parseAclEntry
Parses a string representation of an ACL into a AclEntry object.
The expected format of ACL entries in the string parameter is the same format produced by thetoStringStable()method.- Parameters:
aclStr- String representation of an ACL.
Example: "user:foo:rw-"includePermission- for setAcl operations this will be true. i.e. Acl should include permissions.
But for removeAcl operation it will be false. i.e. Acl should not contain permissions.
Example: "user:foo,group:bar,mask::"- Returns:
- Returns an
AclEntryobject
-
aclSpecToString
Convert a List of AclEntries into a string - the reverse of parseAclSpec.- Parameters:
aclSpec- List of AclEntries to convert- Returns:
- String representation of aclSpec
-