-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Grant permissions on
team_members
table (#2226)
* feat: Grant permissions on team_members table * fix: Grant access to users table
- Loading branch information
1 parent
9c77d09
commit 5a2c937
Showing
3 changed files
with
115 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
const { introspectAs } = require("./utils"); | ||
|
||
describe("team_members", () => { | ||
describe("public", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("public"); | ||
}); | ||
|
||
test("cannot query teams", () => { | ||
expect(i.queries).not.toContain("team_members"); | ||
}); | ||
|
||
test("cannot create, update, or delete team_members", () => { | ||
expect(i).toHaveNoMutationsFor("team_members"); | ||
}); | ||
}); | ||
|
||
describe("admin", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("admin"); | ||
}); | ||
|
||
test("has full access to query and mutate team_members", () => { | ||
expect(i.queries).toContain("team_members"); | ||
expect(i.mutations).toContain("insert_team_members"); | ||
expect(i.mutations).toContain("update_team_members_by_pk"); | ||
expect(i.mutations).toContain("delete_team_members"); | ||
}); | ||
}); | ||
|
||
describe("platformAdmin", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("platformAdmin"); | ||
}); | ||
|
||
test("has full access to query and mutate team_members", () => { | ||
expect(i.queries).toContain("team_members"); | ||
expect(i.mutations).toContain("insert_team_members"); | ||
expect(i.mutations).toContain("update_team_members_by_pk"); | ||
expect(i.mutations).toContain("delete_team_members"); | ||
}); | ||
}); | ||
|
||
describe("teamEditor", () => { | ||
beforeAll(async () => { | ||
i = await introspectAs("teamEditor"); | ||
}); | ||
|
||
// Row-level permissions tested in e2e/tests/api-driven | ||
// teamEditors can only query their own record | ||
test("can query teams", () => { | ||
expect(i.queries).toContain("team_members"); | ||
}); | ||
|
||
test("cannot create, update, or delete team_members", () => { | ||
expect(i).toHaveNoMutationsFor("team_members"); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters