diff --git a/backend/open_webui/routers/auths.py b/backend/open_webui/routers/auths.py index 88176b188d..af45552cae 100644 --- a/backend/open_webui/routers/auths.py +++ b/backend/open_webui/routers/auths.py @@ -504,7 +504,7 @@ async def ldap_auth( user = Auths.authenticate_user_by_email(email, db=db) if user: - if user.role != 'admin' and ENABLE_LDAP_GROUP_MANAGEMENT and user_groups: + if ENABLE_LDAP_GROUP_MANAGEMENT and user_groups: if ENABLE_LDAP_GROUP_CREATION: Groups.create_groups_by_group_names(user.id, user_groups, db=db) try: @@ -565,7 +565,7 @@ async def signin( ) user = Auths.authenticate_user_by_email(email, db=db) - if WEBUI_AUTH_TRUSTED_GROUPS_HEADER and user and user.role != 'admin': + if WEBUI_AUTH_TRUSTED_GROUPS_HEADER and user: group_names = request.headers.get(WEBUI_AUTH_TRUSTED_GROUPS_HEADER, '').split(',') group_names = [name.strip() for name in group_names if name.strip()] diff --git a/backend/open_webui/utils/oauth.py b/backend/open_webui/utils/oauth.py index cfe7c429e5..0b4a1d55e0 100644 --- a/backend/open_webui/utils/oauth.py +++ b/backend/open_webui/utils/oauth.py @@ -1508,7 +1508,7 @@ class OAuthManager: data={'id': user.id}, expires_delta=parse_duration(auth_manager_config.JWT_EXPIRES_IN), ) - if auth_manager_config.ENABLE_OAUTH_GROUP_MANAGEMENT and user.role != 'admin': + if auth_manager_config.ENABLE_OAUTH_GROUP_MANAGEMENT: self.update_user_groups( user=user, user_data=user_data,