From 681851ca6b8d5ed3226f0ce8a4f0ac390790188c Mon Sep 17 00:00:00 2001 From: Rodrigo Agundez Date: Fri, 31 Jan 2025 23:00:24 +0900 Subject: [PATCH 1/2] Configurable default role for oauth --- backend/open_webui/utils/oauth.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/backend/open_webui/utils/oauth.py b/backend/open_webui/utils/oauth.py index f60e2ff60..3a35df67f 100644 --- a/backend/open_webui/utils/oauth.py +++ b/backend/open_webui/utils/oauth.py @@ -82,7 +82,9 @@ class OAuthManager: oauth_allowed_roles = auth_manager_config.OAUTH_ALLOWED_ROLES oauth_admin_roles = auth_manager_config.OAUTH_ADMIN_ROLES oauth_roles = None - role = "pending" # Default/fallback role if no matching roles are found + role = ( + auth_manager_config.DEFAULT_USER_ROLE + ) # Default/fallback role if no matching roles are found # 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: From 1f2b5fa68fc55c58e3a50dad42f2f0d7312f64b7 Mon Sep 17 00:00:00 2001 From: Rodrigo Agundez Date: Fri, 31 Jan 2025 23:05:33 +0900 Subject: [PATCH 2/2] move comment to top --- backend/open_webui/utils/oauth.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/open_webui/utils/oauth.py b/backend/open_webui/utils/oauth.py index 3a35df67f..519f30ca7 100644 --- a/backend/open_webui/utils/oauth.py +++ b/backend/open_webui/utils/oauth.py @@ -82,9 +82,8 @@ class OAuthManager: oauth_allowed_roles = auth_manager_config.OAUTH_ALLOWED_ROLES oauth_admin_roles = auth_manager_config.OAUTH_ADMIN_ROLES oauth_roles = None - role = ( - auth_manager_config.DEFAULT_USER_ROLE - ) # Default/fallback role if no matching roles are found + # Default/fallback role if no matching roles are found + role = auth_manager_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: