Class AccessControlList
java.lang.Object
org.apache.hadoop.security.authorize.AccessControlList
- All Implemented Interfaces:
Writable
Class representing a configured access control list.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionThis constructor exists primarily for AccessControlList to be Writable.AccessControlList(String aclString) Construct a new ACL from a String representation of the same.AccessControlList(String users, String groups) Construct a new ACL from String representation of users and groups The arguments are comma separated lists -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd group to the names of groups allowed for this service.voidAdd user to the names of users allowed for this service.Returns the access control list as a String that can be used for building a new instance by sending it to the constructor ofAccessControlList.Get the names of user groups allowed for this service.getUsers()Get the names of users allowed for this service.booleanbooleanfinal booleanChecks if a user represented by the providedUserGroupInformationis a member of the Access Control List.voidreadFields(DataInput in) Deserializes the AccessControlList objectvoidremoveGroup(String group) Remove group from the names of groups allowed for this service.voidremoveUser(String user) Remove user from the names of users allowed for this service.toString()Returns descriptive way of users and groups that are part of this ACL.voidwrite(DataOutput out) Serializes the AccessControlList object
-
Field Details
-
WILDCARD_ACL_VALUE
- See Also:
-
USE_REAL_ACLS
- See Also:
-
-
Constructor Details
-
AccessControlList
public AccessControlList()This constructor exists primarily for AccessControlList to be Writable. -
AccessControlList
Construct a new ACL from a String representation of the same. The String is a a comma separated list of users and groups. The user list comes first and is separated by a space followed by the group list. For e.g. "user1,user2 group1,group2"- Parameters:
aclString- String representation of the ACL
-
AccessControlList
Construct a new ACL from String representation of users and groups The arguments are comma separated lists- Parameters:
users- comma separated list of usersgroups- comma separated list of groups
-
-
Method Details
-
isAllAllowed
public boolean isAllAllowed() -
addUser
Add user to the names of users allowed for this service.- Parameters:
user- The user name
-
addGroup
Add group to the names of groups allowed for this service.- Parameters:
group- The group name
-
removeUser
Remove user from the names of users allowed for this service.- Parameters:
user- The user name
-
removeGroup
Remove group from the names of groups allowed for this service.- Parameters:
group- The group name
-
getUsers
Get the names of users allowed for this service.- Returns:
- the set of user names. the set must not be modified.
-
getGroups
Get the names of user groups allowed for this service.- Returns:
- the set of group names. the set must not be modified.
-
isUserInList
Checks if a user represented by the providedUserGroupInformationis a member of the Access Control List. If user was proxied and USE_REAL_ACLS + the real user name is in the control list, then treat this case as if user were in the ACL list.- Parameters:
ugi- UserGroupInformation to check if contained in the ACL- Returns:
- true if ugi is member of the list or if USE_REAL_ACLS + real user is in the list
-
isUserAllowed
-
toString
Returns descriptive way of users and groups that are part of this ACL. UsegetAclString()to get the exact String that can be given to the constructor of AccessControlList to create a new instance. -
getAclString
Returns the access control list as a String that can be used for building a new instance by sending it to the constructor ofAccessControlList.- Returns:
- acl string.
-
write
Serializes the AccessControlList object- Specified by:
writein interfaceWritable- Parameters:
out-DataOuputto serialize this object into.- Throws:
IOException- any other problem for write.
-
readFields
Deserializes the AccessControlList object- Specified by:
readFieldsin interfaceWritable- Parameters:
in-DataInputto deseriablize this object from.- Throws:
IOException- any other problem for readFields.
-