Module: check_mk
Branch: master
Commit: 5cea2e0d39c7019c6d65295e9e0a599514f50525
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5cea2e0d39c701…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jul 17 08:47:12 2018 +0200
6345 FIX Fixed invisible/lost notification rules when editing notification rules
When cloning notification rules or creating notification rules with identical
parameters only one of the rules was shown. The others could be hidden, but
still be in existing.
In other situations, when a user with limited permissions on notification plugins
edits the notification rules, it could happen that all notification rules that
use other plugins were deleted by accident.
These problems were introduced with werk #4167.
CMK-556
Change-Id: Icf56d0dca51d47e89a0c402819b73aaa39952704
---
.werks/6345 | 30 ++++++++++++++++++++++++++++++
cmk/gui/wato/__init__.py | 11 ++++-------
2 files changed, 34 insertions(+), 7 deletions(-)
diff --git a/.werks/6345 b/.werks/6345
new file mode 100644
index 0000000..8365bfc
--- /dev/null
+++ b/.werks/6345
@@ -0,0 +1,30 @@
+Title: Fixed invisible/lost notification rules when editing notification rules
+Level: 2
+Component: notifications
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1531472133
+
+Since werk #4167 it was possible to prevent users from configuring specific
+notification plugins by setting the notification plugin permissions to "no".
As
+a result all notification rules that use the not permitted notification plugin
+were not visible anymore to this user.
+
+This hiding of rules could be confusing and lead to bugs. We decided to show all
+rules now but prevent modifications of these rules when the user is not permitted
+to perform the modifications.
+
+When cloning notification rules or creating notification rules with identical
+parameters only one of the rules was shown. The others could be hidden, but
+still be in existing.
+
+In other situations, when a user with limited permissions on notification plugins
+edits the notification rules, it could happen that all notification rules that
+use other plugins were deleted by accident.
+
+These problems were introduced with werk #4167.
+
+CMK-556
diff --git a/cmk/gui/wato/__init__.py b/cmk/gui/wato/__init__.py
index 26dbcc9..c8f051e 100644
--- a/cmk/gui/wato/__init__.py
+++ b/cmk/gui/wato/__init__.py
@@ -7763,7 +7763,9 @@ class NotificationsMode(EventsMode):
else:
listmode = "notifications"
- if show_buttons:
+ actions_allowed = config.user.may("notification_plugin.%s" %
rule['notify_plugin'][0])
+
+ if show_buttons and actions_allowed:
anavar = html.var("analyse", "")
delete_url = make_action_link([("mode", listmode),
("user", userid), ("_delete", nr)])
drag_url = make_action_link([("mode", listmode),
("analyse", anavar), ("user", userid), ("_move", nr)])
@@ -7944,12 +7946,7 @@ class ModeNotifications(NotificationsMode):
def _get_notification_rules(self):
- rules = []
- for rule in watolib.load_notification_rules():
- if config.user.may("notification_plugin.%s" %
rule['notify_plugin'][0]) and \
- rule not in rules:
- rules.append(rule)
- return rules
+ return watolib.load_notification_rules()
def _save_notification_display_options(self):