Skip to content

Small tweak for Account-Id or business identifier undefined#3605

Merged
seeker25 merged 3 commits intobcgov:mainfrom
seeker25:fix_auth_check_undefined_business_org_
Feb 10, 2026
Merged

Small tweak for Account-Id or business identifier undefined#3605
seeker25 merged 3 commits intobcgov:mainfrom
seeker25:fix_auth_check_undefined_business_org_

Conversation

@seeker25
Copy link
Collaborator

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the sbc-auth license (Apache 2.0).

@seeker25 seeker25 requested review from Jxio and ochiu as code owners February 10, 2026 01:15
@seeker25 seeker25 changed the title Small tweak for Account-Id undefined Small tweak for Account-Id or business identifier undefined Feb 10, 2026
org_identifier = kwargs.get("org_id", None) or user_from_context.account_id
auth = None
if business_identifier:
auth = Authorization.get_user_authorizations_for_entity(business_identifier)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

returns {}

auth_record = AuthorizationView.find_authorization_for_admin_by_org_id(user_from_context.account_id)
else:
auth_record = AuthorizationView.find_user_authorization_by_org_id(user_from_context.sub, org_identifier)
auth = Authorization(auth_record).as_dict() if auth_record else None
Copy link
Collaborator Author

@seeker25 seeker25 Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

auth = None possibly

auth_record = AuthorizationView.find_user_authorization_by_org_id(user_from_context.sub, org_identifier)
auth = Authorization(auth_record).as_dict() if auth_record else None

_check_for_roles(auth.get("orgMembership", None) if auth else None, kwargs)
Copy link
Collaborator Author

@seeker25 seeker25 Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since auth is None, the check_for_roles always fails
role = None

@sonarqubecloud
Copy link

@seeker25 seeker25 merged commit 1b151c2 into bcgov:main Feb 10, 2026
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant