Skip to content

Commit

Permalink
Add INSERT and DELETE to GRANT/REVOKE tests
Browse files Browse the repository at this point in the history
  • Loading branch information
raunaqmorarka authored and kokosing committed Jun 22, 2021
1 parent 9edca85 commit 96502ac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,9 @@ public static Object[][] privileges()
{
return new Object[][] {
{"SELECT"},
{"INSERT"},
{"UPDATE"},
{"DELETE"},
{"ALL PRIVILEGES"}
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public class TestRevokeOnTable
private static final Session admin = sessionOf("admin");
private static final Session userWithAllPrivileges = sessionOf(randomUsername());
private static final Session userWithSelect = sessionOf(randomUsername());
private static final Session userWithInsert = sessionOf(randomUsername());
private static final Session userWithUpdate = sessionOf(randomUsername());
private static final Session userWithDelete = sessionOf(randomUsername());
private DistributedQueryRunner queryRunner;
private QueryAssertions assertions;

Expand All @@ -60,7 +62,9 @@ public void initClass()
tableGrants.grant(new TrinoPrincipal(USER, admin.getUser()), table, EnumSet.allOf(Privilege.class), true);
tableGrants.grant(new TrinoPrincipal(USER, userWithAllPrivileges.getUser()), table, EnumSet.allOf(Privilege.class), true);
tableGrants.grant(new TrinoPrincipal(USER, userWithSelect.getUser()), table, ImmutableSet.of(Privilege.SELECT), true);
tableGrants.grant(new TrinoPrincipal(USER, userWithInsert.getUser()), table, ImmutableSet.of(Privilege.INSERT), true);
tableGrants.grant(new TrinoPrincipal(USER, userWithUpdate.getUser()), table, ImmutableSet.of(Privilege.UPDATE), true);
tableGrants.grant(new TrinoPrincipal(USER, userWithDelete.getUser()), table, ImmutableSet.of(Privilege.DELETE), true);
MockConnectorFactory connectorFactory = MockConnectorFactory.builder()
.withListSchemaNames(session -> ImmutableList.of("default"))
.withListTables((session, schemaName) -> "default".equalsIgnoreCase(schemaName) ? ImmutableList.of(table) : ImmutableList.of())
Expand Down Expand Up @@ -125,7 +129,9 @@ public static Object[][] privilegesAndUsers()
{
return new Object[][] {
{"SELECT", userWithSelect},
{"INSERT", userWithInsert},
{"UPDATE", userWithUpdate},
{"DELETE", userWithDelete},
{"ALL PRIVILEGES", userWithAllPrivileges}
};
}
Expand All @@ -135,7 +141,9 @@ public static Object[][] privileges()
{
return new Object[][] {
{"SELECT"},
{"INSERT"},
{"UPDATE"},
{"DELETE"},
{"ALL PRIVILEGES"}
};
}
Expand Down

0 comments on commit 96502ac

Please sign in to comment.