extract enum type for tenant account role (#3788)

This commit is contained in:
Bowen Liang
2024-04-25 18:20:08 +08:00
committed by GitHub
parent cde87cb225
commit c54fcfb45d
6 changed files with 36 additions and 12 deletions

View File

@@ -3,7 +3,7 @@ import os
import requests
from extensions.ext_database import db
from models.account import TenantAccountJoin
from models.account import TenantAccountJoin, TenantAccountRole
class BillingService:
@@ -74,5 +74,5 @@ class BillingService:
TenantAccountJoin.account_id == current_user.id
).first()
if join.role not in ['owner', 'admin']:
if TenantAccountRole.is_privileged_role(join.role):
raise ValueError('Only team owner or team admin can perform this action')