feat: Integrações buttons only for the superadmin; the folder downloads in Arte recebida by default
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 3m7s
Build and deploy / Secret scan and release gate (push) Successful in 4s
Build and deploy / Publish images (push) Successful in 47s
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 3m7s
Build and deploy / Secret scan and release gate (push) Successful in 4s
Build and deploy / Publish images (push) Successful in 47s
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -90,7 +90,7 @@ def backup_status(c):
|
||||
|
||||
|
||||
@router.post('/api/operator/backup/run')
|
||||
def backup_now(user=Depends(can('manage'))):
|
||||
def backup_now(user=Depends(can('integrations'))):
|
||||
"""A backup now, outside the daily hour: the backup service, which alone
|
||||
may read the whole database, starts it within a minute."""
|
||||
with db.connect() as c:
|
||||
@@ -271,7 +271,7 @@ def events(provider: Literal['tiny'] | None = None,
|
||||
status: Literal['delivered','queued','failing'] | None = None,
|
||||
event: Literal['payment_approved','production_started','correction_needed','ready','cancelled'] | None = None,
|
||||
order: int | None = Query(default=None, ge=1), 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('integrations'))):
|
||||
"""The integration send log, newest first, filtered, by page with a total."""
|
||||
clauses, params = [], []
|
||||
if provider:
|
||||
@@ -676,7 +676,7 @@ def tiny_status():
|
||||
**tiny.TinyAuth().status()}
|
||||
|
||||
@router.post('/api/operator/tiny/connect')
|
||||
def tiny_connect(user=Depends(can('manage'))):
|
||||
def tiny_connect(user=Depends(can('integrations'))):
|
||||
"""Start the one-time authorisation of this system in the client's Tiny."""
|
||||
if not tiny.configured():
|
||||
raise HTTPException(503, 'Tiny application is not configured')
|
||||
@@ -684,7 +684,7 @@ def tiny_connect(user=Depends(can('manage'))):
|
||||
return {'url': tiny.TinyAuth().authorize_url(user)}
|
||||
|
||||
@router.post('/api/operator/tiny/test')
|
||||
def tiny_test(user=Depends(can('manage'))):
|
||||
def tiny_test(user=Depends(can('integrations'))):
|
||||
"""Read one order and one contact from Tiny. Creates nothing."""
|
||||
if not tiny.configured():
|
||||
raise HTTPException(503, 'Tiny application is not configured')
|
||||
@@ -696,7 +696,7 @@ def tiny_test(user=Depends(can('manage'))):
|
||||
return {'ok': all(v == 'ok' for v in results.values()), 'results': results}
|
||||
|
||||
@router.post('/api/operator/mercadopago/check')
|
||||
def mercadopago_check(user=Depends(can('manage'))):
|
||||
def mercadopago_check(user=Depends(can('integrations'))):
|
||||
"""The Mercado Pago account behind the configured token; reads only."""
|
||||
if payment.name != 'mercadopago':
|
||||
raise HTTPException(409, 'Mercado Pago não está configurado')
|
||||
|
||||
@@ -211,7 +211,7 @@ def delete_machine(mid: UUID, user=Depends(can('users'))):
|
||||
|
||||
|
||||
@router.post('/api/operator/mail/test')
|
||||
def test_mail(request: Request, user=Depends(can('manage'))):
|
||||
def test_mail(request: Request, user=Depends(can('integrations'))):
|
||||
"""A message to whoever asked, to prove the mail server works."""
|
||||
with db.connect() as c:
|
||||
if not mail.queue(c, 'test', user, 'Teste de e-mail · Kanban DTF',
|
||||
|
||||
@@ -115,14 +115,17 @@ def login_failed(email):
|
||||
rate_limit('auth-account', email, 1_000_000)
|
||||
|
||||
# What each Kanban profile may do. "view" is reading; "produce" moves cards and
|
||||
# handles artwork; "manage" covers quotes, cancellations, payments and the
|
||||
# integrations; "users" is the Usuários page.
|
||||
# handles artwork; "manage" covers quotes, cancellations and payments; "users"
|
||||
# is the Usuários page; "integrations" is everything in Integrações but the
|
||||
# print room's folder (connecting Tiny, the checks, the backup, the Tiny log):
|
||||
# the others see there only what is on and off.
|
||||
ROLES = ('superadmin', 'admin', 'gestao', 'operador', 'vendedor')
|
||||
CAPABILITIES = {
|
||||
'view': set(ROLES),
|
||||
'produce': {'superadmin', 'admin', 'gestao', 'operador'},
|
||||
'manage': {'superadmin', 'admin', 'gestao'},
|
||||
'users': {'superadmin', 'admin'},
|
||||
'integrations': {'superadmin'},
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user