diff --git a/lms/data_tasks/report/create_from_scratch/98_proxies/01_organizations.sql b/lms/data_tasks/report/create_from_scratch/98_proxies/01_organizations.sql new file mode 100644 index 0000000000..59ade541be --- /dev/null +++ b/lms/data_tasks/report/create_from_scratch/98_proxies/01_organizations.sql @@ -0,0 +1,13 @@ +DROP VIEW IF EXISTS report.organizations CASCADE; + +-- Create a proxy view to isolate LMS from reading our data directly +CREATE VIEW report.organizations AS ( + SELECT + id, + public_id, + name, + created, + updated, + enabled + FROM organization +); diff --git a/lms/data_tasks/report/create_from_scratch/98_proxies/README.md b/lms/data_tasks/report/create_from_scratch/98_proxies/README.md new file mode 100644 index 0000000000..4a6e834e69 --- /dev/null +++ b/lms/data_tasks/report/create_from_scratch/98_proxies/README.md @@ -0,0 +1,2 @@ +These views proxy tables so that LMS doesn't read directly from our main +tables. This allows us to change slowly without breaking LMS should we need to. \ No newline at end of file diff --git a/lms/data_tasks/report/create_from_scratch/99_grant_permissions/01_grant_schema.jinja2.sql b/lms/data_tasks/report/create_from_scratch/99_grant_permissions/01_grant_schema.jinja2.sql index 1e29e62dc3..80042cbeb0 100644 --- a/lms/data_tasks/report/create_from_scratch/99_grant_permissions/01_grant_schema.jinja2.sql +++ b/lms/data_tasks/report/create_from_scratch/99_grant_permissions/01_grant_schema.jinja2.sql @@ -27,6 +27,7 @@ GRANT SELECT ON report.group_bubbled_activity TO "{{fdw_user}}"; GRANT SELECT ON report.group_bubbled_counts TO "{{fdw_user}}"; GRANT SELECT ON report.group_roles TO "{{fdw_user}}"; + GRANT SELECT ON report.organizations TO "{{fdw_user}}"; GRANT SELECT ON report.organization_activity TO "{{fdw_user}}"; GRANT SELECT ON report.organization_annotation_counts TO "{{fdw_user}}"; GRANT SELECT ON report.organization_assignments TO "{{fdw_user}}";