From ceed81a026bde861ed0f71200752a4778274632c Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Fri, 18 Sep 2026 00:47:22 +0200 Subject: [PATCH] refac: read the OAuth roles claim whenever an allowed-roles list is configured Role extraction was gated on the admin-roles list as well, so clearing that list stopped the allowed-roles list being evaluated at all. Extraction now depends on the allowed-roles list alone, which is the setting that decides who may sign in; the admin-roles list keeps doing nothing but mapping a role. Instances that set an allowed-roles list and no admin roles will start assigning the user role from the list, and existing admins there are written down to user on their next OAuth sign-in, which is what that configuration asks for. --- backend/open_webui/utils/oauth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/open_webui/utils/oauth.py b/backend/open_webui/utils/oauth.py index 3bcda023e3..ed24b32e87 100644 --- a/backend/open_webui/utils/oauth.py +++ b/backend/open_webui/utils/oauth.py @@ -1530,7 +1530,7 @@ class OAuthManager: role = user.role if user else auth_config.DEFAULT_USER_ROLE # Next block extracts the roles from the user data, accepting nested claims of any depth - if oauth_claim and oauth_allowed_roles and oauth_admin_roles: + if oauth_claim and oauth_allowed_roles: claim_data = user_data nested_claims = oauth_claim.split('.') for nested_claim in nested_claims: