sentry icon indicating copy to clipboard operation
sentry copied to clipboard

Add New Dashboards Permissions Model

Open harshithadurai opened this issue 1 year ago • 2 comments

#78550

Migration for adding a new Dashboard Permissions Model that will contain information on sharing and edit permissions for a dashboard.

This PR adds only a is_creator_only_editable field to handle creator-only access to dashboards. The plan is to use this permissions model to handle team-based dashboard access as well as sharing dashboards externally.

harshithadurai avatar Oct 04 '24 16:10 harshithadurai

This PR has a migration; here is the generated SQL for src/sentry/migrations/0773_add_dashboards_permissions_model.py ()

--
-- Create model DashboardPermissions
--
CREATE TABLE "sentry_dashboardpermissions" ("id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "created_by_id" bigint NOT NULL, "is_creator_only_editable" boolean NOT NULL);
CREATE INDEX CONCURRENTLY "sentry_dashboardpermissions_created_by_id_b4f175eb" ON "sentry_dashboardpermissions" ("created_by_id");
--
-- Add field permissions to dashboard
--
ALTER TABLE "sentry_dashboard" ADD COLUMN "permissions_id" bigint NULL;
CREATE UNIQUE INDEX CONCURRENTLY "sentry_dashboard_permissions_id_be5afc4a_uniq" ON "sentry_dashboard" ("permissions_id");
ALTER TABLE "sentry_dashboard" ADD CONSTRAINT "sentry_dashboard_permissions_id_be5afc4a_uniq" UNIQUE USING INDEX "sentry_dashboard_permissions_id_be5afc4a_uniq";
ALTER TABLE "sentry_dashboard" ADD CONSTRAINT "sentry_dashboard_permissions_id_be5afc4a_fk_sentry_da" FOREIGN KEY ("permissions_id") REFERENCES "sentry_dashboardpermissions" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_dashboard" VALIDATE CONSTRAINT "sentry_dashboard_permissions_id_be5afc4a_fk_sentry_da";

github-actions[bot] avatar Oct 04 '24 16:10 github-actions[bot]

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

:white_check_mark: All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #78618      +/-   ##
==========================================
- Coverage   78.28%   78.27%   -0.01%     
==========================================
  Files        7126     7110      -16     
  Lines      313567   313268     -299     
  Branches    51180    51133      -47     
==========================================
- Hits       245486   245225     -261     
- Misses      61652    61687      +35     
+ Partials     6429     6356      -73     

codecov[bot] avatar Oct 04 '24 16:10 codecov[bot]

This PR has a migration; here is the generated SQL for src/sentry/migrations/0774_add_dashboard_permissions_model.py ()

--
-- Create model DashboardPermissions
--
CREATE TABLE "sentry_dashboardpermissions" ("id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "is_creator_only_editable" boolean NOT NULL);
--
-- Add field permissions to dashboard
--
ALTER TABLE "sentry_dashboard" ADD COLUMN "permissions_id" bigint NULL;
CREATE UNIQUE INDEX CONCURRENTLY "sentry_dashboard_permissions_id_be5afc4a_uniq" ON "sentry_dashboard" ("permissions_id");
ALTER TABLE "sentry_dashboard" ADD CONSTRAINT "sentry_dashboard_permissions_id_be5afc4a_uniq" UNIQUE USING INDEX "sentry_dashboard_permissions_id_be5afc4a_uniq";
ALTER TABLE "sentry_dashboard" ADD CONSTRAINT "sentry_dashboard_permissions_id_be5afc4a_fk_sentry_da" FOREIGN KEY ("permissions_id") REFERENCES "sentry_dashboardpermissions" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_dashboard" VALIDATE CONSTRAINT "sentry_dashboard_permissions_id_be5afc4a_fk_sentry_da";

github-actions[bot] avatar Oct 08 '24 20:10 github-actions[bot]

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

github-actions[bot] avatar Oct 09 '24 14:10 github-actions[bot]

This PR has a migration; here is the generated SQL for src/sentry/migrations/0775_add_dashboard_permissions_model.py ()

--
-- Create model DashboardPermissions
--
CREATE TABLE "sentry_dashboardpermissions" ("id" bigint NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY, "is_creator_only_editable" boolean NOT NULL, "dashboard_id" bigint NOT NULL UNIQUE);
ALTER TABLE "sentry_dashboardpermissions" ADD CONSTRAINT "sentry_dashboardperm_dashboard_id_6f51915b_fk_sentry_da" FOREIGN KEY ("dashboard_id") REFERENCES "sentry_dashboard" ("id") DEFERRABLE INITIALLY DEFERRED NOT VALID;
ALTER TABLE "sentry_dashboardpermissions" VALIDATE CONSTRAINT "sentry_dashboardperm_dashboard_id_6f51915b_fk_sentry_da";

github-actions[bot] avatar Oct 10 '24 16:10 github-actions[bot]