Module: check_mk
Branch: master
Commit: 895ba4a007d29a64947733608e661e69d0b78864
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=895ba4a007d29a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Fri Jan 20 10:06:38 2012 +0100
Added error messages to user edit dialog to prevent notification
problems caused by incomplete configuration
---
ChangeLog | 2 ++
web/htdocs/wato.py | 16 ++++++++++++++++
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 08d4744..4dcb6e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -57,6 +57,8 @@
* Supporting localized tag titles
* Using Username as default value for full names when editing users
* Snapshot/Factory Reset is possible even with a broken config
+ * Added error messages to user edit dialog to prevent notification problems
+ caused by incomplete configuration
* FIX: Fixed missing folders in "move to" dropdown fields
* FIX: Fixed "move to target folders" after CSV import
* FIX: Fixed problem with duplicate extra_buttons when using the i18n of multiisite
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index e177317..c7a2c33 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -6597,6 +6597,22 @@ def mode_edit_user(phase):
# Notifications
new_user["notifications_enabled"] =
html.get_checkbox("notifications_enabled")
+
+ # Check if user can receive notifications
+ if new_user["notifications_enabled"]:
+ if not new_user["email"]:
+ raise MKUserError("email",
+ _('You have enabled the notifications but missed to configure a
'
+ 'Email address. You need to configure your mail address in
order '
+ 'to be able to receive emails.'))
+
+ if not new_user["contactgroups"]:
+ raise MKUserError("notifications_enabled",
+ _('You have enabled the notifications but missed to make the
'
+ 'user member of at least one contact group. You need to make
'
+ 'the user member of a contact group which has hosts assigned
'
+ 'in order to be able to receive emails.'))
+
ntp = html.var("notification_period")
if ntp not in timeperiods:
ntp = "24X7"