Module: check_mk
Branch: master
Commit: 3df9326f4142e1ebe5bcf33d68b2fd87f7d10b5a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3df9326f4142e1…
Author: Sven Panne <sp(a)mathias-kettner.de>
Date: Thu Jul 7 15:40:52 2016 +0200
Fetched Livestatus from upstream.
---
livestatus/src/TableEventConsoleEvents.cc | 15 +++++++++++++++
livestatus/src/TableEventConsoleEvents.h | 5 +++++
livestatus/src/TableEventConsoleHistory.cc | 15 +++++++++++++++
livestatus/src/TableEventConsoleHistory.h | 5 +++++
4 files changed, 40 insertions(+)
diff --git a/livestatus/src/TableEventConsoleEvents.cc
b/livestatus/src/TableEventConsoleEvents.cc
index 627088e..afc8037 100644
--- a/livestatus/src/TableEventConsoleEvents.cc
+++ b/livestatus/src/TableEventConsoleEvents.cc
@@ -27,6 +27,12 @@
#include "Table.h"
#include "TableHosts.h"
+#ifdef CMC
+#include "Host.h"
+#else
+#include "auth.h"
+#endif
+
using std::string;
#ifdef CMC
@@ -122,3 +128,12 @@ const char *TableEventConsoleEvents::name() const {
const char *TableEventConsoleEvents::namePrefix() const {
return "eventconsoleevents_";
}
+
+bool TableEventConsoleEvents::isAuthorized(contact *ctc, void *data) {
+ host *host = static_cast<Row *>(data)->_host;
+#ifdef CMC
+ return host == nullptr || host->hasContact(ctc);
+#else
+ return host == nullptr || is_authorized_for(ctc, host, nullptr);
+#endif
+}
diff --git a/livestatus/src/TableEventConsoleEvents.h
b/livestatus/src/TableEventConsoleEvents.h
index 99c32e2..b16ca62 100644
--- a/livestatus/src/TableEventConsoleEvents.h
+++ b/livestatus/src/TableEventConsoleEvents.h
@@ -28,11 +28,14 @@
#include "config.h" // IWYU pragma: keep
#include "TableEventConsole.h"
class Table;
+
#ifdef CMC
#include <mutex>
+#include "cmc.h"
class Core;
class Notes;
#else
+#include "nagios.h"
class DowntimesOrComments;
#endif
@@ -56,6 +59,8 @@ public:
const DowntimesOrComments &downtimes_holder,
const DowntimesOrComments &comments_holder);
#endif
+
+ bool isAuthorized(contact *ctc, void *data) override;
};
#endif // TableEventConsoleEvents_h
diff --git a/livestatus/src/TableEventConsoleHistory.cc
b/livestatus/src/TableEventConsoleHistory.cc
index e8d318e..055a4be 100644
--- a/livestatus/src/TableEventConsoleHistory.cc
+++ b/livestatus/src/TableEventConsoleHistory.cc
@@ -26,6 +26,12 @@
#include "TableEventConsoleEvents.h"
#ifdef CMC
+#include "Host.h"
+#else
+#include "auth.h"
+#endif
+
+#ifdef CMC
TableEventConsoleHistory::TableEventConsoleHistory(
const Notes &downtimes_holder, const Notes &comments_holder,
std::recursive_mutex &holder_lock, Core *core)
@@ -66,3 +72,12 @@ const char *TableEventConsoleHistory::name() const {
const char *TableEventConsoleHistory::namePrefix() const {
return "eventconsolehistory_";
}
+
+bool TableEventConsoleHistory::isAuthorized(contact *ctc, void *data) {
+ host *host = static_cast<Row *>(data)->_host;
+#ifdef CMC
+ return host == nullptr || host->hasContact(ctc);
+#else
+ return host == nullptr || is_authorized_for(ctc, host, nullptr);
+#endif
+}
diff --git a/livestatus/src/TableEventConsoleHistory.h
b/livestatus/src/TableEventConsoleHistory.h
index 7cc6f12..8459319 100644
--- a/livestatus/src/TableEventConsoleHistory.h
+++ b/livestatus/src/TableEventConsoleHistory.h
@@ -27,11 +27,14 @@
#include "config.h" // IWYU pragma: keep
#include "TableEventConsole.h"
+
#ifdef CMC
#include <mutex>
+#include "cmc.h"
class Core;
class Notes;
#else
+#include "nagios.h"
class DowntimesOrComments;
#endif
@@ -47,6 +50,8 @@ public:
#endif
const char *name() const override;
const char *namePrefix() const override;
+
+ bool isAuthorized(contact *ctc, void *data) override;
};
#endif // TableEventConsoleHistory_h