From 2e419ca3ba21058301bb932a218cdfd881715045 Mon Sep 17 00:00:00 2001 From: zhangx1n Date: Mon, 31 Mar 2025 17:26:02 +0800 Subject: [PATCH] feat(license): refactor available team members handling in feature service. - add tenant_id support to info request methods --- api/services/enterprise/base.py | 4 +++- api/services/enterprise/enterprise_service.py | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/api/services/enterprise/base.py b/api/services/enterprise/base.py index 3c3f970444..d0464834ce 100644 --- a/api/services/enterprise/base.py +++ b/api/services/enterprise/base.py @@ -13,8 +13,10 @@ class EnterpriseRequest: } @classmethod - def send_request(cls, method, endpoint, json=None, params=None): + def send_request(cls, method, endpoint, json=None, params=None, tenant_id=None): headers = {"Content-Type": "application/json", "Enterprise-Api-Secret-Key": cls.secret_key} + if tenant_id: + headers["X-Tenant-ID"] = tenant_id url = f"{cls.base_url}{endpoint}" response = requests.request(method, url, json=json, params=params, headers=headers, proxies=cls.proxies) return response.json() diff --git a/api/services/enterprise/enterprise_service.py b/api/services/enterprise/enterprise_service.py index abc01ddf8f..4b4690ce74 100644 --- a/api/services/enterprise/enterprise_service.py +++ b/api/services/enterprise/enterprise_service.py @@ -1,10 +1,13 @@ +from contexts import tenant_id from services.enterprise.base import EnterpriseRequest +from flask import request +from libs.passport import PassportService class EnterpriseService: @classmethod - def get_info(cls): - return EnterpriseRequest.send_request("GET", "/info") + def get_info(cls, tenant_id=None): + return EnterpriseRequest.send_request("GET", "/info", tenant_id=tenant_id) @classmethod def get_app_web_sso_enabled(cls, app_code):