@NotThreadSafe public class DefaultPermissionChecker extends Object implements PermissionChecker
Constructor and Description |
---|
DefaultPermissionChecker(InodeTree inodeTree)
Constructs a
PermissionChecker instance for Alluxio file system. |
Modifier and Type | Method and Description |
---|---|
protected void |
checkInodeList(String user,
List<String> groups,
Mode.Bits bits,
String path,
List<InodeView> inodeList,
boolean checkIsOwner)
This method provides basic permission checking logic on a list of inodes.
|
void |
checkParentPermission(Mode.Bits bits,
LockedInodePath inodePath)
Checks whether a user has permission to perform a specific action on the parent of the given
path; if parent directory does not exist, treats the closest ancestor directory of the path as
its parent and checks permission on it.
|
void |
checkPermission(Mode.Bits bits,
LockedInodePath inodePath)
Checks whether a user has permission to perform a specific action on a path.
|
void |
checkSetAttributePermission(LockedInodePath inodePath,
boolean superuserRequired,
boolean ownerRequired,
boolean writeRequired)
Checks whether a user has permission to edit the attribute of a given path.
|
void |
checkSuperUser()
Checks whether the user is a super user or in super group.
|
Mode.Bits |
getPermission(LockedInodePath inodePath)
Gets the permission to access inodePath for the current client user.
|
public DefaultPermissionChecker(InodeTree inodeTree)
PermissionChecker
instance for Alluxio file system.inodeTree
- inode tree of the file system masterpublic void checkParentPermission(Mode.Bits bits, LockedInodePath inodePath) throws AccessControlException, InvalidPathException
PermissionChecker
checkParentPermission
in interface PermissionChecker
bits
- bits that capture the action Mode.Bits
by userinodePath
- the path to check permission onAccessControlException
- if permission checking failsInvalidPathException
- if the path is invalidpublic void checkPermission(Mode.Bits bits, LockedInodePath inodePath) throws AccessControlException
PermissionChecker
checkPermission
in interface PermissionChecker
bits
- bits that capture the action Mode.Bits
by userinodePath
- the path to check permission onAccessControlException
- if permission checking failspublic Mode.Bits getPermission(LockedInodePath inodePath)
PermissionChecker
getPermission
in interface PermissionChecker
inodePath
- the inode pathpublic void checkSetAttributePermission(LockedInodePath inodePath, boolean superuserRequired, boolean ownerRequired, boolean writeRequired) throws AccessControlException, InvalidPathException
PermissionChecker
checkSetAttributePermission
in interface PermissionChecker
inodePath
- the path to check permission onsuperuserRequired
- indicates whether it requires to be the superuserownerRequired
- indicates whether it requires to be the owner of this pathwriteRequired
- indicates whether it requires to have write permissionsAccessControlException
- if permission checking failsInvalidPathException
- if the path is invalidpublic void checkSuperUser() throws AccessControlException
PermissionChecker
checkSuperUser
in interface PermissionChecker
AccessControlException
- if the user is not a super userprotected void checkInodeList(String user, List<String> groups, Mode.Bits bits, String path, List<InodeView> inodeList, boolean checkIsOwner) throws AccessControlException
user
- who requests access permissiongroups
- in which user belongs tobits
- bits that capture the action Mode.Bits
by userpath
- the path to check permission oninodeList
- file info list of all the inodes retrieved by traversing the pathcheckIsOwner
- indicates whether to check the user is the owner of the pathAccessControlException
- if permission checking failsCopyright © 2023. All Rights Reserved.