feat: a user may have more than one profile, and may do what any of them may (Marcus, 2026-11-26)
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>
This commit is contained in:
Cauê Faleiros
2026-11-26 10:57:20 -03:00
parent a88e7a3288
commit 4c6e2aac4a
16 changed files with 234 additions and 62 deletions

View File

@@ -231,6 +231,19 @@ def run():
reviewer.call(f'/operator/orders/{uv_o}/picked-up', {}, expected=409)
shown = next(o for o in su.call('/operator/board', operator=True)['orders'] if o['id'] == str(uv_o))
assert (shown['picked_up_by'], shown['picked_up_photo']) == (emails['revisor'], photo) and shown['picked_up_at'], shown
# More than one profile (Marcus, 2026-11-26): Revisor and Operador sum
# their moves; the operator's machine rules keep only to Operador's.
row = next(u for u in admin.call('/operator/users')['users'] if u['email'] == emails['revisor'])
admin.call(f"/operator/users/{row['id']}", {'name': 'Confere', 'email': emails['revisor'], 'role': 'revisor',
'roles': ['operador', 'revisor']})
assert next(u for u in admin.call('/operator/users')['users']
if u['email'] == emails['revisor'])['roles'] == ['revisor', 'operador']
both = reviewer.call('/operator/me')
assert both['roles'] == ['revisor', 'operador'] and both['machine_question'] == 'required', both
assert ['tra', 'imp'] in both['moves'] and ['rev', 'fin'] in both['moves'] and 'print' in both['can'], both
assert ['tra', 'imp'] in both['machine_moves'] and ['rev', 'fin'] not in both['machine_moves'], both
admin.call(f"/operator/users/{row['id']}", {'name': 'Confere', 'email': emails['revisor'], 'role': 'revisor'})
assert reviewer.call('/operator/me')['roles'] == ['revisor']
# The designer: every order, whatever its machine; the artwork stages only.
admin.call('/operator/users', {'name': 'Arte', 'email': emails['designer'], 'role': 'designer',