Skip to content

Commit 6f02fcf

Browse files
committed
refactor: Remove core config from dashboard tenants list response
1 parent 0e10bf5 commit 6f02fcf

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

supertokens_python/recipe/dashboard/api/list_tenants.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414

1515
from __future__ import annotations
1616

17-
from typing import TYPE_CHECKING, Any, Dict
17+
from typing import TYPE_CHECKING, Any, Dict, List
18+
19+
from supertokens_python.recipe.multitenancy.interfaces import (
20+
ListAllTenantsItem,
21+
)
1822

1923
if TYPE_CHECKING:
2024
from supertokens_python.recipe.dashboard.interfaces import (
@@ -28,6 +32,8 @@
2832
DashboardListTenantsGetResponse,
2933
)
3034

35+
from copy import deepcopy
36+
3137

3238
async def handle_list_tenants_api(
3339
_api_implementation: APIInterface,
@@ -36,4 +42,12 @@ async def handle_list_tenants_api(
3642
user_context: Dict[str, Any],
3743
) -> APIResponse:
3844
tenants = await list_all_tenants(user_context)
45+
46+
final_tenants: List[ListAllTenantsItem] = []
47+
48+
for current_tenant in tenants.tenants:
49+
modified_tenant = deepcopy(current_tenant)
50+
modified_tenant.core_config = None
51+
final_tenants.append(modified_tenant)
52+
3953
return DashboardListTenantsGetResponse(tenants.tenants)

supertokens_python/recipe/multitenancy/interfaces.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def __init__(
101101
emailpassword: EmailPasswordConfig,
102102
passwordless: PasswordlessConfig,
103103
third_party: ThirdPartyConfig,
104-
core_config: Dict[str, Any],
104+
core_config: Optional[Dict[str, Any]],
105105
):
106106
self.emailpassword = emailpassword
107107
self.passwordless = passwordless
@@ -126,13 +126,16 @@ def __init__(
126126
self.tenant_id = tenant_id
127127

128128
def to_json(self):
129-
return {
129+
res = {
130130
"tenantId": self.tenant_id,
131131
"emailpassword": self.emailpassword.to_json(),
132132
"passwordless": self.passwordless.to_json(),
133133
"thirdParty": self.third_party.to_json(),
134-
"coreConfig": self.core_config,
135134
}
135+
if self.core_config is not None:
136+
res["coreConfig"] = self.core_config
137+
138+
return res
136139

137140

138141
class ListAllTenantsOkResult:

supertokens_python/recipe/multitenancy/recipe_implementation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ async def list_all_tenants(
193193
config.emailpassword,
194194
config.passwordless,
195195
config.third_party,
196-
config.core_config,
196+
config.core_config or {},
197197
)
198198
tenant_items.append(item)
199199

0 commit comments

Comments
 (0)