Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions backend/account_v2/authentication_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,16 +200,17 @@ def set_user_organization(self, request: Request, organization_id: str) -> Respo
)

if new_organization:
self.authentication_helper.create_initial_platform_key(
user=user, organization=organization
)

try:
self.auth_service.frictionless_onboarding(
organization=organization, user=user
)
except MethodNotImplemented:
logger.info("frictionless_onboarding not implemented")

self.authentication_helper.create_initial_platform_key(
user=user, organization=organization
)
logger.info(
f"New organization created with Id {organization_id}",
)
Expand Down
20 changes: 1 addition & 19 deletions backend/account_v2/authentication_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,6 @@ def get_or_create_user_by_email(user_id: str, email: str) -> User:
return user

def create_initial_platform_key(self, user: User, organization: Organization) -> None:
"""Create an initial platform key for the given user and organization.

This method generates a new platform key with the specified parameters
and saves it to the database. The generated key is set as active and
assigned the name "Key #1". The key is associated with the provided
user and organization.

Parameters:
user (User): The user for whom the platform key is being created.
organization (Organization):
The organization to which the platform key belongs.

Raises:
Exception: If an error occurs while generating the platform key.

Returns:
None
"""
try:
PlatformAuthenticationService.generate_platform_key(
is_active=True,
Expand All @@ -81,7 +63,7 @@ def create_initial_platform_key(self, user: User, organization: Organization) ->
organization=organization,
)
except Exception:
logger.error(
logger.exception(
"Failed to create default platform key for "
f"organization {organization.organization_id}"
)
Expand Down