Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
chore: use TenantAccountRole instead of TenantAccountJoinRole (#15514)
jiangbo7210415cc209d34
diff --git a/api/models/__init__.py b/api/models/__init__.pyindex 1237c55a306..2066481a611 100644--- a/api/models/__init__.py+++ b/api/models/__init__.py@@ -5,7 +5,6 @@ from .account import (InvitationCode,Tenant,TenantAccountJoin,- TenantAccountJoinRole,TenantAccountRole,TenantStatus,)@@ -156,7 +155,6 @@ __all__ = ["TagBinding","Tenant","TenantAccountJoin",- "TenantAccountJoinRole","TenantAccountRole","TenantDefaultModel","TenantPreferredModelProvider",diff --git a/api/models/account.py b/api/models/account.pyindex bac1ec1c2e3..a0b8957fe1e 100644--- a/api/models/account.py+++ b/api/models/account.py@@ -220,13 +220,6 @@ class Tenant(db.Model): # type: ignore[name-defined]self.custom_config = json.dumps(value)-class TenantAccountJoinRole(enum.Enum):- OWNER = "owner"- ADMIN = "admin"- NORMAL = "normal"- DATASET_OPERATOR = "dataset_operator"--class TenantAccountJoin(db.Model): # type: ignore[name-defined]__tablename__ = "tenant_account_joins"__table_args__ = (diff --git a/api/services/account_service.py b/api/services/account_service.pyindex 29237502989..42d1fba97f3 100644--- a/api/services/account_service.py+++ b/api/services/account_service.py@@ -28,7 +28,6 @@ from models.account import (AccountStatus,Tenant,TenantAccountJoin,- TenantAccountJoinRole,TenantAccountRole,TenantStatus,)@@ -625,8 +624,8 @@ class TenantService:@staticmethoddef create_tenant_member(tenant: Tenant, account: Account, role: str = "normal") -> TenantAccountJoin:"""Create tenant member"""- if role == TenantAccountJoinRole.OWNER.value:- if TenantService.has_roles(tenant, [TenantAccountJoinRole.OWNER]):+ if role == TenantAccountRole.OWNER.value:+ if TenantService.has_roles(tenant, [TenantAccountRole.OWNER]):logging.error(f"Tenant {tenant.id} has already an owner.")raise Exception("Tenant already has an owner.")@@ -734,10 +733,10 @@ class TenantService:return updated_accounts@staticmethod- def has_roles(tenant: Tenant, roles: list[TenantAccountJoinRole]) -> bool:+ def has_roles(tenant: Tenant, roles: list[TenantAccountRole]) -> bool:"""Check if user has any of the given roles for a tenant"""- if not all(isinstance(role, TenantAccountJoinRole) for role in roles):- raise ValueError("all roles must be TenantAccountJoinRole")+ if not all(isinstance(role, TenantAccountRole) for role in roles):+ raise ValueError("all roles must be TenantAccountRole")return (db.session.query(TenantAccountJoin)@@ -749,7 +748,7 @@ class TenantService:)@staticmethod- def get_user_role(account: Account, tenant: Tenant) -> Optional[TenantAccountJoinRole]:+ def get_user_role(account: Account, tenant: Tenant) -> Optional[TenantAccountRole]:"""Get the role of the current account for a given tenant"""join = (db.session.query(TenantAccountJoin)diff --git a/api/services/workspace_service.py b/api/services/workspace_service.pyindex d91ce27854c..e012fd42966 100644--- a/api/services/workspace_service.py+++ b/api/services/workspace_service.py@@ -2,7 +2,7 @@ from flask_login import current_user # type: ignorefrom configs import dify_configfrom extensions.ext_database import db-from models.account import Tenant, TenantAccountJoin, TenantAccountJoinRole+from models.account import Tenant, TenantAccountJoin, TenantAccountRolefrom services.account_service import TenantServicefrom services.feature_service import FeatureService@@ -33,9 +33,7 @@ class WorkspaceService:can_replace_logo = FeatureService.get_features(tenant_info["id"]).can_replace_logo- if can_replace_logo and TenantService.has_roles(- tenant, [TenantAccountJoinRole.OWNER, TenantAccountJoinRole.ADMIN]- ):+ if can_replace_logo and TenantService.has_roles(tenant, [TenantAccountRole.OWNER, TenantAccountRole.ADMIN]):base_url = dify_config.FILES_URLreplace_webapp_logo = (f"{base_url}/files/workspaces/{tenant.id}/webapp-logo"