Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Analytics column permissions #2403

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions hasura.planx.uk/metadata/tables.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@
columns:
- id
filter: {}
update_permissions:
- role: public
permission:
columns:
- ended_at
filter: {}
check: null
- table:
schema: public
name: analytics_logs
Expand All @@ -42,6 +49,7 @@
- analytics_id
- created_at
- id
- user_exit
filter: {}
update_permissions:
- role: public
Expand All @@ -51,6 +59,7 @@
- has_clicked_help
- metadata
- next_log_created_at
- user_exit
filter: {}
check: null
- table:
Expand Down
14 changes: 10 additions & 4 deletions hasura.planx.uk/tests/analytics.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@ describe("analytics and analytics_logs", () => {
expect(i.queries).toContain("analytics_logs");
});

test("can create analytics but not update or delete them", () => {
test("can create analytics", () => {
expect(i.mutations).toContain("insert_analytics_one");
expect(i.mutations).not.toContain("update_analytics_by_pk");
expect(i.mutations).not.toContain("update_analytics");
});

test("can update analytics", () => {
expect(i.mutations).toContain("update_analytics_by_pk");
expect(i.mutations).toContain("update_analytics");
});

test("cannot delete analytics", () => {
expect(i.mutations).not.toContain("delete_analytics");
expect(i.mutations).not.toContain("delete_analytics_by_pk");
});
Expand All @@ -25,7 +31,7 @@ describe("analytics and analytics_logs", () => {
expect(i.mutations).toContain("update_analytics_logs_by_pk");
expect(i.mutations).not.toContain("delete_analytics_logs");
expect(i.mutations).not.toContain("delete_analytics_logs_by_pk");
})
});
});

describe("admin", () => {
Expand Down
Loading