From e8931c2818083252e49d41ea3567991202a2555c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cau=C3=AA=20Faleiros?= Date: Tue, 17 Nov 2026 14:30:32 -0300 Subject: [PATCH] fix: the sellers list names the Tiny permission our user lacks and shows Tiny's answer 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) --- app/api/operator/integrations.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/api/operator/integrations.py b/app/api/operator/integrations.py index 7596d9a..695b8f2 100644 --- a/app/api/operator/integrations.py +++ b/app/api/operator/integrations.py @@ -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