diff --git a/backend/open_webui/main.py b/backend/open_webui/main.py index f0aeeab02a5..07bc4780f9a 100644 --- a/backend/open_webui/main.py +++ b/backend/open_webui/main.py @@ -1869,7 +1869,7 @@ async def get_app_config(request: Request): else {} ), } - if user is not None and (user.role in ["admin", "user"]) + if user is not None and (user.role in ["admin", "user", "builder", "local-admin"]) else { **( { diff --git a/backend/open_webui/utils/auth.py b/backend/open_webui/utils/auth.py index e34803ade1b..aa2d867078d 100644 --- a/backend/open_webui/utils/auth.py +++ b/backend/open_webui/utils/auth.py @@ -350,7 +350,7 @@ def get_current_user_by_api_key(api_key: str): def get_verified_user(user=Depends(get_current_user)): - if user.role not in {"user", "admin"}: + if user.role not in {"user", "admin", "builder", "local-admin"}: raise HTTPException( status_code=status.HTTP_401_UNAUTHORIZED, detail=ERROR_MESSAGES.ACCESS_PROHIBITED, diff --git a/backend/open_webui/utils/oauth.py b/backend/open_webui/utils/oauth.py index 392f4cd4bfb..bca20257ebe 100644 --- a/backend/open_webui/utils/oauth.py +++ b/backend/open_webui/utils/oauth.py @@ -996,8 +996,12 @@ def get_user_role(self, user, user_data): for allowed_role in oauth_allowed_roles: # If the user has any of the allowed roles, assign the role "user" if allowed_role in oauth_roles: - log.debug("Assigned user the user role") - role = "user" + log.debug(f"Using first role from OAuth: {oauth_roles[0]}") + first_role = oauth_roles[0] + if first_role == "end-user": + role = "user" + else: + role = first_role break for admin_role in oauth_admin_roles: # If the user has any of the admin roles, assign the role "admin" diff --git a/src/lib/components/admin/Users/UserList/EditUserModal.svelte b/src/lib/components/admin/Users/UserList/EditUserModal.svelte index 9adbac0e4f6..a4d2bb58efe 100644 --- a/src/lib/components/admin/Users/UserList/EditUserModal.svelte +++ b/src/lib/components/admin/Users/UserList/EditUserModal.svelte @@ -143,9 +143,11 @@ disabled={_user.id == sessionUser.id} required > - - - + + + + + diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index 1ab228c656a..bf47bef190f 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -150,7 +150,7 @@ await goto('/auth'); return; } - if (!['user', 'admin'].includes($user?.role)) { + if (['pending'].includes($user?.role)) { return; } @@ -322,7 +322,7 @@
- {#if !['user', 'admin'].includes($user?.role)} + {#if ['pending'].includes($user?.role)} {:else} {#if localDBChats.length > 0}