美文网首页
原创-大数据平台权限设计分享-hbase权限控制

原创-大数据平台权限设计分享-hbase权限控制

作者: 无色的叶 | 来源:发表于2019-05-15 15:03 被阅读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

    相关文章

      网友评论

          本文标题:原创-大数据平台权限设计分享-hbase权限控制

          本文链接:https://www.haomeiwen.com/subject/qovpaqtx.html