Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
@@ -0,0 +1,35 @@
|
||||
-- AK-P16c · Forms — RLS ROLLOUT ARTIFACT (deferred, NOT in auto-migration)
|
||||
-- Code-side access runs through formsAccess + tenant scoped Prisma filters.
|
||||
-- Enabling FORCE RLS is coordinated with the restricted runtime role cutover.
|
||||
--
|
||||
-- Inverse per table:
|
||||
-- REVOKE SELECT, INSERT, UPDATE, DELETE ON "<tbl>" FROM hivegrid_app;
|
||||
-- DROP POLICY IF EXISTS "<tbl>_tenant_isolation" ON "<tbl>";
|
||||
-- ALTER TABLE "<tbl>" NO FORCE ROW LEVEL SECURITY;
|
||||
-- ALTER TABLE "<tbl>" DISABLE ROW LEVEL SECURITY;
|
||||
|
||||
DO $$
|
||||
DECLARE
|
||||
tbl text;
|
||||
BEGIN
|
||||
FOREACH tbl IN ARRAY ARRAY['Form', 'FormField', 'FormSubmission', 'FormFile', 'FormAction', 'FormActionLog']
|
||||
LOOP
|
||||
EXECUTE format('ALTER TABLE %I ENABLE ROW LEVEL SECURITY;', tbl);
|
||||
EXECUTE format('ALTER TABLE %I FORCE ROW LEVEL SECURITY;', tbl);
|
||||
|
||||
IF NOT EXISTS (
|
||||
SELECT 1 FROM pg_policies
|
||||
WHERE schemaname = current_schema()
|
||||
AND tablename = tbl
|
||||
AND policyname = tbl || '_tenant_isolation'
|
||||
) THEN
|
||||
EXECUTE format(
|
||||
'CREATE POLICY %I ON %I USING ("tenantId" = current_setting(''app.tenant_id'', true)) WITH CHECK ("tenantId" = current_setting(''app.tenant_id'', true));',
|
||||
tbl || '_tenant_isolation', tbl
|
||||
);
|
||||
END IF;
|
||||
|
||||
EXECUTE format('GRANT SELECT, INSERT, UPDATE, DELETE ON %I TO hivegrid_app;', tbl);
|
||||
END LOOP;
|
||||
END
|
||||
$$;
|
||||
Reference in new issue
Block a user