-
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: add demoUser role to Hasura with permissions (#3852)
- Loading branch information
Showing
27 changed files
with
1,138 additions
and
365 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
hasura.planx.uk/migrations/1729675271585_insert_into_public_user_roles/down.sql
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 @@ | ||
DELETE FROM "public"."user_roles" WHERE "value" = 'demoUser'; |
1 change: 1 addition & 0 deletions
1
hasura.planx.uk/migrations/1729675271585_insert_into_public_user_roles/up.sql
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 @@ | ||
INSERT INTO "public"."user_roles"("value") VALUES (E'demoUser'); |
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
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
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 |
---|---|---|
@@ -1,92 +1,107 @@ | ||
const { introspectAs } = require("./utils"); | ||
|
||
describe("feedback_status_enum", () => { | ||
describe("public", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("public"); | ||
}); | ||
|
||
test("cannot INSERT records", () => { | ||
expect(i.mutations).not.toContain("insert_feedback_status_enum"); | ||
}); | ||
|
||
test("cannot QUERY records", () => { | ||
expect(i.queries).not.toContain("feedback_status_enum"); | ||
}); | ||
|
||
test("cannot DELETE records", () => { | ||
expect(i.mutations).not.toContain("delete_feedback_status_enum"); | ||
}); | ||
|
||
test("cannot UPDATE records", () => { | ||
expect(i.mutations).not.toContain("update_feedback_status_enum"); | ||
}); | ||
}); | ||
|
||
describe("admin", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("admin"); | ||
}); | ||
|
||
test("has full access to query and mutate feedback_status_enum", async () => { | ||
expect(i.queries).toContain("feedback_status_enum"); | ||
expect(i.mutations).toContain("insert_feedback_status_enum"); | ||
expect(i.mutations).toContain("delete_feedback_status_enum"); | ||
}); | ||
}); | ||
|
||
describe("platformAdmin", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("platformAdmin"); | ||
}); | ||
|
||
test("cannot query feedback_status_enum", () => { | ||
expect(i.queries).not.toContain("feedback_status_enum"); | ||
}); | ||
|
||
test("cannot create, update, or delete feedback_status_enum", () => { | ||
expect(i).toHaveNoMutationsFor("feedback_status_enum"); | ||
}); | ||
}); | ||
|
||
describe("teamEditor", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("teamEditor"); | ||
}); | ||
|
||
test("cannot query feedback_status_enum", () => { | ||
expect(i.queries).not.toContain("feedback_status_enum"); | ||
}); | ||
|
||
test("cannot create, update, or delete feedback_status_enum", () => { | ||
expect(i).toHaveNoMutationsFor("feedback_status_enum"); | ||
}); | ||
}); | ||
|
||
describe("api", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("api"); | ||
}); | ||
|
||
test("cannot INSERT records", () => { | ||
expect(i.mutations).not.toContain("insert_feedback_status_enum"); | ||
}); | ||
|
||
test("cannot QUERY records", () => { | ||
expect(i.queries).not.toContain("feedback_status_enum"); | ||
}); | ||
|
||
test("cannot DELETE records", () => { | ||
expect(i.mutations).not.toContain("delete_feedback_status_enum"); | ||
}); | ||
|
||
test("cannot UPDATE records", () => { | ||
expect(i.mutations).not.toContain("update_feedback_status_enum"); | ||
}); | ||
}); | ||
}); | ||
describe("public", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("public"); | ||
}); | ||
|
||
test("cannot INSERT records", () => { | ||
expect(i.mutations).not.toContain("insert_feedback_status_enum"); | ||
}); | ||
|
||
test("cannot QUERY records", () => { | ||
expect(i.queries).not.toContain("feedback_status_enum"); | ||
}); | ||
|
||
test("cannot DELETE records", () => { | ||
expect(i.mutations).not.toContain("delete_feedback_status_enum"); | ||
}); | ||
|
||
test("cannot UPDATE records", () => { | ||
expect(i.mutations).not.toContain("update_feedback_status_enum"); | ||
}); | ||
}); | ||
|
||
describe("admin", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("admin"); | ||
}); | ||
|
||
test("has full access to query and mutate feedback_status_enum", async () => { | ||
expect(i.queries).toContain("feedback_status_enum"); | ||
expect(i.mutations).toContain("insert_feedback_status_enum"); | ||
expect(i.mutations).toContain("delete_feedback_status_enum"); | ||
}); | ||
}); | ||
|
||
describe("platformAdmin", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("platformAdmin"); | ||
}); | ||
|
||
test("cannot query feedback_status_enum", () => { | ||
expect(i.queries).not.toContain("feedback_status_enum"); | ||
}); | ||
|
||
test("cannot create, update, or delete feedback_status_enum", () => { | ||
expect(i).toHaveNoMutationsFor("feedback_status_enum"); | ||
}); | ||
}); | ||
|
||
describe("teamEditor", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("teamEditor"); | ||
}); | ||
|
||
test("cannot query feedback_status_enum", () => { | ||
expect(i.queries).not.toContain("feedback_status_enum"); | ||
}); | ||
|
||
test("cannot create, update, or delete feedback_status_enum", () => { | ||
expect(i).toHaveNoMutationsFor("feedback_status_enum"); | ||
}); | ||
}); | ||
|
||
describe("demoUser", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("demoUser"); | ||
}); | ||
|
||
test("cannot query feedback_status_enum", () => { | ||
expect(i.queries).not.toContain("feedback_status_enum"); | ||
}); | ||
|
||
test("cannot create, update, or delete feedback_status_enum", () => { | ||
expect(i).toHaveNoMutationsFor("feedback_status_enum"); | ||
}); | ||
}); | ||
|
||
describe("api", () => { | ||
let i; | ||
beforeAll(async () => { | ||
i = await introspectAs("api"); | ||
}); | ||
|
||
test("cannot INSERT records", () => { | ||
expect(i.mutations).not.toContain("insert_feedback_status_enum"); | ||
}); | ||
|
||
test("cannot QUERY records", () => { | ||
expect(i.queries).not.toContain("feedback_status_enum"); | ||
}); | ||
|
||
test("cannot DELETE records", () => { | ||
expect(i.mutations).not.toContain("delete_feedback_status_enum"); | ||
}); | ||
|
||
test("cannot UPDATE records", () => { | ||
expect(i.mutations).not.toContain("update_feedback_status_enum"); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.