原创-大数据平台权限设计分享-hbase权限控制
2019-05-15 本文已影响0人
无色的叶
hbase权限实现是基于hbase自身ACL控制实现的,只是进行了一层web包装,可通过界面友好进行控制
@Override
public void grantToTable(String tableName, String userName, Permission.Action... actions) throws Throwable {
grantToTable(tableName, userName, null, null, actions);
}
@Override
public void grantToTable(String tableName, String userName, String family, String qual, Permission.Action... actions) throws Throwable {
byte[] familyByte = !StringTools.hasText(family) ? null : Bytes.toBytes(family);
byte[] qualByte = !StringTools.hasText(qual) ? null : Bytes.toBytes(qual);
AccessControlClient.grant(connection, TableName.valueOf(tableName), userName, familyByte, qualByte, actions);
}
@Override
public void grantToNameSpace(String namespace, String userName, Permission.Action... actions) throws Throwable {
AccessControlClient.grant(connection, namespace, userName, actions);
}
@Override
public void revokeToTable(String tableName, String userName, Permission.Action... actions) throws Throwable {
revokeToTable(tableName, userName, null, null, actions);
}
@Override
public void revokeToTable(String tableName, String userName, String family, String qual, Permission.Action... actions) throws Throwable {
byte[] familyByte = !StringTools.hasText(family) ? null : Bytes.toBytes(family);
byte[] qualByte = !StringTools.hasText(qual) ? null : Bytes.toBytes(qual);
AccessControlClient.revoke(connection, TableName.valueOf(tableName), userName, familyByte, qualByte, actions);
}
@Override
public void revokeToNameSpace(String namespace, String userName, Permission.Action... actions) throws Throwable {
AccessControlClient.revoke(connection, namespace, userName, actions);
}
权限类型分为,read,write,excute,create,admin类型
image.png