Module: check_mk
Branch: master
Commit: cd43af2f8a0fcb71dae72eace4ae73dd6f6a01f3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cd43af2f8a0fcb…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jun 20 14:01:08 2017 +0200
Fix links from EC list views to "EC events of host" for unrelated hosts
Change-Id: Ia230e1917e3068f7a43d684f7eea49c6a5ae63b6
---
web/plugins/views/mkeventd.py | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/web/plugins/views/mkeventd.py b/web/plugins/views/mkeventd.py
index fa769b6..7e598e3 100644
--- a/web/plugins/views/mkeventd.py
+++ b/web/plugins/views/mkeventd.py
@@ -58,10 +58,19 @@ def query_ec_table(datasource, columns, add_columns, query,
only_sites, limit, t
_ec_filter_host_information_of_not_permitted_hosts(rows)
- if config.user.may("mkeventd.seeunrelated"):
- return rows # user is allowed to see all events returned by the core
+ if not config.user.may("mkeventd.seeunrelated"):
+ # user is not allowed to see all events returned by the core
+ rows = [ r for r in rows if r["event_contact_groups"] != [] or
r["host_name"] != "" ]
+
+ # Now we don't need to distinguish anymore between unrelated and related events.
We
+ # need the host_name field for rendering the views. Try our best and use the
+ # event_host value as host_name.
+ for row in rows:
+ if not row.get("host_name"):
+ row["host_name"] = row["event_host"]
+
+ return rows
- return [ r for r in rows if r["event_contact_groups"] != [] or
r["host_name"] != "" ]
# Handle the case where a user is allowed to see all events (-> events for hosts he