feat: the Financeiro profile (Dropstar, 2026-10-30)
All checks were successful
Build and deploy / Validate source (push) Successful in 14s
Build and deploy / Integration suite on a real stack (push) Successful in 4m44s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 1m12s
All checks were successful
Build and deploy / Validate source (push) Successful in 14s
Build and deploy / Integration suite on a real stack (push) Successful in 4m44s
Build and deploy / Secret scan and release gate (push) Successful in 9s
Build and deploy / Publish images (push) Successful in 1m12s
Financeiro sees the whole board, Pagamentos, Números and Cotações, and cancels an order with its reason. It moves no card and touches no file; resolving a payment stays with Gestão and Administração. Two narrower capabilities carry it: "payments" (the Pagamentos list) and "cancel", which used to need "manage". The order panel's menu shows each profile only what it may do. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -281,7 +281,7 @@ def finished_page(request: Request, before_created_at: datetime | None = None, b
|
||||
@router.get('/api/operator/payment-events')
|
||||
def payment_events(state: Literal['open','resolved','all'] = 'open',
|
||||
offset: int = Query(default=0, ge=0),
|
||||
limit: int = Query(default=20, ge=1, le=100), user=Depends(can('manage'))):
|
||||
limit: int = Query(default=20, ge=1, le=100), user=Depends(can('payments'))):
|
||||
"""Payments that needed a person, newest first: open ones to act on, resolved ones as history."""
|
||||
where = {'open': 'AND resolved_at IS NULL', 'resolved': 'AND resolved_at IS NOT NULL', 'all': ''}[state]
|
||||
with db.connect() as c:
|
||||
@@ -611,7 +611,7 @@ def release_files(c, uploads):
|
||||
|
||||
|
||||
@router.post('/api/operator/orders/{uid}/cancel')
|
||||
def cancel_order(uid: UUID, body: Resolution, user=Depends(can('manage'))):
|
||||
def cancel_order(uid: UUID, body: Resolution, user=Depends(can('cancel'))):
|
||||
"""A paid order leaves the board but keeps its payment and history. Nothing
|
||||
is refunded here (that is done at the provider); Tiny is told, so the
|
||||
order is cancelled there too while it was not invoiced (app/tiny.py)."""
|
||||
|
||||
@@ -25,7 +25,7 @@ class UserIn(StrictModel):
|
||||
# The profiles an administrator may give; superadmin only comes from the console.
|
||||
name: str = Field(min_length=1, max_length=80)
|
||||
email: str = Field(min_length=3, max_length=254)
|
||||
role: Literal['admin', 'gestao', 'designer', 'operador', 'revisor', 'vendedor']
|
||||
role: Literal['admin', 'gestao', 'designer', 'operador', 'revisor', 'vendedor', 'financeiro']
|
||||
password: str | None = Field(default=None, min_length=8, max_length=128)
|
||||
active: bool = True
|
||||
machines: list[UUID] = Field(default_factory=list, max_length=50)
|
||||
|
||||
@@ -122,7 +122,7 @@ def login_failed(email):
|
||||
# backup, the Tiny log): the others see there only what is on and off.
|
||||
# The designer approves and refuses artwork and asks for corrections, on every
|
||||
# order whatever its machine. Which cards each profile moves is MOVES.
|
||||
ROLES = ('superadmin', 'admin', 'gestao', 'designer', 'operador', 'revisor', 'vendedor')
|
||||
ROLES = ('superadmin', 'admin', 'gestao', 'designer', 'operador', 'revisor', 'vendedor', 'financeiro')
|
||||
CAPABILITIES = {
|
||||
'view': set(ROLES),
|
||||
'produce': {'superadmin', 'admin', 'gestao', 'designer', 'operador'},
|
||||
@@ -137,6 +137,11 @@ CAPABILITIES = {
|
||||
'authorize': {'superadmin', 'admin'},
|
||||
'users': {'superadmin', 'admin'},
|
||||
'integrations': {'superadmin'},
|
||||
# Financeiro (Dropstar, 2026-10-30): sees the board, Pagamentos, Números and
|
||||
# Cotações, and cancels an order with its reason; moves no card, touches no
|
||||
# file. Resolving a payment stays with "manage".
|
||||
'payments': {'superadmin', 'admin', 'gestao', 'financeiro'},
|
||||
'cancel': {'superadmin', 'admin', 'gestao', 'financeiro'},
|
||||
# "Retirado" at the counter (Dropstar's third round, item 14): everyone
|
||||
# but the seller, who only views (D-30). It includes everyone who produces,
|
||||
# so an operator upload (artwork.py) takes it for its parts.
|
||||
|
||||
@@ -253,7 +253,7 @@ CREATE TABLE IF NOT EXISTS dtf_local.cnpj_names (
|
||||
ALTER TABLE dtf_local.operators ADD COLUMN IF NOT EXISTS role text NOT NULL DEFAULT 'admin';
|
||||
ALTER TABLE dtf_local.operators DROP CONSTRAINT IF EXISTS operators_role;
|
||||
ALTER TABLE dtf_local.operators ADD CONSTRAINT operators_role
|
||||
CHECK (role IN ('superadmin','admin','gestao','designer','operador','revisor','vendedor'));
|
||||
CHECK (role IN ('superadmin','admin','gestao','designer','operador','revisor','vendedor','financeiro'));
|
||||
-- The print machines, and which products each prints. An order keeps the
|
||||
-- machine someone chose (machine_chosen) or the one given automatically: the
|
||||
-- active machine of its product with the fewest metres open (app/machines.py).
|
||||
|
||||
Reference in New Issue
Block a user