Skip to content

Commit

Permalink
feat: Set default of tenant_id and user context to None
Browse files Browse the repository at this point in the history
  • Loading branch information
KShivendu committed Aug 2, 2023
1 parent 3133a70 commit 633ebc1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
14 changes: 10 additions & 4 deletions supertokens_python/recipe/emailverification/syncio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,12 @@ def send_email(
def create_email_verification_link(
user_id: str,
email: Optional[str],
tenant_id: Optional[str],
user_context: Dict[str, Any],
tenant_id: Optional[str] = None,
user_context: Optional[Dict[str, Any]] = None,
):
if user_context is None:
user_context = {}

from supertokens_python.recipe.emailverification.asyncio import (
create_email_verification_link,
)
Expand All @@ -105,9 +108,12 @@ def create_email_verification_link(
def send_email_verification_email(
user_id: str,
email: Optional[str],
tenant_id: Optional[str],
user_context: Dict[str, Any],
tenant_id: Optional[str] = None,
user_context: Optional[Dict[str, Any]] = None,
):
if user_context is None:
user_context = {}

from supertokens_python.recipe.emailverification.asyncio import (
send_email_verification_email,
)
Expand Down
8 changes: 6 additions & 2 deletions supertokens_python/recipe/session/asyncio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ async def create_new_session_without_request_response(
final_access_token_payload = {**access_token_payload, "iss": issuer}

for claim in claims_added_by_other_recipes:
update = await claim.build(user_id, tenant_id or DEFAULT_TENANT_ID, user_context)
update = await claim.build(
user_id, tenant_id or DEFAULT_TENANT_ID, user_context
)
final_access_token_payload = {**final_access_token_payload, **update}

return await SessionRecipe.get_instance().recipe_implementation.create_new_session(
Expand Down Expand Up @@ -426,7 +428,9 @@ async def revoke_session(


async def revoke_all_sessions_for_user(
user_id: str, tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None
user_id: str,
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> List[str]:
if user_context is None:
user_context = {}
Expand Down
8 changes: 6 additions & 2 deletions supertokens_python/recipe/session/syncio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ def revoke_session(


def revoke_all_sessions_for_user(
user_id: str, tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None
user_id: str,
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> List[str]:
from supertokens_python.recipe.session.asyncio import (
revoke_all_sessions_for_user as async_revoke_all_sessions_for_user,
Expand All @@ -197,7 +199,9 @@ def revoke_all_sessions_for_user(


def get_all_session_handles_for_user(
user_id: str, tenant_id: Optional[str] = None, user_context: Union[None, Dict[str, Any]] = None
user_id: str,
tenant_id: Optional[str] = None,
user_context: Union[None, Dict[str, Any]] = None,
) -> List[str]:
from supertokens_python.recipe.session.asyncio import (
get_all_session_handles_for_user as async_get_all_session_handles_for_user,
Expand Down

0 comments on commit 633ebc1

Please sign in to comment.