Module: check_mk
Branch: master
Commit: c15b19e259894ed028d751dca7b41fad99fe976a
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=c15b19e259894e…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Feb 21 16:11:43 2012 +0100
FIX: honor write permissions on folder in "bulk delete"
---
.bugs/619 | 7 +++++--
ChangeLog | 1 +
web/htdocs/wato.py | 14 +++++++++++---
3 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/.bugs/619 b/.bugs/619
index 5cfca54..50dd1eb 100644
--- a/.bugs/619
+++ b/.bugs/619
@@ -1,8 +1,11 @@
Title: Bulk löschen berücksichtigt die Nutzer Rechte nicht
Component: wato
-State: open
+Class: bug
+State: done
Date: 2012-01-18 10:28:38
Targetversion: 1.2.0
-Class: bug
Ich kann als Nutzer ohne Rechte auf die Hosts in einem Folder alle Hosts löschen.
+
+2012-02-21 16:11:13: changed state open -> done
+Ist erledigt, wird nun geprüft.
diff --git a/ChangeLog b/ChangeLog
index b79678a..3ef1d85 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -23,6 +23,7 @@
* FIX: Do load *all* users from htpasswd, so passwords from
users not created via WATO will not be lost.
* FIX: honor site disabling in replication module
+ * FIX: honor write permissions on folder in "bulk delete"
Checks & Agents:
* hpux_if: fix missing default parameter errors
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 5d3b2a2..d8617f5 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -848,6 +848,7 @@ def mode_folder(phase):
# Deletion
if html.var("_bulk_delete"):
config.need_permission("wato.manage_hosts")
+ check_folder_permissions(g_folder, "write")
return delete_hosts_after_confirm(selected_hosts)
# Move
@@ -974,9 +975,16 @@ def check_folder_permissions(folder, how, exception=True, user =
None):
if c in cgs:
return True
- reason = _("Sorry, you have no permission on the folder
'<b>%s</b>'. The folder's contact "
- "groups are <b>%s</b>, your contact groups are
<b>%s</b>.") % \
- (folder["title"], ", ".join(cgs), ",
".join(user_cgs))
+ reason = _("Sorry, you have no permission on the folder
'<b>%s</b>'. " % folder["title"])
+ if not cgs:
+ reason += _("The folder has no contact groups assigned to.")
+ else:
+ reason += _("The folder's contact groups are <b>%s</b>.
" % ", ".join(cgs))
+ if user_cgs:
+ reason += _("Your contact groups are <b>%s</b>.") %
", ".join(user_cgs)
+ else:
+ reason += _("But you are not a member of any contact group.")
+
if exception:
raise MKAuthException(reason)
else: