Module: check_mk
Branch: master
Commit: 80eeefd1bddb70235d2895c34bb343c45b3b2d3f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=80eeefd1bddb70…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Jun 2 16:21:40 2015 +0200
#2262 FIX Fixed deletion of foreign views/dashboards
When a user tried to delete dashboards or views of foreign
users this was shown as being successfull, but after accessing
the list of views or dashboards again one could see that the
view or dashboard was not deleted. This has been fixed now.
---
.werks/2262 | 12 ++++++++++++
ChangeLog | 1 +
web/htdocs/visuals.py | 13 ++++++++-----
3 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/.werks/2262 b/.werks/2262
new file mode 100644
index 0000000..8116d85
--- /dev/null
+++ b/.werks/2262
@@ -0,0 +1,12 @@
+Title: Fixed deletion of foreign views/dashboards
+Level: 1
+Component: multisite
+Compatible: compat
+Version: 1.2.7i2
+Date: 1433254800
+Class: fix
+
+When a user tried to delete dashboards or views of foreign
+users this was shown as being successfull, but after accessing
+the list of views or dashboards again one could see that the
+view or dashboard was not deleted. This has been fixed now.
diff --git a/ChangeLog b/ChangeLog
index 6265ae6..8178937 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@
* 2260 Improved load time of Check_MK GUI...
* 2324 FIX: Add icon for those checks that cannot be rescheduled...
* 2261 FIX: Fixed wrong pnp template cache path in non OMD environments...
+ * 2262 FIX: Fixed deletion of foreign views/dashboards...
1.2.7i1:
diff --git a/web/htdocs/visuals.py b/web/htdocs/visuals.py
index f925efa..7a97e65 100644
--- a/web/htdocs/visuals.py
+++ b/web/htdocs/visuals.py
@@ -96,12 +96,15 @@ def load_plugins():
# | |
# '----------------------------------------------------------------------'
-def save(what, visuals):
+def save(what, visuals, user_id = None):
+ if user_id == None:
+ user_id = config.user_id
+
uservisuals = {}
- for (user_id, name), visual in visuals.items():
- if config.user_id == user_id:
+ for (owner_id, name), visual in visuals.items():
+ if user_id == owner_id:
uservisuals[name] = visual
- config.save_user_file('user_' + what, uservisuals)
+ config.save_user_file('user_' + what, uservisuals, user = user_id)
def load(what, builtin_visuals, skip_func = None):
@@ -294,7 +297,7 @@ def page_list(what, title, visuals, custom_columns = [],
c = html.confirm(_("Please confirm the deletion of
\"%s\".") % deltitle)
if c:
del visuals[(user_id, delname)]
- save(what, visuals)
+ save(what, visuals, user_id)
html.reload_sidebar()
elif c == False:
html.footer()