Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

feat: update RLS policies for group table to use user module permissions

Rob Carringtonc1fefafa4efe
diff --git a/apps/carbon/app/lib/swagger-docs-schema.ts b/apps/carbon/app/lib/swagger-docs-schema.ts
index 3195dcfe1e..6962a74c49 100644
--- a/apps/carbon/app/lib/swagger-docs-schema.ts
+++ b/apps/carbon/app/lib/swagger-docs-schema.ts
@@ -3,7 +3,7 @@ export default {
info: {
description: "",
title: "standard public schema",
- version: "12.0.2 (a4e00ff)",
+ version: "12.0.1 (cd38da5)",
},
host: "0.0.0.0:3000",
basePath: "/",
diff --git a/packages/database/supabase/migrations/20240821150639_api-key-all-tables.sql b/packages/database/supabase/migrations/20240821150639_api-key-all-tables.sql
index a70fe44c33..adf7188cfe 100644
--- a/packages/database/supabase/migrations/20240821150639_api-key-all-tables.sql
+++ b/packages/database/supabase/migrations/20240821150639_api-key-all-tables.sql
@@ -303,33 +303,27 @@ FOR ALL USING (
-- group
ALTER TABLE "group" ENABLE ROW LEVEL SECURITY;
-CREATE POLICY "Requests with an API key can access groups" ON "group"
-FOR ALL USING (
- has_valid_api_key_for_company("companyId")
-);
-
-CREATE POLICY "Employees with settings_view can view groups" ON "group"
+CREATE POLICY "All employees can view groups" ON "group"
FOR SELECT USING (
- has_role('employee', "companyId") AND
- has_company_permission('settings_view', "companyId")
+ has_role('employee', "companyId")
);
-CREATE POLICY "Employees with settings_create can create groups" ON "group"
+CREATE POLICY "Employees with users_create can create groups" ON "group"
FOR INSERT WITH CHECK (
has_role('employee', "companyId") AND
- has_company_permission('settings_create', "companyId")
+ has_company_permission('users_create', "companyId")
);
-CREATE POLICY "Employees with settings_update can update groups" ON "group"
+CREATE POLICY "Employees with users_update can update groups" ON "group"
FOR UPDATE USING (
has_role('employee', "companyId") AND
- has_company_permission('settings_update', "companyId")
+ has_company_permission('users_update', "companyId")
);
-CREATE POLICY "Employees with settings_delete can delete groups" ON "group"
+CREATE POLICY "Employees with users_delete can delete groups" ON "group"
FOR DELETE USING (
has_role('employee', "companyId") AND
- has_company_permission('settings_delete', "companyId")
+ has_company_permission('users_delete', "companyId")
);
CREATE POLICY "Requests with an API key can access groups" ON "group"