From af629177f46fa4595175f914c971c47701d1a676 Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Thu, 23 Jul 2026 03:31:32 -0400 Subject: [PATCH] refac --- backend/open_webui/routers/users.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/backend/open_webui/routers/users.py b/backend/open_webui/routers/users.py index 029439ce3e..cff598b236 100644 --- a/backend/open_webui/routers/users.py +++ b/backend/open_webui/routers/users.py @@ -476,6 +476,23 @@ async def update_user_settings_by_session_user( # If the user is not an admin and does not have permission to use tool servers, remove the key updated_user_settings['ui'].pop('toolServers', None) + ui_notifications = ui_settings.get('notifications') if isinstance(ui_settings, dict) else None + if ( + user.role != 'admin' + and ( + 'notifications' in updated_user_settings + or (isinstance(ui_notifications, dict) and 'webhook_url' in ui_notifications) + ) + and not await has_permission( + user.id, + 'features.webhooks', + await Config.get('user.permissions'), + ) + ): + updated_user_settings.pop('notifications', None) + if isinstance(ui_notifications, dict): + ui_notifications.pop('webhook_url', None) + user = await Users.update_user_settings_by_id(user.id, updated_user_settings, db=db) if user: await publish_event(