Module: check_mk
Branch: master
Commit: 7e706feb537c9a9609618e190dd11a57be54d3e7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7e706feb537c9a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Feb 15 16:35:38 2018 +0100
5731 Custom icons and actions: Add new macro $USER_ID$
The macro <tt>$USER_ID</tt> has been added to the replacement mechanic of
"Custom icons and actions" URL. This macro is replaced with the ID of the
user that is currently working with the GUI.
Change-Id: Id2042fef1d2151cdbfb3c260438460d43df9a188
---
.werks/5731 | 12 ++++++++++++
web/plugins/views/painters.py | 2 ++
web/plugins/wato/check_mk_configuration.py | 1 +
3 files changed, 15 insertions(+)
diff --git a/.werks/5731 b/.werks/5731
new file mode 100644
index 0000000..7488510
--- /dev/null
+++ b/.werks/5731
@@ -0,0 +1,12 @@
+Title: Custom icons and actions: Add new macro $USER_ID$
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cre
+Version: 1.5.0i3
+Date: 1518708871
+Class: feature
+
+The macro <tt>$USER_ID</tt> has been added to the replacement mechanic of
+"Custom icons and actions" URL. This macro is replaced with the ID of the
+user that is currently working with the GUI.
diff --git a/web/plugins/views/painters.py b/web/plugins/views/painters.py
index ab13d8a..5aee065 100644
--- a/web/plugins/views/painters.py
+++ b/web/plugins/views/painters.py
@@ -67,6 +67,7 @@ import copy
import bi # Needed for BI Icon. For arkane reasons (ask htdocs/module.py) this
# cannot be imported in views.py directly.
+import config
import cmk.paths
import cmk.man_pages as man_pages
@@ -391,6 +392,7 @@ def replace_action_url_macros(url, what, row):
macros = {
"HOSTNAME" : row['host_name'],
"HOSTADDRESS" : row['host_address'],
+ "USER_ID" : config.user.id,
}
if what == 'service':
macros.update({
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index 468e61b..091396b 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -653,6 +653,7 @@ register_configvar(group,
'<li>$SERVICEDESC_URL_ENCODED$: Same as above but URL encoded</li>'
'<li>$HOSTADDRESS$:
Contains the network address of the host</li>'
'<li>$HOSTADDRESS_URL_ENCODED$: Same as above but URL encoded</li>'
+ '<li>$USER_ID$: The user
ID of the currently active user</li>'
'</ul>'),
size = 80,
),