Module: check_mk
Branch: master
Commit: 01edfb86aa57eb5f114e6ff648609140985adc5f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=01edfb86aa57eb…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jul 14 13:55:25 2015 +0200
#2463 Hiding not permitted actions from service discovery page when only permitted on
host
When users are only permitted on hosts/folders in WATO, the service discovery page showed
buttons and action icons which resulted in an error message when a user not having
permissions
on the services clicked on them. These action buttons are now hidden when the user is not
permitted, making the page read-only when user is only permitted to host.
---
.werks/2463 | 12 ++++++++++++
ChangeLog | 1 +
web/htdocs/wato.py | 30 ++++++++++++++++++------------
3 files changed, 31 insertions(+), 12 deletions(-)
diff --git a/.werks/2463 b/.werks/2463
new file mode 100644
index 0000000..68e2f83
--- /dev/null
+++ b/.werks/2463
@@ -0,0 +1,12 @@
+Title: Hiding not permitted actions from service discovery page when only permitted on
host
+Level: 1
+Component: wato
+Compatible: compat
+Version: 1.2.7i3
+Date: 1436874839
+Class: feature
+
+When users are only permitted on hosts/folders in WATO, the service discovery page
showed
+buttons and action icons which resulted in an error message when a user not having
permissions
+on the services clicked on them. These action buttons are now hidden when the user is
not
+permitted, making the page read-only when user is only permitted to host.
diff --git a/ChangeLog b/ChangeLog
index 643f20c..b5de20e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -76,6 +76,7 @@
* 2386 SEC: Fixed possible XSS on WATO rule edit page...
* 2373 Skip unmonitored hosts during bulk discovery...
* 2462 Users with access to host/services can now edit the disabled services rule for
their hosts/folders...
+ * 2463 Hiding not permitted actions from service discovery page when only permitted
on host...
* 2344 FIX: Improved validation of selected rules when editing BI aggregations...
* 2346 FIX: Notifications: Fixed garbled page when switching on/off
bulks/backlog/user rules
* 2372 FIX: Avoid freezing WATO during bulk discovery if hosts do not respond in a
timely manner
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index e8cc938..7a96de5 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -1450,7 +1450,10 @@ def show_hosts(folder):
if config.may("wato.rulesets"):
html.icon_button(params_url, _("View the rule based parameters of this
host"), "rulesets")
if check_host_permissions(hostname, False) == True:
- msg = _("Edit the services of this host, do a service discovery")
+ if config.may("wato.services"):
+ msg = _("Edit the services of this host, do a service
discovery")
+ else:
+ msg = _("Display the services of this host")
image = "services"
if host.get("inventory_failed"):
image = "inventory_failed"
@@ -3130,13 +3133,12 @@ def mode_inventory(phase, firsttime):
# only display for non cluster hosts
html.context_button(_("Diagnostic"),
make_link([("mode", "diag_host"),
("host", hostname)]), "diagnose")
- html.context_button(_("Full Scan"), html.makeuri([("_scan",
"yes")]))
+ if config.may("wato.services"):
+ html.context_button(_("Full Scan"),
html.makeuri([("_scan", "yes")]))
elif phase == "action":
- config.need_permission("wato.services")
check_host_permissions(hostname)
if html.check_transaction():
-
# Settings for showing parameters
if html.var("_show_parameters"):
parameter_column = True
@@ -3147,6 +3149,8 @@ def mode_inventory(phase, firsttime):
config.save_user_file("parameter_column", False)
return
+ config.need_permission("wato.services")
+
cache_options = html.var("_scan") and [ '@scan' ] or [
'@noscan' ]
new_target = "folder"
@@ -3241,10 +3245,11 @@ def show_service_table(host, firsttime):
html.button("_refresh", _("Automatic Refresh (Tabula
Rasa)"))
html.write(" ")
- if parameter_column:
- html.button("_hide_parameters", _("Hide Check
Parameters"))
- else:
- html.button("_show_parameters", _("Show Check
Parameters"))
+
+ if parameter_column:
+ html.button("_hide_parameters", _("Hide Check Parameters"))
+ else:
+ html.button("_show_parameters", _("Show Check Parameters"))
html.hidden_fields()
if html.var("_scan"):
@@ -3368,10 +3373,11 @@ def show_service_table(host, firsttime):
html.icon_button(url, _("Create rule to permanently disable this
service"), "ignore")
# Temporary ignore checkbox
- table.cell()
- if checkbox != None:
- varname = "_%s_%s" % (ct, html.varencode(item))
- html.checkbox(varname, checkbox, add_attr =
['title="%s"' % _('Temporarily ignore this service')])
+ if config.may("wato.services"):
+ table.cell()
+ if checkbox != None:
+ varname = "_%s_%s" % (ct, html.varencode(item))
+ html.checkbox(varname, checkbox, add_attr =
['title="%s"' % _('Temporarily ignore this service')])
table.end()
html.end_form()