Module: check_mk
Branch: master
Commit: b0c726668faf9935a11c9e480195215fa7c29e19
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b0c726668faf99…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Aug 21 10:24:39 2014 +0200
#1155 NagVis map edit/view permissions can now be set using roles
The view and edit permissions of specific NagVis maps of the local
NagVis installation can now be managed using multisite roles. Each
role can get individual read / modify permissions assigned for each
NagVis map.
This feature is only available in OMD environments.
---
.werks/1155 | 14 ++++++++++++++
ChangeLog | 1 +
web/plugins/wato/nagvis_auth.py | 36 ++++++++++++++++++++++++++++++------
3 files changed, 45 insertions(+), 6 deletions(-)
diff --git a/.werks/1155 b/.werks/1155
new file mode 100644
index 0000000..8524fb4
--- /dev/null
+++ b/.werks/1155
@@ -0,0 +1,14 @@
+Title: NagVis map edit/view permissions can now be set using roles
+Level: 1
+Component: wato
+Compatible: compat
+Version: 1.2.5i6
+Date: 1408609367
+Class: feature
+
+The view and edit permissions of specific NagVis maps of the local
+NagVis installation can now be managed using multisite roles. Each
+role can get individual read / modify permissions assigned for each
+NagVis map.
+
+This feature is only available in OMD environments.
diff --git a/ChangeLog b/ChangeLog
index c9d4a7a..f977d72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -55,6 +55,7 @@
WATO:
* 1096 New WATO webservices: manage hosts via webinterface...
+ * 1155 NagVis map edit/view permissions can now be set using roles...
* 1064 FIX: Fixed rare issue with WATO communication in distributed setups (different
OS versions)...
* 1089 FIX: Snapshot restore: fixed exception during exception handling......
* 1091 FIX: logwatch patterns: allow unicode text in pattern comment
diff --git a/web/plugins/wato/nagvis_auth.py b/web/plugins/wato/nagvis_auth.py
index d3d66cc..a91f53c 100644
--- a/web/plugins/wato/nagvis_auth.py
+++ b/web/plugins/wato/nagvis_auth.py
@@ -36,16 +36,16 @@ config.declare_permission(
)
config.declare_permission(
- 'nagvis.Map_view_*',
- _('View all maps'),
- _('Grants read access to all maps.'),
+ 'nagvis.Rotation_view_*',
+ _('Use all map rotations'),
+ _('Grants read access to all rotations.'),
[ 'guest' ]
)
config.declare_permission(
- 'nagvis.Rotation_view_*',
- _('Use all map rotations'),
- _('Grants read access to all rotations.'),
+ 'nagvis.Map_view_*',
+ _('View all maps'),
+ _('Grants read access to all maps.'),
[ 'guest' ]
)
@@ -62,3 +62,27 @@ config.declare_permission(
_('Permits to delete all maps.'),
[]
)
+
+# Find all NagVis maps in the local installation to register permissions
+# for each map. When no maps can be found skip this problem silently.
+# This only works in OMD environments.
+
+if defaults.omd_root:
+ nagvis_maps_path = defaults.omd_root + '/etc/nagvis/maps'
+ for f in os.listdir(nagvis_maps_path):
+ if f[0] != '.' and f.endswith('.cfg'):
+ map_name = f[:-4]
+
+ config.declare_permission(
+ 'nagvis.Map_view_%s' % map_name,
+ _('Map %s: view') % map_name,
+ _('Grants read access to the NagVis map %s.') % map_name,
+ [ 'guest' ]
+ )
+
+ config.declare_permission(
+ 'nagvis.Map_edit_%s' % map_name,
+ _('Map %s: edit') % map_name,
+ _('Grants modify access to the NagVis map %s.') % map_name,
+ [ ]
+ )