Module: check_mk
Branch: master
Commit: 9dd423b016bf26869eced8462fff222825c0dbab
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9dd423b016bf26…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Mon Jun 4 08:17:35 2012 +0200
fixed exception with custom views created by normal users
---
ChangeLog | 1 +
web/htdocs/config.py | 3 +++
web/htdocs/views.py | 5 ++++-
3 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 249d6f3..9fee8e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,7 @@
option "B" again
* FIX: preselected "refresh" option did not reflect view settings
but was simply the first available option - usually 30.
+ * FIX: fixed exception with custom views created by normal users
WATO:
* FIX: Fixed "select all" button in hosts & folders for IE
diff --git a/web/htdocs/config.py b/web/htdocs/config.py
index d4381c1..6df6cb4 100644
--- a/web/htdocs/config.py
+++ b/web/htdocs/config.py
@@ -301,6 +301,9 @@ def need_permission(pname):
"then please ask you administrator to provide you with
"
"the following permission:
'<b>%s</b>'.") % perm["title"])
+def permission_exists(pname):
+ return pname in permissions_by_name
+
def get_role_permissions():
role_permissions = {}
# Loop all permissions
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 8e35f9e..3d537b3 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -292,7 +292,10 @@ def available_views():
for (u, n), view in html.multisite_views.items():
if n not in views and view["public"] and config.user_may(u,
"publish_views"):
# Is there a builtin view with the same name? If yes, honor permissions.
- if (u, n) in html.multisite_views and not config.may("view.%s" %
n):
+ permname = "view.%s" % n
+ if (u, n) in html.multisite_views \
+ and config.permission_exists(permname) \
+ and not config.may(permname):
continue
views[n] = view