Class ShadedAccessControlUtil
java.lang.Object
org.apache.hadoop.hbase.security.access.ShadedAccessControlUtil
Convert protobuf objects in AccessControl.proto under hbase-protocol-shaded to user-oriented
objects and vice versa.
In HBASE-15638, we create a hbase-protocol-shaded module for upgrading protobuf version to 3.x, but there are still some coprocessor endpoints(such as AccessControl, Authentication, MulitRowMutation) which depend on hbase-protocol module for CPEP compatibility. In fact, we use PB objects in AccessControl.proto under hbase-protocol for access control logic and use shaded AccessControl.proto only for serializing/deserializing permissions of .snapshotinfo.
In HBASE-15638, we create a hbase-protocol-shaded module for upgrading protobuf version to 3.x, but there are still some coprocessor endpoints(such as AccessControl, Authentication, MulitRowMutation) which depend on hbase-protocol module for CPEP compatibility. In fact, we use PB objects in AccessControl.proto under hbase-protocol for access control logic and use shaded AccessControl.proto only for serializing/deserializing permissions of .snapshotinfo.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.GetUserPermissionsRequest
static org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.GetUserPermissionsResponse
buildGetUserPermissionsResponse
(List<UserPermission> permissions) static org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.GrantRequest
buildGrantRequest
(UserPermission userPermission, boolean mergeExistingPermissions) static org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.HasUserPermissionsRequest
buildHasUserPermissionsRequest
(String userName, List<Permission> permissions) static org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.RevokeRequest
buildRevokeRequest
(UserPermission userPermission) static org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.Permission
toPermission
(Permission perm) Convert a client Permission to a Permission shaded protostatic Permission
toPermission
(org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.Permission proto) Converts a Permission shaded proto to a client TablePermission object.static org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.Permission.Action
toPermissionAction
(Permission.Action action) Convert a client user permission to a user permission shaded proto.static Permission.Action
toPermissionAction
(org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.Permission.Action action) Convert a Permission.Action shaded proto to a client Permission.Action object.static Permission.Action[]
toPermissionActions
(List<org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.Permission.Action> protoActions) Converts a list of Permission.Action shaded proto to an array of client Permission.Action objects.static org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName
toProtoTableName
(TableName tableName) static TableName
toTableName
(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName tableNamePB) static org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.UserPermission
Convert a client user permission to a user permission protostatic UserPermission
toUserPermission
(org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.UserPermission proto) Converts a user permission proto to a client user permission object.static org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap<String,
Permission> toUserTablePermissions
(org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.UsersAndPermissions proto) Convert a shaded protobuf UserTablePermissions to a ListMultimap<String, TablePermission> where key is username.static org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.UsersAndPermissions
toUserTablePermissions
(org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap<String, UserPermission> perm) Convert a ListMultimap<String, TablePermission> where key is username to a shaded protobuf UserPermission
-
Constructor Details
-
ShadedAccessControlUtil
public ShadedAccessControlUtil()
-
-
Method Details
-
toPermissionAction
public static org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.Permission.Action toPermissionAction(Permission.Action action) Convert a client user permission to a user permission shaded proto. -
toPermissionAction
public static Permission.Action toPermissionAction(org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.Permission.Action action) Convert a Permission.Action shaded proto to a client Permission.Action object. -
toPermissionActions
public static Permission.Action[] toPermissionActions(List<org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.Permission.Action> protoActions) Converts a list of Permission.Action shaded proto to an array of client Permission.Action objects.- Parameters:
protoActions
- the list of shaded protobuf Actions- Returns:
- the converted array of Actions
-
toTableName
public static TableName toTableName(org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName tableNamePB) -
toProtoTableName
public static org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.TableName toProtoTableName(TableName tableName) -
toPermission
public static Permission toPermission(org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.Permission proto) Converts a Permission shaded proto to a client TablePermission object.- Parameters:
proto
- the protobuf Permission- Returns:
- the converted TablePermission
-
toPermission
public static org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.Permission toPermission(Permission perm) Convert a client Permission to a Permission shaded proto- Parameters:
perm
- the client Permission- Returns:
- the protobuf Permission
-
toUserTablePermissions
public static org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap<String,Permission> toUserTablePermissions(org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.UsersAndPermissions proto) Convert a shaded protobuf UserTablePermissions to a ListMultimap<String, TablePermission> where key is username.- Parameters:
proto
- the protobuf UserPermission- Returns:
- the converted UserPermission
-
toUserTablePermissions
public static org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.UsersAndPermissions toUserTablePermissions(org.apache.hbase.thirdparty.com.google.common.collect.ListMultimap<String, UserPermission> perm) Convert a ListMultimap<String, TablePermission> where key is username to a shaded protobuf UserPermission- Parameters:
perm
- the list of user and table permissions- Returns:
- the protobuf UserTablePermissions
-
toUserPermission
public static UserPermission toUserPermission(org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.UserPermission proto) Converts a user permission proto to a client user permission object.- Parameters:
proto
- the protobuf UserPermission- Returns:
- the converted UserPermission
-
toUserPermission
public static org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.UserPermission toUserPermission(UserPermission perm) Convert a client user permission to a user permission proto- Parameters:
perm
- the client UserPermission- Returns:
- the protobuf UserPermission
-
buildGrantRequest
public static org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.GrantRequest buildGrantRequest(UserPermission userPermission, boolean mergeExistingPermissions) -
buildRevokeRequest
public static org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.RevokeRequest buildRevokeRequest(UserPermission userPermission) -
buildGetUserPermissionsRequest
public static org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.GetUserPermissionsRequest buildGetUserPermissionsRequest(GetUserPermissionsRequest request) -
buildGetUserPermissionsResponse
public static org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.GetUserPermissionsResponse buildGetUserPermissionsResponse(List<UserPermission> permissions) -
buildHasUserPermissionsRequest
public static org.apache.hadoop.hbase.shaded.protobuf.generated.AccessControlProtos.HasUserPermissionsRequest buildHasUserPermissionsRequest(String userName, List<Permission> permissions)
-