Skip to content

Commit 41772c3

Browse files
authored
Feat/add admin check (langgenius#11050)
1 parent a4fc057 commit 41772c3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

api/models/account.py

+8
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ def get_integrates(self) -> list[db.Model]:
108108
def is_admin_or_owner(self):
109109
return TenantAccountRole.is_privileged_role(self._current_tenant.current_role)
110110

111+
@property
112+
def is_admin(self):
113+
return TenantAccountRole.is_admin_role(self._current_tenant.current_role)
114+
111115
@property
112116
def is_editor(self):
113117
return TenantAccountRole.is_editing_role(self._current_tenant.current_role)
@@ -147,6 +151,10 @@ def is_valid_role(role: str) -> bool:
147151
def is_privileged_role(role: str) -> bool:
148152
return role and role in {TenantAccountRole.OWNER, TenantAccountRole.ADMIN}
149153

154+
@staticmethod
155+
def is_admin_role(role: str) -> bool:
156+
return role and role == TenantAccountRole.ADMIN
157+
150158
@staticmethod
151159
def is_non_owner_role(role: str) -> bool:
152160
return role and role in {

0 commit comments

Comments
 (0)