fix lint err

pull/21891/head
ytqh 1 year ago
parent 7c28647cf5
commit 3030a6312e

@ -85,8 +85,8 @@ class Account(UserMixin, db.Model): # type: ignore[name-defined]
self._current_tenant = tenant self._current_tenant = tenant
@property @property
def current_role(self): def current_role(self) -> str:
return self._current_tenant.current_role return self._current_tenant.current_role if self._current_tenant else TenantAccountJoinRole.UNKNOWN.value
def get_status(self) -> AccountStatus: def get_status(self) -> AccountStatus:
status_str = self.status status_str = self.status
@ -105,23 +105,23 @@ class Account(UserMixin, db.Model): # type: ignore[name-defined]
@property @property
def is_admin_or_owner(self): def is_admin_or_owner(self):
return TenantAccountRole.is_privileged_role(self._current_tenant.current_role) return TenantAccountRole.is_privileged_role(self.current_role)
@property @property
def is_admin(self): def is_admin(self):
return TenantAccountRole.is_admin_role(self._current_tenant.current_role) return TenantAccountRole.is_admin_role(self.current_role)
@property @property
def is_editor(self): def is_editor(self):
return TenantAccountRole.is_editing_role(self._current_tenant.current_role) return TenantAccountRole.is_editing_role(self.current_role)
@property @property
def is_dataset_editor(self): def is_dataset_editor(self):
return TenantAccountRole.is_dataset_edit_role(self._current_tenant.current_role) return TenantAccountRole.is_dataset_edit_role(self.current_role)
@property @property
def is_dataset_operator(self): def is_dataset_operator(self):
return self._current_tenant.current_role == TenantAccountRole.DATASET_OPERATOR return self.current_role == TenantAccountRole.DATASET_OPERATOR
class TenantStatus(enum.StrEnum): class TenantStatus(enum.StrEnum):
@ -213,6 +213,7 @@ class TenantAccountJoinRole(enum.Enum):
DATASET_OPERATOR = "dataset_operator" DATASET_OPERATOR = "dataset_operator"
END_USER = "end_user" END_USER = "end_user"
END_ADMIN = "end_admin" END_ADMIN = "end_admin"
UNKNOWN = "unknown"
class TenantAccountJoin(db.Model): # type: ignore[name-defined] class TenantAccountJoin(db.Model): # type: ignore[name-defined]

Loading…
Cancel
Save