/** * Grants permissions on a table. * @param ddlExecutor the {@link HBaseDDLExecutor} to use to communicate with HBase * @param tableId {@link TableId} for the specified table * @param permissions A map from user or group name to the permissions for that user or group, given as a string * containing only characters 'a'(Admin), 'c'(Create), 'r'(Read), 'w'(Write), and 'x'(Execute). * Group names must be prefixed with the character '@'. * @throws IOException */ public void grantPermissions(HBaseDDLExecutor ddlExecutor, TableId tableId, Map<String, String> permissions) throws IOException { TableName tableName = HTableNameConverter.toTableName(getTablePrefix(cConf), tableId); ddlExecutor.grantPermissions(tableName.getNamespaceAsString(), tableName.getQualifierAsString(), permissions); }
/** * Grants permissions on a table. * @param ddlExecutor the {@link HBaseDDLExecutor} to use to communicate with HBase * @param tableId {@link TableId} for the specified table * @param permissions A map from user or group name to the permissions for that user or group, given as a string * containing only characters 'a'(Admin), 'c'(Create), 'r'(Read), 'w'(Write), and 'x'(Execute). * Group names must be prefixed with the character '@'. * @throws IOException */ public void grantPermissions(HBaseDDLExecutor ddlExecutor, TableId tableId, Map<String, String> permissions) throws IOException { TableName tableName = HTableNameConverter.toTableName(getTablePrefix(cConf), tableId); ddlExecutor.grantPermissions(tableName.getNamespaceAsString(), tableName.getQualifierAsString(), permissions); }
if (namespaceMeta.getConfig().getGroupName() != null) { try { executor.grantPermissions(hbaseNamespace, null, ImmutableMap.of("@" + namespaceMeta.getConfig().getGroupName(), "C")); } catch (IOException | RuntimeException e) {
if (namespaceMeta.getConfig().getGroupName() != null) { try { executor.grantPermissions(hbaseNamespace, null, ImmutableMap.of("@" + namespaceMeta.getConfig().getGroupName(), "C")); } catch (IOException | RuntimeException e) {
ddlExecutor.grantPermissions(tableId.getNamespace(), null, ImmutableMap.of("joe", "iii")); Assert.fail("Grant should have failed with invalid permissions"); } catch (IOException e) { ddlExecutor.grantPermissions(tableId.getNamespace(), null, ImmutableMap.of("joe", "RX", "@readers", "CA"));