一:shell执行:
grant授权:
查看commands目录下grant.rb文件:
security_admin.grant(user, permissions, table_name, family, qualifier)
进入security.rb文件执行:
org.apache.hadoop.hbase.security.access.AccessControlClient.grant( @connection, tableName, user, fambytes, qualbytes, perm.getActions())
revoke解除权限:
commands目录下revoke.rb文件:
security_admin.revoke(user, table_name, family, qualifier)
紧接着进入security.rb文件执行:
org.apache.hadoop.hbase.security.access.AccessControlClient.revoke(@connection, tableName, user, fambytes, qualbytes)
二:hbase授权:
进入AccessController服务端处理请求类,(客户端类为AccessControllerClient类;)这个类执行hbase权限操作;找到授权代码:
public void grant(RpcController controller,
AccessControlProtos.GrantRequest request,
RpcCallback<AccessControlProtos.GrantResponse> done)
核心代码块:
User.runAsLoginUser(new PrivilegedExceptionAction<Void>() {
@Override
public Void run() throws Exception {
AccessControlLists.addUserPermission(regionEnv.getConfiguration(), perm,
regionEnv.getTable(AccessControlLists.ACL_TABLE_NAME), request.getMergeExistingPermissions());
return null;
}
});
执行添加用户权限到acl表一步,进入到addUserPermission方法,存储用户