public JsonLogEntity createJsonLogEntity( org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleDeleteGroupsRequest request, org.apache.sentry.provider.db.generic.service.thrift.TAlterSentryRoleDeleteGroupsResponse response, Configuration conf) { GMAuditMetadataLogEntity gmamle = createCommonGMAMLE(conf, response.getStatus(), request.getRequestorUserName(), request.getClass().getName(), request.getComponent()); Joiner joiner = Joiner.on(","); String groups = joiner.join(request.getGroupsIterator()); gmamle.setOperationText(CommandUtil.createCmdForRoleDeleteGroup(request.getRoleName(), groups)); return gmamle; }
public JsonLogEntity createJsonLogEntity( org.apache.sentry.api.generic.thrift.TAlterSentryRoleDeleteGroupsRequest request, org.apache.sentry.api.generic.thrift.TAlterSentryRoleDeleteGroupsResponse response, Configuration conf) { GMAuditMetadataLogEntity gmamle = createCommonGMAMLE(conf, response.getStatus(), request.getRequestorUserName(), request.getClass().getName(), request.getComponent()); Joiner joiner = Joiner.on(","); String groups = joiner.join(request.getGroupsIterator()); gmamle.setOperationText(CommandUtil.createCmdForRoleDeleteGroup(request.getRoleName(), groups)); return gmamle; }
public JsonLogEntity createJsonLogEntity( TAlterSentryRoleDeleteGroupsRequest request, TAlterSentryRoleDeleteGroupsResponse response, Configuration conf) { DBAuditMetadataLogEntity hamle = createCommonHAMLE(conf, response.getStatus(), request.getRequestorUserName(), request.getClass().getName()); String groups = getGroupsStr(request.getGroupsIterator()); hamle.setOperationText(CommandUtil.createCmdForRoleDeleteGroup(request.getRoleName(), groups)); return hamle; }
public JsonLogEntity createJsonLogEntity( TAlterSentryRoleDeleteGroupsRequest request, TAlterSentryRoleDeleteGroupsResponse response, Configuration conf) { DBAuditMetadataLogEntity hamle = createCommonHAMLE(conf, response.getStatus(), request.getRequestorUserName(), request.getClass().getName()); String groups = getGroupsStr(request.getGroupsIterator()); hamle.setOperationText(CommandUtil.createCmdForRoleDeleteGroup(request.getRoleName(), groups)); return hamle; }
@Test public void testCreateCmdForRoleAddOrDeleteGroup1() { String createRoleAddGroupCmdResult = CommandUtil.createCmdForRoleAddGroup("testRole", getGroupStr(1)); String createRoleAddGroupCmdExcepted = "GRANT ROLE testRole TO GROUP testGroup1"; String createRoleDeleteGroupCmdResult = CommandUtil.createCmdForRoleDeleteGroup("testRole", getGroupStr(1)); String createRoleDeleteGroupCmdExcepted = "REVOKE ROLE testRole FROM GROUP testGroup1"; assertEquals(createRoleAddGroupCmdExcepted, createRoleAddGroupCmdResult); assertEquals(createRoleDeleteGroupCmdExcepted, createRoleDeleteGroupCmdResult); }
@Test public void testCreateCmdForRoleAddOrDeleteGroup2() { String createRoleAddGroupCmdResult = CommandUtil.createCmdForRoleAddGroup("testRole", getGroupStr(3)); String createRoleAddGroupCmdExcepted = "GRANT ROLE testRole TO GROUP testGroup1, testGroup2, testGroup3"; String createRoleDeleteGroupCmdResult = CommandUtil.createCmdForRoleDeleteGroup("testRole", getGroupStr(3)); String createRoleDeleteGroupCmdExcepted = "REVOKE ROLE testRole FROM GROUP testGroup1, testGroup2, testGroup3"; assertEquals(createRoleAddGroupCmdExcepted, createRoleAddGroupCmdResult); assertEquals(createRoleDeleteGroupCmdExcepted, createRoleDeleteGroupCmdResult); }
@Test public void testCreateCmdForRoleAddOrDeleteGroup1() { String createRoleAddGroupCmdResult = CommandUtil.createCmdForRoleAddGroup("testRole", getGroupStr(1)); String createRoleAddGroupCmdExcepted = "GRANT ROLE testRole TO GROUP testGroup1"; String createRoleDeleteGroupCmdResult = CommandUtil.createCmdForRoleDeleteGroup("testRole", getGroupStr(1)); String createRoleDeleteGroupCmdExcepted = "REVOKE ROLE testRole FROM GROUP testGroup1"; assertEquals(createRoleAddGroupCmdExcepted, createRoleAddGroupCmdResult); assertEquals(createRoleDeleteGroupCmdExcepted, createRoleDeleteGroupCmdResult); }
@Test public void testCreateCmdForRoleAddOrDeleteGroup2() { String createRoleAddGroupCmdResult = CommandUtil.createCmdForRoleAddGroup("testRole", getGroupStr(3)); String createRoleAddGroupCmdExcepted = "GRANT ROLE testRole TO GROUP testGroup1, testGroup2, testGroup3"; String createRoleDeleteGroupCmdResult = CommandUtil.createCmdForRoleDeleteGroup("testRole", getGroupStr(3)); String createRoleDeleteGroupCmdExcepted = "REVOKE ROLE testRole FROM GROUP testGroup1, testGroup2, testGroup3"; assertEquals(createRoleAddGroupCmdExcepted, createRoleAddGroupCmdResult); assertEquals(createRoleDeleteGroupCmdExcepted, createRoleDeleteGroupCmdResult); }