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.

1.8 KB
Raw Blame
-- Generated by `pnpm --filter @carbon/database authz migration` from packages/database/src/authz. Do not edit.

-- Ships these rules to databases where `authz sync` does not run after migrations yet.

-- itemPostingGroupResponsibility
DO $authz$
DECLARE p record;
BEGIN
  FOR p IN SELECT policyname FROM pg_policies WHERE schemaname = 'public' AND tablename = 'itemPostingGroupResponsibility' LOOP
    EXECUTE format('DROP POLICY %I ON public.%I', p.policyname, 'itemPostingGroupResponsibility');
  END LOOP;
END
$authz$;
ALTER TABLE public."itemPostingGroupResponsibility" ENABLE ROW LEVEL SECURITY;
CREATE POLICY "SELECT" ON "public"."itemPostingGroupResponsibility" FOR SELECT USING ("companyId" = ANY ((SELECT get_companies_with_employee_role())::text[]));
CREATE POLICY "INSERT" ON "public"."itemPostingGroupResponsibility" FOR INSERT WITH CHECK ("companyId" = ANY ((SELECT get_companies_with_employee_permission('settings_update'))::text[]));
CREATE POLICY "UPDATE" ON "public"."itemPostingGroupResponsibility" FOR UPDATE USING ("companyId" = ANY ((SELECT get_companies_with_employee_permission('settings_update'))::text[]));
CREATE POLICY "DELETE" ON "public"."itemPostingGroupResponsibility" FOR DELETE USING ("companyId" = ANY ((SELECT get_companies_with_employee_permission('settings_update'))::text[]));

-- planningAction
DO $authz$
DECLARE p record;
BEGIN
  FOR p IN SELECT policyname FROM pg_policies WHERE schemaname = 'public' AND tablename = 'planningAction' LOOP
    EXECUTE format('DROP POLICY %I ON public.%I', p.policyname, 'planningAction');
  END LOOP;
END
$authz$;
ALTER TABLE public."planningAction" ENABLE ROW LEVEL SECURITY;
CREATE POLICY "SELECT" ON "public"."planningAction" FOR SELECT USING ("companyId" = ANY ((SELECT get_companies_with_employee_role())::text[]));