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.

433 B
Raw Blame
-- Allow users to see all companies in their company groups
-- The existing SELECT policy only shows companies the user is a member of.
-- This policy extends visibility to sibling companies in the same group.
DROP POLICY IF EXISTS "SELECT" ON "company";
CREATE POLICY "SELECT" ON "company"
FOR SELECT USING (
  "companyGroupId" IS NOT NULL AND
  "companyGroupId" = ANY(
    (SELECT get_company_groups_for_employee())::text[]
  )
);