Module: check_mk
Branch: master
Commit: 3cd2caad6d71e7391970e1edfd72ffce9b69102b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3cd2caad6d71e7…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jul 16 14:18:14 2012 +0200
Added permission to control the "clone host" feature in WATO
---
ChangeLog | 1 +
web/htdocs/wato.py | 12 +++++++++++-
2 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index c7effd3..e15e120 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
* New Checks for Siemens Blades (BX600)
WATO:
+ * Added permission to control the "clone host" feature in WATO
* FIX: remove line about number of rules in rule set overview
(that garbled the logical layout)
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 8da1a09..3e79453 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -1309,7 +1309,8 @@ def show_hosts(folder):
msg += ". " + _("The inventory of this host failed during a previous bulk inventory.")
html.icon_button(services_url, msg, image)
if config.may("wato.manage_hosts"):
- html.icon_button(clone_url, _("Create a clone of this host"), "insert")
+ if config.may("wato.clone_hosts"):
+ html.icon_button(clone_url, _("Create a clone of this host"), "insert")
html.icon_button(delete_url, _("Delete this host"), "delete")
html.write("</td>\n")
@@ -1799,6 +1800,9 @@ def mode_edithost(phase, new, cluster):
if clonename and clonename not in g_folder[".hosts"]:
raise MKGeneralException(_("You called this page with an invalid host name."))
+ if clonename and not config.may("wato.clone_hosts"):
+ raise MKAuthException(_("Sorry, you are not allowed to clone hosts."))
+
if clonename:
title = _("Create clone of %s") % clonename
host = g_folder[".hosts"][clonename]
@@ -11483,6 +11487,12 @@ def load_plugins():
"<i>Modify existing hosts</i>."),
[ "admin", "user" ])
+ config.declare_permission("wato.clone_hosts",
+ _("Clone hosts"),
+ _("Clone existing hosts to create new ones from the existing one."
+ "Please also add the permission <i>Add & remove hosts</i>."),
+ [ "admin", "user" ])
+
config.declare_permission("wato.random_hosts",
_("Create random hosts"),
_("The creation of random hosts is a facility for test and development "