Class SnapshotScannerHDFSAclHelper
java.lang.Object
org.apache.hadoop.hbase.security.access.SnapshotScannerHDFSAclHelper
- All Implemented Interfaces:
Closeable,AutoCloseable
A helper to modify or remove HBase granted user default and access HDFS ACLs over hFiles.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classInner class used to describe modify or remove what type of acl entries(ACCESS, DEFAULT, ACCESS_AND_DEFAULT) for files or directories(and child files).(package private) static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringprivate Adminstatic final Stringstatic final Stringprivate final org.apache.hadoop.conf.Configurationprivate final Connectionprivate org.apache.hadoop.fs.FileSystemprivate static final org.slf4j.Loggerprivate ExecutorServicestatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionSnapshotScannerHDFSAclHelper(org.apache.hadoop.conf.Configuration configuration, Connection connection) -
Method Summary
Modifier and TypeMethodDescriptionprivate static org.apache.hadoop.fs.permission.AclEntrybooleanaddTableAcl(TableName tableName, Set<String> users, String operation) Add table user aclsprivate booleancheckUserPermission(UserPermission userPermission) voidclose()(package private) booleancontainReadAction(UserPermission userPermission) (package private) voidcreateDirIfNotExist(org.apache.hadoop.fs.Path path) (package private) voidcreateTableDirectories(TableName tableName) (package private) voiddeleteEmptyDir(org.apache.hadoop.fs.Path path) (package private) List<org.apache.hadoop.fs.Path>return paths that user will global permission will visit(package private) List<org.apache.hadoop.fs.Path>getNamespaceRootPaths(String namespace) return paths that user will namespace permission will visit(package private) SnapshotScannerHDFSAclHelper.PathHelper(package private) List<org.apache.hadoop.fs.Path>getTableRootPaths(TableName tableName, boolean includeSnapshotPath) return paths that user will table permission will visitprivate List<org.apache.hadoop.fs.Path>getTableSnapshotPaths(TableName tableName) Return users with global read permissiongetUsersWithNamespaceReadAction(String namespace, boolean includeGlobal) Return users with namespace read permissiongetUsersWithReadAction(List<UserPermission> perms) getUsersWithTableReadAction(TableName tableName, boolean includeNamespace, boolean includeGlobal) Return users with table read permissionbooleanSet acl when grant user permissionprivate voidhandleGlobalAcl(Set<String> users, Set<String> skipNamespaces, Set<TableName> skipTables, SnapshotScannerHDFSAclHelper.HDFSAclOperation.OperationType operationType) private voidhandleGrantOrRevokeAcl(UserPermission userPermission, SnapshotScannerHDFSAclHelper.HDFSAclOperation.OperationType operationType, Set<String> skipNamespaces, Set<TableName> skipTables) private CompletableFuture<Void>private CompletableFuture<Void>private CompletableFuture<Void>private voidhandleNamespaceAccessAcl(String namespace, Set<String> users, SnapshotScannerHDFSAclHelper.HDFSAclOperation.OperationType operationType) private voidhandleNamespaceAcl(Set<String> namespaces, Set<String> users, Set<String> skipNamespaces, Set<TableName> skipTables, SnapshotScannerHDFSAclHelper.HDFSAclOperation.OperationType operationType) private voidhandleTableAcl(Set<TableName> tableNames, Set<String> users, Set<String> skipNamespaces, Set<TableName> skipTables, SnapshotScannerHDFSAclHelper.HDFSAclOperation.OperationType operationType) static booleanisAclSyncToHdfsEnabled(org.apache.hadoop.conf.Configuration conf) (package private) booleanisAclSyncToHdfsEnabled(TableDescriptor tableDescriptor) (package private) booleanisNotFamilyOrQualifierPermission(TablePermission tablePermission) booleanremoveNamespaceAccessAcl(TableName tableName, Set<String> removeUsers, String operation) Remove table access acl from namespace dir when delete tablebooleanremoveNamespaceDefaultAcl(String namespace, Set<String> removeUsers) Remove default acl from namespace archive dir when delete namespacebooleanremoveTableAcl(TableName tableName, Set<String> users) Remove table acls when modify tablebooleanremoveTableDefaultAcl(TableName tableName, Set<String> removeUsers) Remove default acl from table archive dir when delete tablebooleanRemove acl when grant or revoke user permissionvoidbooleansnapshotAcl(SnapshotDescription snapshot) Set acl when take a snapshot
-
Field Details
-
LOG
-
ACL_SYNC_TO_HDFS_ENABLE
- See Also:
-
ACL_SYNC_TO_HDFS_THREAD_NUMBER
- See Also:
-
SNAPSHOT_RESTORE_TMP_DIR
- See Also:
-
SNAPSHOT_RESTORE_TMP_DIR_DEFAULT
- See Also:
-
COMMON_DIRECTORY_PERMISSION
- See Also:
-
COMMON_DIRECTORY_PERMISSION_DEFAULT
- See Also:
-
SNAPSHOT_RESTORE_DIRECTORY_PERMISSION
- See Also:
-
SNAPSHOT_RESTORE_DIRECTORY_PERMISSION_DEFAULT
- See Also:
-
admin
-
conf
-
conn
-
fs
-
pathHelper
-
pool
-
-
Constructor Details
-
SnapshotScannerHDFSAclHelper
public SnapshotScannerHDFSAclHelper(org.apache.hadoop.conf.Configuration configuration, Connection connection) throws IOException - Throws:
IOException
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
setCommonDirectoryPermission
- Throws:
IOException
-
grantAcl
public boolean grantAcl(UserPermission userPermission, Set<String> skipNamespaces, Set<TableName> skipTables) Set acl when grant user permission- Parameters:
userPermission- the user and permissionskipNamespaces- the namespace set to skip set acl because already setskipTables- the table set to skip set acl because already set- Returns:
- false if an error occurred, otherwise true
-
revokeAcl
public boolean revokeAcl(UserPermission userPermission, Set<String> skipNamespaces, Set<TableName> skipTables) Remove acl when grant or revoke user permission- Parameters:
userPermission- the user and permissionskipNamespaces- the namespace set to skip remove aclskipTables- the table set to skip remove acl- Returns:
- false if an error occurred, otherwise true
-
snapshotAcl
Set acl when take a snapshot- Parameters:
snapshot- the snapshot desc- Returns:
- false if an error occurred, otherwise true
-
removeNamespaceAccessAcl
public boolean removeNamespaceAccessAcl(TableName tableName, Set<String> removeUsers, String operation) Remove table access acl from namespace dir when delete table- Parameters:
tableName- the tableremoveUsers- the users whose access acl will be removed- Returns:
- false if an error occurred, otherwise true
-
removeNamespaceDefaultAcl
Remove default acl from namespace archive dir when delete namespace- Parameters:
namespace- the namespaceremoveUsers- the users whose default acl will be removed- Returns:
- false if an error occurred, otherwise true
-
removeTableDefaultAcl
Remove default acl from table archive dir when delete table- Parameters:
tableName- the table nameremoveUsers- the users whose default acl will be removed- Returns:
- false if an error occurred, otherwise true
-
addTableAcl
Add table user acls- Parameters:
tableName- the tableusers- the table users with READ permission- Returns:
- false if an error occurred, otherwise true
-
removeTableAcl
Remove table acls when modify table- Parameters:
tableName- the tableusers- the table users with READ permission- Returns:
- false if an error occurred, otherwise true
-
handleGrantOrRevokeAcl
private void handleGrantOrRevokeAcl(UserPermission userPermission, SnapshotScannerHDFSAclHelper.HDFSAclOperation.OperationType operationType, Set<String> skipNamespaces, Set<TableName> skipTables) throws ExecutionException, InterruptedException, IOException -
handleGlobalAcl
private void handleGlobalAcl(Set<String> users, Set<String> skipNamespaces, Set<TableName> skipTables, SnapshotScannerHDFSAclHelper.HDFSAclOperation.OperationType operationType) throws ExecutionException, InterruptedException, IOException -
handleNamespaceAcl
private void handleNamespaceAcl(Set<String> namespaces, Set<String> users, Set<String> skipNamespaces, Set<TableName> skipTables, SnapshotScannerHDFSAclHelper.HDFSAclOperation.OperationType operationType) throws ExecutionException, InterruptedException, IOException -
handleTableAcl
private void handleTableAcl(Set<TableName> tableNames, Set<String> users, Set<String> skipNamespaces, Set<TableName> skipTables, SnapshotScannerHDFSAclHelper.HDFSAclOperation.OperationType operationType) throws ExecutionException, InterruptedException, IOException -
handleNamespaceAccessAcl
private void handleNamespaceAccessAcl(String namespace, Set<String> users, SnapshotScannerHDFSAclHelper.HDFSAclOperation.OperationType operationType) throws ExecutionException, InterruptedException -
createTableDirectories
- Throws:
IOException
-
getGlobalRootPaths
List<org.apache.hadoop.fs.Path> getGlobalRootPaths()return paths that user will global permission will visit- Returns:
- the path list
-
getNamespaceRootPaths
return paths that user will namespace permission will visit- Parameters:
namespace- the namespace- Returns:
- the path list
-
getTableRootPaths
List<org.apache.hadoop.fs.Path> getTableRootPaths(TableName tableName, boolean includeSnapshotPath) throws IOException return paths that user will table permission will visit- Parameters:
tableName- the tableincludeSnapshotPath- true if return table snapshots paths, otherwise false- Returns:
- the path list
- Throws:
IOException- if an error occurred
-
getTableSnapshotPaths
private List<org.apache.hadoop.fs.Path> getTableSnapshotPaths(TableName tableName) throws IOException - Throws:
IOException
-
getUsersWithGlobalReadAction
Return users with global read permission- Returns:
- users with global read permission
- Throws:
IOException- if an error occurred
-
getUsersWithNamespaceReadAction
Set<String> getUsersWithNamespaceReadAction(String namespace, boolean includeGlobal) throws IOException Return users with namespace read permission- Parameters:
namespace- the namespaceincludeGlobal- true if include users with global read action- Returns:
- users with namespace read permission
- Throws:
IOException- if an error occurred
-
getUsersWithTableReadAction
Set<String> getUsersWithTableReadAction(TableName tableName, boolean includeNamespace, boolean includeGlobal) throws IOException Return users with table read permission- Parameters:
tableName- the tableincludeNamespace- true if include users with namespace read actionincludeGlobal- true if include users with global read action- Returns:
- users with table read permission
- Throws:
IOException- if an error occurred
-
getUsersWithReadAction
-
checkUserPermission
-
containReadAction
-
isNotFamilyOrQualifierPermission
-
isAclSyncToHdfsEnabled
-
isAclSyncToHdfsEnabled
-
getPathHelper
-
handleHDFSAcl
-
handleHDFSAclSequential
private CompletableFuture<Void> handleHDFSAclSequential(List<SnapshotScannerHDFSAclHelper.HDFSAclOperation> operations) -
handleHDFSAclParallel
private CompletableFuture<Void> handleHDFSAclParallel(List<SnapshotScannerHDFSAclHelper.HDFSAclOperation> operations) -
aclEntry
-
createDirIfNotExist
- Throws:
IOException
-
deleteEmptyDir
- Throws:
IOException
-