diff --git a/frappe/core/doctype/user/user.py b/frappe/core/doctype/user/user.py index f22c62050e..cdb3e394ee 100644 --- a/frappe/core/doctype/user/user.py +++ b/frappe/core/doctype/user/user.py @@ -248,7 +248,7 @@ class User(Document): frappe.local.login_manager.logout(user=self.name) # toggle notifications based on the user's status - toggle_notifications(self.name, enable=cint(self.enabled)) + toggle_notifications(self.name, enable=cint(self.enabled), ignore_permissions=True) def add_system_manager_role(self): if self.is_system_manager_disabled(): diff --git a/frappe/desk/doctype/notification_settings/notification_settings.py b/frappe/desk/doctype/notification_settings/notification_settings.py index 45b946ec28..431c94f53d 100644 --- a/frappe/desk/doctype/notification_settings/notification_settings.py +++ b/frappe/desk/doctype/notification_settings/notification_settings.py @@ -70,7 +70,7 @@ def create_notification_settings(user): _doc.insert(ignore_permissions=True) -def toggle_notifications(user: str, enable: bool = False): +def toggle_notifications(user: str, enable: bool = False, ignore_permissions=False): try: settings = frappe.get_doc("Notification Settings", user) except frappe.DoesNotExistError: @@ -79,7 +79,7 @@ def toggle_notifications(user: str, enable: bool = False): if settings.enabled != enable: settings.enabled = enable - settings.save() + settings.save(ignore_permissions=ignore_permissions) @frappe.whitelist()