Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
@@ -1,6 +1,9 @@
|
||||
-- R-P12a Automation isolation artifact.
|
||||
-- Companion to prisma/rls/tenant-isolation.sql. Enable during the merge
|
||||
-- migration once the schema lands and the automation service has shipped.
|
||||
-- Global template catalog writes must run through a separately privileged
|
||||
-- deploy/seed path. The tenant runtime may read global templates, but may only
|
||||
-- create, update, or delete rows belonging to its active tenant.
|
||||
--
|
||||
-- Verification:
|
||||
-- psql "$DIRECT_URL" -f prisma/rls/automation-isolation.sql
|
||||
@@ -49,9 +52,27 @@ ALTER TABLE "AutomationTemplate" ENABLE ROW LEVEL SECURITY;
|
||||
ALTER TABLE "AutomationTemplate" FORCE ROW LEVEL SECURITY;
|
||||
|
||||
DROP POLICY IF EXISTS "tenant_isolation_automation_template" ON "AutomationTemplate";
|
||||
CREATE POLICY "tenant_isolation_automation_template" ON "AutomationTemplate"
|
||||
USING ("tenantId" IS NULL OR "tenantId" = current_setting('app.tenant_id', true))
|
||||
WITH CHECK ("tenantId" IS NULL OR "tenantId" = current_setting('app.tenant_id', true));
|
||||
DROP POLICY IF EXISTS "tenant_isolation_automation_template_select" ON "AutomationTemplate";
|
||||
DROP POLICY IF EXISTS "tenant_isolation_automation_template_insert" ON "AutomationTemplate";
|
||||
DROP POLICY IF EXISTS "tenant_isolation_automation_template_update" ON "AutomationTemplate";
|
||||
DROP POLICY IF EXISTS "tenant_isolation_automation_template_delete" ON "AutomationTemplate";
|
||||
|
||||
CREATE POLICY "tenant_isolation_automation_template_select" ON "AutomationTemplate"
|
||||
FOR SELECT
|
||||
USING ("tenantId" IS NULL OR "tenantId" = current_setting('app.tenant_id', true));
|
||||
|
||||
CREATE POLICY "tenant_isolation_automation_template_insert" ON "AutomationTemplate"
|
||||
FOR INSERT
|
||||
WITH CHECK ("tenantId" = current_setting('app.tenant_id', true));
|
||||
|
||||
CREATE POLICY "tenant_isolation_automation_template_update" ON "AutomationTemplate"
|
||||
FOR UPDATE
|
||||
USING ("tenantId" = current_setting('app.tenant_id', true))
|
||||
WITH CHECK ("tenantId" = current_setting('app.tenant_id', true));
|
||||
|
||||
CREATE POLICY "tenant_isolation_automation_template_delete" ON "AutomationTemplate"
|
||||
FOR DELETE
|
||||
USING ("tenantId" = current_setting('app.tenant_id', true));
|
||||
|
||||
ALTER TABLE "AutomationTriggerMeter" ENABLE ROW LEVEL SECURITY;
|
||||
ALTER TABLE "AutomationTriggerMeter" FORCE ROW LEVEL SECURITY;
|
||||
@@ -60,3 +81,17 @@ DROP POLICY IF EXISTS "tenant_isolation_automation_trigger_meter" ON "Automation
|
||||
CREATE POLICY "tenant_isolation_automation_trigger_meter" ON "AutomationTriggerMeter"
|
||||
USING ("tenantId" = current_setting('app.tenant_id', true))
|
||||
WITH CHECK ("tenantId" = current_setting('app.tenant_id', true));
|
||||
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON "AutomationRule" TO hivegrid_app;
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON "AutomationRuleStep" TO hivegrid_app;
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON "AutomationExecution" TO hivegrid_app;
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON "AutomationStepExecution" TO hivegrid_app;
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON "AutomationCredential" TO hivegrid_app;
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON "AutomationTemplate" TO hivegrid_app;
|
||||
GRANT SELECT, INSERT, UPDATE, DELETE ON "AutomationTriggerMeter" TO hivegrid_app;
|
||||
|
||||
-- Inverse per table:
|
||||
-- REVOKE SELECT, INSERT, UPDATE, DELETE ON "<table>" FROM hivegrid_app;
|
||||
-- DROP POLICY IF EXISTS "<policy>" ON "<table>";
|
||||
-- ALTER TABLE "<table>" NO FORCE ROW LEVEL SECURITY;
|
||||
-- ALTER TABLE "<table>" DISABLE ROW LEVEL SECURITY;
|
||||
Reference in new issue
Block a user