2929from .interfaces import (
3030 APIInterface ,
3131 APIOptions ,
32- TypeGetTenantIdsForUserId ,
32+ TypeGetTenantIdForUserId ,
3333 TypeGetAllowedDomainsForTenantId ,
34- TenantIdsOkResult ,
34+ TenantIdOkResult ,
3535 UnknownUserIdError ,
3636)
3737
@@ -78,7 +78,7 @@ def __init__(
7878 self ,
7979 recipe_id : str ,
8080 app_info : AppInfo ,
81- get_tenant_ids_for_user_id : Optional [TypeGetTenantIdsForUserId ] = None ,
81+ get_tenant_id_for_user_id : Optional [TypeGetTenantIdForUserId ] = None ,
8282 get_allowed_domains_for_tenant_id : Optional [
8383 TypeGetAllowedDomainsForTenantId
8484 ] = None ,
@@ -87,7 +87,7 @@ def __init__(
8787 ) -> None :
8888 super ().__init__ (recipe_id , app_info )
8989 self .config = validate_and_normalise_user_input (
90- get_tenant_ids_for_user_id ,
90+ get_tenant_id_for_user_id ,
9191 get_allowed_domains_for_tenant_id ,
9292 error_handlers ,
9393 override ,
@@ -109,8 +109,8 @@ def __init__(
109109 else self .config .override .apis (api_implementation )
110110 )
111111
112- self .get_tenant_ids_for_user_id_funcs_from_other_recipes : List [
113- TypeGetTenantIdsForUserId
112+ self .get_tenant_id_for_user_id_funcs_from_other_recipes : List [
113+ TypeGetTenantIdForUserId
114114 ] = []
115115
116116 self .static_third_party_providers : List [ProviderInput ] = []
@@ -169,7 +169,7 @@ def get_all_cors_headers(self) -> List[str]:
169169
170170 @staticmethod
171171 def init (
172- get_tenant_ids_for_user_id : Union [TypeGetTenantIdsForUserId , None ] = None ,
172+ get_tenant_id_for_user_id : Union [TypeGetTenantIdForUserId , None ] = None ,
173173 get_allowed_domains_for_tenant_id : Union [
174174 TypeGetAllowedDomainsForTenantId , None
175175 ] = None ,
@@ -181,7 +181,7 @@ def func(app_info: AppInfo):
181181 MultitenancyRecipe .__instance = MultitenancyRecipe (
182182 MultitenancyRecipe .recipe_id ,
183183 app_info ,
184- get_tenant_ids_for_user_id ,
184+ get_tenant_id_for_user_id ,
185185 get_allowed_domains_for_tenant_id ,
186186 error_handlers ,
187187 override ,
@@ -219,23 +219,23 @@ def reset():
219219 raise_general_exception ("calling testing function in non testing env" )
220220 MultitenancyRecipe .__instance = None
221221
222- async def get_tenant_ids_for_user_id (
222+ async def get_tenant_id_for_user_id (
223223 self , user_id : str , user_context : Dict [str , Any ]
224- ) -> Union [TenantIdsOkResult , UnknownUserIdError ]:
225- if self .config .get_tenant_ids_for_user_id is not None :
226- res = await self .config .get_tenant_ids_for_user_id (user_id , user_context )
224+ ) -> Union [TenantIdOkResult , UnknownUserIdError ]:
225+ if self .config .get_tenant_id_for_user_id is not None :
226+ res = await self .config .get_tenant_id_for_user_id (user_id , user_context )
227227 if not isinstance (res , UnknownUserIdError ):
228228 return res
229229
230- for f in self .get_tenant_ids_for_user_id_funcs_from_other_recipes :
230+ for f in self .get_tenant_id_for_user_id_funcs_from_other_recipes :
231231 res = await f (user_id , user_context )
232232 if not isinstance (res , UnknownUserIdError ):
233233 return res
234234
235235 return UnknownUserIdError ()
236236
237- def add_get_tenant_ids_for_user_id_func (self , f : TypeGetTenantIdsForUserId ):
238- self .get_tenant_ids_for_user_id_funcs_from_other_recipes .append (f )
237+ def add_get_tenant_id_for_user_id_func (self , f : TypeGetTenantIdForUserId ):
238+ self .get_tenant_id_for_user_id_funcs_from_other_recipes .append (f )
239239
240240
241241class APIImplementation (APIInterface ):
@@ -286,12 +286,12 @@ class AllowedDomainsClaimClass(PrimitiveArrayClaim[List[str]]):
286286 def __init__ (self ):
287287 async def fetch_value (user_id : str , user_context : Dict [str , Any ]) -> List [str ]:
288288 recipe = MultitenancyRecipe .get_instance ()
289- tenant_ids_res = await recipe .get_tenant_ids_for_user_id (
289+ tenant_ids_res = await recipe .get_tenant_id_for_user_id (
290290 user_id , user_context
291291 )
292292
293- if isinstance (tenant_ids_res , TenantIdsOkResult ):
294- for tenant_id in tenant_ids_res .tenant_ids :
293+ if isinstance (tenant_ids_res , TenantIdOkResult ):
294+ for tenant_id in tenant_ids_res .tenant_id :
295295 if recipe .config .get_allowed_domains_for_tenant_id is None :
296296 return (
297297 []
0 commit comments