mirror of
https://github.com/langgenius/dify.git
synced 2026-05-06 02:18:08 +08:00
Update api/services/tools/builtin_tools_manage_service.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@ -424,7 +424,11 @@ class BuiltinToolManageService:
|
|||||||
# Enterprise: verify admin permission for tenant-wide operation
|
# Enterprise: verify admin permission for tenant-wide operation
|
||||||
from models.account import TenantAccountRole
|
from models.account import TenantAccountRole
|
||||||
|
|
||||||
if account and not TenantAccountRole.is_privileged_role(account.current_role):
|
if account is None:
|
||||||
|
# In enterprise mode, an account context is required to perform permission checks
|
||||||
|
raise ValueError("Account is required to set default credentials in enterprise mode")
|
||||||
|
|
||||||
|
if not TenantAccountRole.is_privileged_role(account.current_role):
|
||||||
raise ValueError("Only workspace admins/owners can set default credentials in enterprise mode")
|
raise ValueError("Only workspace admins/owners can set default credentials in enterprise mode")
|
||||||
# Enterprise: clear ALL defaults for this provider in the tenant
|
# Enterprise: clear ALL defaults for this provider in the tenant
|
||||||
# (regardless of user_id, since enterprise credentials may have different user_id)
|
# (regardless of user_id, since enterprise credentials may have different user_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user