Module: check_mk
Branch: master
Commit: 88e4ae7bc116be425a38aac945c3d50e22be832e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=88e4ae7bc116be…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Fri Feb 28 13:49:35 2014 +0100
Allow all users to get have notification rules
---
modules/notify.py | 7 +++----
web/htdocs/wato.py | 18 +++++++++---------
2 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/modules/notify.py b/modules/notify.py
index 3467973..478f0ad 100644
--- a/modules/notify.py
+++ b/modules/notify.py
@@ -911,7 +911,6 @@ def user_notification_rules():
user_rules = []
contactnames = contacts.keys()
contactnames.sort()
- notify_log(repr(contacts))
for contactname in contactnames:
contact = contacts[contactname]
for rule in contact.get("notification_rules", []):
@@ -919,7 +918,7 @@ def user_notification_rules():
rule["contact"] = contactname
# We assume that the "contact_..." entries in the
# rule are allowed and only contain one entry of the
- # type "contact_contacts" : [ contactname ]. This
+ # type "contact_users" : [ contactname ]. This
# is handled by WATO. Contact specific rules are a
# WATO-only feature anyway...
user_rules.append(rule)
@@ -1127,8 +1126,8 @@ def rbn_rule_contacts(rule, context):
contacts.update(rbn_all_contacts())
if rule.get("contact_all_with_email"):
contacts.update(rbn_all_contacts(with_email=True))
- if "contact_contacts" in rule:
- contacts.update(rule["contact_contacts"])
+ if "contact_users" in rule:
+ contacts.update(rule["contact_users"])
if "contact_groups" in rule:
contacts.update(rbn_groups_contacts(rule["contact_groups"]))
if "contact_emails" in rule:
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index caf0daf..840c318 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -7373,7 +7373,7 @@ def vs_notification_rule(userid = None):
else:
contact_headers = [
( _("Contact Selection"), [ "contact_all",
"contact_all_with_email", "contact_object",
- "contact_contacts",
"contact_groups", "contact_emails" ] ),
+ "contact_users",
"contact_groups", "contact_emails" ] ),
]
section_contacts = [
# Contact selection
@@ -7396,10 +7396,10 @@ def vs_notification_rule(userid = None):
label = _("Notify all users that have configured an email address
in their profile"),
)
),
- ( "contact_contacts",
+ ( "contact_users",
ListOf(
- UserSelection(only_contacts = True),
- title = _("The following contacts"),
+ UserSelection(only_contacts = False),
+ title = _("The following users"),
help = _("Enter a list of user ids to be notified here. These
users need to be members "
"of at least one contact group in order to be
notified."),
movable = False,
@@ -7636,7 +7636,7 @@ def vs_notification_rule(userid = None):
optional_keys = [ "match_hosttags", "match_hosts",
"match_exclude_hosts", "match_services",
"match_exclude_services",
"match_plugin_output",
"match_timeperiod", "match_escalation",
"match_sl", "match_host_event", "match_service_event",
- "match_checktype", "contact_contacts",
"contact_groups", "contact_emails" ],
+ "match_checktype", "contact_users",
"contact_groups", "contact_emails" ],
headers = [
( _("General Properties"), [ "description",
"disabled", "allow_disable" ] ),
( _("Notification Method"), [ "notify_plugin",
"notify_method" ] ),]
@@ -7750,8 +7750,8 @@ def render_notification_rules(rules, userid="",
show_title=False, show_buttons=T
infos.append(_("all users"))
if rule.get("contact_all_with_email"):
infos.append(_("all users with and email address"))
- if rule.get("contact_contacts"):
- infos.append(_("contacts: ") + (",
".join(rule["contact_contacts"])))
+ if rule.get("contact_users"):
+ infos.append(_("users: ") + (",
".join(rule["contact_users"])))
if rule.get("contact_groups"):
infos.append(_("contact groups: ") + (",
".join(rule["contact_groups"])))
if rule.get("contact_emails"):
@@ -8101,7 +8101,7 @@ def mode_notification_rule(phase, profilemode):
rule = vs.from_html_vars("rule")
if userid:
- rule["contact_contacts"] = [ userid ] # Force selection of our
user
+ rule["contact_users"] = [ userid ] # Force selection of our user
vs.validate_value(rule, "rule")
@@ -10354,7 +10354,7 @@ def mode_users(phase):
html.icon_button(delete_url, _("Delete"), "delete")
notifications_url = make_link([("mode",
"user_notifications"), ("user", id)])
- if load_configuration_settings().get("enable_rulebased_notifications")
and user.get("contactgroups"):
+ if
load_configuration_settings().get("enable_rulebased_notifications"):
html.icon_button(notifications_url, _("Custom notification table of this
user"), "notifications")
# ID