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

@@ -344,9 +344,9 @@ class TenantService:
def check_member_permission(tenant: Tenant, operator: Account, member: Account, action: str) -> None:
"""Check member permission"""
perms = {
'add': ['owner', 'admin'],
'remove': ['owner'],
'update': ['owner']
'add': [TenantAccountRole.OWNER, TenantAccountRole.ADMIN],
'remove': [TenantAccountRole.OWNER],
'update': [TenantAccountRole.OWNER]
}
if action not in ['add', 'remove', 'update']:
raise InvalidActionError("Invalid action.")