fix: the sellers list names the Tiny permission our user lacks and shows Tiny's answer
All checks were successful
Build and deploy / Validate source (push) Successful in 5s
Build and deploy / Integration suite on a real stack (push) Successful in 6m30s
Build and deploy / Secret scan and release gate (push) Successful in 7s
Build and deploy / Publish images (push) Successful in 1m21s

Tiny refused GET /vendedores with 403 in production; the message blamed
the app's Contatos scope, which already works for the Venda customer
search. Tiny checks the connected user's module permissions: the message
now asks for "ver Vendedores" on our user and carries Tiny's own reply.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cauê Faleiros
2026-11-17 14:30:32 -03:00
parent aaa6090642
commit e8931c2818

View File

@@ -163,8 +163,11 @@ def tiny_sellers(user=Depends(can('users'))):
except tiny.TinyNotConnected:
raise HTTPException(409, 'O Tiny não está conectado.')
except tiny.TinyError as exc:
# Tiny checks the connected user's module permissions on every call:
# our user needs to see Vendedores (app/tiny.py, 2026-10-27).
if ': 403 ' in str(exc) or ': 401 ' in str(exc):
raise HTTPException(409, 'O aplicativo do Tiny não tem permissão para ler os vendedores (Contatos, leitura).')
raise HTTPException(409, 'O Tiny recusou a leitura dos vendedores: o usuário do Kanban no Tiny precisa da '
'permissão de ver Vendedores. Resposta do Tiny: ' + str(exc).split(': ', 1)[-1][:200])
raise