Module: check_mk
Branch: master
Commit: 9281588f2b5c092e9297aa24aebcbf0543ea7caa
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9281588f2b5c09…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Feb 27 13:55:49 2013 +0100
Views: new permission general.see_user_views
---
ChangeLog | 3 +++
web/htdocs/default_permissions.py | 5 +++++
web/htdocs/views.py | 20 +++++++++++---------
3 files changed, 19 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 6e72926..6d1eedb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,9 +7,12 @@
* New availability view for arbitrary host/service collections
* New option auth_by_http_header to use the value of a HTTP header
variable for authentication (Useful in reverse proxy environments)
+ * New permission that is needed for seeing views that other users
+ have defined (per default this is contained in all roles)
Event Console:
* New rule feature: automatically delete event after actions
+ * New filter for maximum services level (minimum already existed)
Checks & Agents:
* solaris_mem: New check for memory and swap for Solaris agent
diff --git a/web/htdocs/default_permissions.py b/web/htdocs/default_permissions.py
index 43761d8..ce35a3c 100644
--- a/web/htdocs/default_permissions.py
+++ b/web/htdocs/default_permissions.py
@@ -67,6 +67,11 @@ def load():
_("Make views visible and usable for other users"),
[ "admin", "user" ])
+ config.declare_permission("general.see_user_views",
+ _("See user views"),
+ _("Is needed for seeing views that other users have created."),
+ [ "admin", "user", "guest" ])
+
config.declare_permission("general.force_views",
_("Modify builtin views"),
_("Make own published views override builtin views for all users"),
diff --git a/web/htdocs/views.py b/web/htdocs/views.py
index d20b603..db2602f 100644
--- a/web/htdocs/views.py
+++ b/web/htdocs/views.py
@@ -293,15 +293,17 @@ def available_views():
views[n] = view
# 4. other users views, if public. Sill make sure we honor permission
- # for builtin views
- for (u, n), view in html.multisite_views.items():
- if n not in views and view["public"] and config.user_may(u, "general.publish_views"):
- # Is there a builtin view with the same name? If yes, honor permissions.
- permname = "view.%s" % n
- if config.permission_exists(permname) \
- and not config.may(permname):
- continue
- views[n] = view
+ # for builtin views. Also the permission "general.see_user_views" is
+ # necessary.
+ if config.may("general.see_user_views"):
+ for (u, n), view in html.multisite_views.items():
+ if n not in views and view["public"] and config.user_may(u, "general.publish_views"):
+ # Is there a builtin view with the same name? If yes, honor permissions.
+ permname = "view.%s" % n
+ if config.permission_exists(permname) \
+ and not config.may(permname):
+ continue
+ views[n] = view
return views
Module: check_mk
Branch: master
Commit: 7b98d47e5880afc87984d6de678ad21408d6f0ef
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7b98d47e5880af…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Wed Feb 27 09:02:54 2013 +0100
Added skeleton for empty check
---
doc/skeleton_check | 43 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/doc/skeleton_check b/doc/skeleton_check
new file mode 100644
index 0000000..be9172f
--- /dev/null
+++ b/doc/skeleton_check
@@ -0,0 +1,43 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+# Example output from agent:
+# Put here the example output from your TCP-Based agent. If the
+# check is SNMP-Based, then remove this section
+
+def inventory_foobars(info):
+ return []
+
+def check_foobar(item, _no_params, info):
+ return 3, "UNKNOWN - Check no implemented"
+
+check_info["foobar"] = {
+ "check_function" : check_foobar,
+ "inventory_function" : inventory_foobar,
+ "service_description" : "FOOBAR",
+ "has_perfdata" : False,
+}
+