You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "li xiang (JIRA)" <ji...@apache.org> on 2016/05/17 13:15:13 UTC
[jira] [Updated] (HBASE-15465) userPermission returned by
getUserPermission() for the selected namespace does not have namespace set
[ https://issues.apache.org/jira/browse/HBASE-15465?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
li xiang updated HBASE-15465:
-----------------------------
Attachment: HBASE-15465.patch.v0
The patch v0 is based on the initial version from Jerry He.
> userPermission returned by getUserPermission() for the selected namespace does not have namespace set
> -----------------------------------------------------------------------------------------------------
>
> Key: HBASE-15465
> URL: https://issues.apache.org/jira/browse/HBASE-15465
> Project: HBase
> Issue Type: Bug
> Components: Protobufs
> Affects Versions: 1.2.0
> Reporter: li xiang
> Assignee: li xiang
> Priority: Minor
> Attachments: HBASE-15465.patch.v0
>
>
> The request sent is with type = Namespace, but the response returned contains Global permissions (that is, the field of namespace is not set)
> It is in hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java, from line 2380, and I made some comments into it
> {code}
> /**
> * A utility used to get permissions for selected namespace.
> * <p>
> * It's also called by the shell, in case you want to find references.
> *
> * @param protocol the AccessControlService protocol proxy
> * @param namespace name of the namespace
> * @throws ServiceException
> */
> public static List<UserPermission> getUserPermissions(
> AccessControlService.BlockingInterface protocol,
> byte[] namespace) throws ServiceException {
> AccessControlProtos.GetUserPermissionsRequest.Builder builder =
> AccessControlProtos.GetUserPermissionsRequest.newBuilder();
> if (namespace != null) {
> builder.setNamespaceName(ByteStringer.wrap(namespace));
> }
> builder.setType(AccessControlProtos.Permission.Type.Namespace); //builder is set with type = Namespace
> AccessControlProtos.GetUserPermissionsRequest request = builder.build(); //I printed the request, its type is Namespace, which is correct.
> AccessControlProtos.GetUserPermissionsResponse response =
> protocol.getUserPermissions(null, request);
> /* I printed the response, it contains Global permissions, as below, not a Namespace permission.
> user_permission {
> user: "a1"
> permission {
> type: Global
> global_permission {
> action: READ
> action: WRITE
> action: ADMIN
> action: EXEC
> action: CREATE
> }
> }
> }
> AccessControlProtos.GetUserPermissionsRequest has a member called type_ to store the type, but AccessControlProtos.GetUserPermissionsResponse does not.
> */
>
> List<UserPermission> perms = new ArrayList<UserPermission>(response.getUserPermissionCount());
> for (AccessControlProtos.UserPermission perm: response.getUserPermissionList()) {
> perms.add(ProtobufUtil.toUserPermission(perm)); // (1)
> }
> return perms;
> }
> {code}
> it could be more reasonable to return user permissions with namespace set in getUserPermission() for selected namespace ?
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)