Merge pull request #10366 from tarmst/fix-no-nested-claims-for-group-oauth

Fix: Add nested claim search for group oauth management
This commit is contained in:
Timothy Jaeryang Baek 2025-02-19 12:23:54 -08:00 committed by GitHub
commit 5da47de6eb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -140,7 +140,14 @@ class OAuthManager:
log.debug("Running OAUTH Group management")
oauth_claim = auth_manager_config.OAUTH_GROUPS_CLAIM
user_oauth_groups: list[str] = user_data.get(oauth_claim, list())
# Nested claim search for groups claim
if oauth_claim:
claim_data = user_data
nested_claims = oauth_claim.split(".")
for nested_claim in nested_claims:
claim_data = claim_data.get(nested_claim, {})
user_oauth_groups = claim_data if isinstance(claim_data, list) else None
user_current_groups: list[GroupModel] = Groups.get_groups_by_member_id(user.id)
all_available_groups: list[GroupModel] = Groups.get_groups()