All checks were successful
Build and deploy / Validate source (push) Successful in 8s
Build and deploy / Integration suite on a real stack (push) Successful in 8m1s
Build and deploy / Secret scan and release gate (push) Successful in 8s
Build and deploy / Publish images (push) Successful in 1m32s
operators.roles holds every profile, the main one first; permissions, moves, the column order and the machine question are the sum. The operator's machine rules apply only to the moves Operador alone allows, so an Operador who is also Revisor releases any sheet (D-29 does not block, Marcus). Usuários gets "Outros perfis" chips next to the main profile. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
14 lines
815 B
SQL
14 lines
815 B
SQL
-- More than one profile per user (Marcus, 2026-11-26: operador/revisor,
|
|
-- gestor/operador/revisor): what a user may do is the sum of their profiles.
|
|
-- `role` stays the main one, shown first and kept for superadmin; `roles`
|
|
-- holds every profile, the main one included.
|
|
ALTER TABLE dtf_local.operators ADD COLUMN IF NOT EXISTS roles text[] NOT NULL DEFAULT '{}';
|
|
UPDATE dtf_local.operators SET roles=ARRAY[role] WHERE cardinality(roles)=0;
|
|
DO $$ BEGIN
|
|
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname='operators_roles'
|
|
AND conrelid='dtf_local.operators'::regclass) THEN
|
|
ALTER TABLE dtf_local.operators ADD CONSTRAINT operators_roles
|
|
CHECK (roles <@ ARRAY['superadmin','admin','gestao','designer','operador','revisor','vendedor','financeiro','expedicao']::text[]);
|
|
END IF;
|
|
END $$;
|