mirror of
https://github.com/open-webui/open-webui
synced 2025-03-05 03:48:55 +00:00
Fix: Ensure user_oauth_groups
defaults to an empty list to prevent TypeError
When the OAuth groups claim does not yield a list, `user_oauth_groups` was previously set to None, causing a TypeError during membership checks. Changed this default to an empty list (`[]`) to ensure the variable is always iterable, preventing errors for non-admin users while logging in. This fix ensures stability in the `update_user_groups` function.
This commit is contained in:
parent
6fedd72e39
commit
d50098b622
@ -146,7 +146,7 @@ class OAuthManager:
|
|||||||
nested_claims = oauth_claim.split(".")
|
nested_claims = oauth_claim.split(".")
|
||||||
for nested_claim in nested_claims:
|
for nested_claim in nested_claims:
|
||||||
claim_data = claim_data.get(nested_claim, {})
|
claim_data = claim_data.get(nested_claim, {})
|
||||||
user_oauth_groups = claim_data if isinstance(claim_data, list) else None
|
user_oauth_groups = claim_data if isinstance(claim_data, list) else []
|
||||||
|
|
||||||
user_current_groups: list[GroupModel] = Groups.get_groups_by_member_id(user.id)
|
user_current_groups: list[GroupModel] = Groups.get_groups_by_member_id(user.id)
|
||||||
all_available_groups: list[GroupModel] = Groups.get_groups()
|
all_available_groups: list[GroupModel] = Groups.get_groups()
|
||||||
|
Loading…
Reference in New Issue
Block a user