Module: check_mk
Branch: master
Commit: 3e9d5bc15cf71b2914795105d0c37d9128b1353d
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=3e9d5bc15cf71b…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Oct 4 11:08:08 2011 +0200
FIX: fix saving permissions bug
---
ChangeLog | 2 +
web/htdocs/check_mk.css | 44 +-----------------------------------------
web/htdocs/permissions.py | 46 +++++++++++++++++++++++++-------------------
web/htdocs/sidebar.py | 4 +-
web/htdocs/views.py | 2 +-
5 files changed, 33 insertions(+), 65 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 1550f66..a98ade4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,8 @@
Multisite:
* FIX: fix rescheduling of host check
* FIX: fix exception when using status_host while local site is offline
+ * FIX: fix URL-too-long in permissions page
+ * Cleanup permissions page optically, add comments for views and snapins
* Added some missing i18n strings in general HTML functions
* Added display_option "w" to disable limit messages and livestatus errors
in views
* Service Perfdata Sorters are sorting correctly now
diff --git a/web/htdocs/check_mk.css b/web/htdocs/check_mk.css
index 166392c..8867279 100644
--- a/web/htdocs/check_mk.css
+++ b/web/htdocs/check_mk.css
@@ -1407,48 +1407,8 @@ img.siteicon {
These styles are used on the "Edit Permissions" page
*/
-table.permissions {
- border-collapse: collapse;
- empty-cells: show;
- border-spacing: 0px;
-}
-
-table.permissions td, table.permissions th {
- border: 1px solid #fff;
- padding: 3px 0.5ex;
-}
-table.permissions th {
- text-align: left;
- background-color: #98a;
- color: #fff;
-}
-
-table.permissions td.legend {
- background-color: #769;
- color: #fff;
-}
-table.permissions td.legend.sub {
- border-top-style: none;
- border-bottom-style: none;
- background-color: #87a;
- padding-left: 1em;
- padding-top: 2px;
- padding-bottom: 0px;
-}
-table.permissions td.content {
- text-align: center;
- width: 6ex;
- vertical-align: middle;
-}
-
-table.permissions td.content.user {
- background-color: #b84;
-}
-table.permissions td.content.admin {
- background-color: #c85;
-}
-table.permissions td.content.guest {
- background-color: #d86;
+table.permissions td.legend {
+ width: 500px;
}
/*
diff --git a/web/htdocs/permissions.py b/web/htdocs/permissions.py
index a1a4e21..6cdb06e 100644
--- a/web/htdocs/permissions.py
+++ b/web/htdocs/permissions.py
@@ -53,9 +53,9 @@ def page_view_permissions():
def page_edit_permissions():
if not config.may("edit_permissions"):
- raise MKAuthException("You are not allowed to edit permissions.")
+ raise MKAuthException(_("You are not allowed to edit permissions."))
- html.header("Edit permissions")
+ html.header(_("Edit permissions"))
permissions = {}
if html.var("save"):
@@ -65,15 +65,23 @@ def page_edit_permissions():
config.save_permissions(permissions)
config.load_permissions()
- html.message("Permissions have been saved.")
+ html.message(_("Permissions have been saved."))
+ def section_header(section_title, is_open=False):
+ html.begin_foldable_container('permissions', section_title, is_open,
section_title, indent=False)
+ html.write('<table class="form permissions">\n')
+ html.write("<th>Permission</th>\n")
+ for role in config.roles:
+ html.write("<th>%s</th>" % role)
+ html.write("</tr>\n")
+
+ def section_footer():
+ html.write("</table>")
+ html.end_foldable_container()
- html.begin_form("permissions")
- html.write('<table class="form">\n')
- html.write("<th>Permission</th>\n")
- for role in config.roles:
- html.write("<th>%s</th>" % role)
- html.write("</tr>\n")
+
+ html.begin_form("permissions", method="POST")
+ section_header(_("General permissions"), True)
current_section = None
for perm in config.permissions_by_order:
@@ -82,15 +90,12 @@ def page_edit_permissions():
section = pname.split(".")[0]
section_title = config.permission_sections[section]
if section != current_section:
+ section_footer()
+ section_header(section_title)
current_section = section
- html.write('<tr><td class="legend border hilite"
colspan=%d><b>%s</b></td></tr>\n' % (len(config.roles) + 1,
section_title))
- if current_section == None:
- title = "<b>%s</b><br><i>%s</i>" %
(perm["title"], perm["description"])
- classes="legend border"
- else:
- title = perm["title"]
- classes="legend border sub"
+ title = "<b>%s</b><br><i>%s</i>" %
(perm["title"], perm["description"])
+ classes="legend border"
html.write("<tr><td class=\"%s\">%s</td>" %
(classes, title))
for role in config.roles:
@@ -100,9 +105,10 @@ def page_edit_permissions():
html.write("</td>")
html.write("</tr>\n")
- html.write('<tr><td class="legend border button"
colspan=%d>' % (1 + len(config.roles)))
- html.button("save", "Save")
- html.write("</td></tr>\n")
- html.write("</table>\n")
+ section_footer()
+
+
+ html.write("<br>")
+ html.button("save", _("Save"))
html.end_form()
html.footer()
diff --git a/web/htdocs/sidebar.py b/web/htdocs/sidebar.py
index 3a37d67..3a2bf72 100644
--- a/web/htdocs/sidebar.py
+++ b/web/htdocs/sidebar.py
@@ -45,11 +45,11 @@ def load_plugins():
load_web_plugins("sidebar", globals())
# Declare permissions: each snapin creates one permission
- config.declare_permission_section("sidesnap", "Sidebar snapins")
+ config.declare_permission_section("sidesnap", _("Sidebar
snapins"))
for name, snapin in sidebar_snapins.items():
config.declare_permission("sidesnap.%s" % name,
snapin["title"],
- "",
+ snapin["description"],
snapin["allowed"])
# Helper functions to be used by snapins
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index 8e54353..a59a8fa 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -99,7 +99,7 @@ def load_plugins():
for name, view in multisite_builtin_views.items():
config.declare_permission("view.%s" % name,
view["title"],
- "",
+ view["description"],
config.roles)
# Add painter names to painter objects (e.g. for JSON web service)