public static AccessControlProtos.GetUserPermissionsRequest
    buildGetUserPermissionsRequest(GetUserPermissionsRequest request) {
    AccessControlProtos.GetUserPermissionsRequest.Builder builder =
      AccessControlProtos.GetUserPermissionsRequest.newBuilder();
    if (request.getUserName() != null && !request.getUserName().isEmpty()) {
      builder.setUserName(ByteString.copyFromUtf8(request.getUserName()));
    }
    if (request.getNamespace() != null && !request.getNamespace().isEmpty()) {
      builder.setNamespaceName(ByteString.copyFromUtf8(request.getNamespace()));
      builder.setType(AccessControlProtos.Permission.Type.Namespace);
    }
    if (request.getTableName() != null) {
      builder.setTableName(toProtoTableName(request.getTableName()));
      builder.setType(AccessControlProtos.Permission.Type.Table);
    }
    if (!builder.hasType()) {
      builder.setType(AccessControlProtos.Permission.Type.Global);
    }
    if (request.getFamily() != null && request.getFamily().length > 0) {
      builder.setColumnFamily(ByteString.copyFrom(request.getFamily()));
    }
    if (request.getQualifier() != null && request.getQualifier().length > 0) {
      builder.setColumnQualifier(ByteString.copyFrom(request.getQualifier()));
    }
    return builder.build();
  }
Convert a client user permission to a user permission proto
@param perm the client UserPermission
@return the protobuf UserPermission
hbase-client/src/main/java/org/apache/hadoop/hbase/security/access/ShadedAccessControlUtil.java