Module: check_mk
Branch: master
Commit: 03de22be93ac95292d29d9b4e857013046f00048
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=03de22be93ac95…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Apr 16 11:09:32 2012 +0200
WATO: Added wato_hidden_users config option to hide the given users from WATO GUI
---
web/htdocs/config.py | 1 +
web/htdocs/wato.py | 14 ++++++++++----
2 files changed, 11 insertions(+), 4 deletions(-)
diff --git a/web/htdocs/config.py b/web/htdocs/config.py
index 4d161cb..db8955b 100644
--- a/web/htdocs/config.py
+++ b/web/htdocs/config.py
@@ -621,6 +621,7 @@ wato_num_hostspecs = 12
wato_num_itemspecs = 15
wato_activation_method = 'restart'
wato_write_nagvis_auth = False
+wato_hidden_users = []
# ____ ___
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index 6dc267e..b0de0e2 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -4917,7 +4917,7 @@ def mode_groups(phase, what):
# Show member of contact groups
if what == "contact":
- users = load_users()
+ users = filter_hidden_users(load_users())
members = {}
for userid, user in users.items():
cgs = user.get("contactgroups", [])
@@ -6654,7 +6654,7 @@ def mode_users(phase):
return
roles = load_roles()
- users = load_users()
+ users = filter_hidden_users(load_users())
timeperiods = load_timeperiods()
contact_groups = load_group_information().get("contact", {})
@@ -7139,6 +7139,12 @@ def mode_edit_user(phase):
html.hidden_fields()
html.end_form()
+def filter_hidden_users(users):
+ if config.wato_hidden_users:
+ return dict([ (id, user) for id, user in users.items() if id not in
config.wato_hidden_users ])
+ else:
+ return users
+
def load_users():
# First load monitoring contacts from Check_MK's world
filename = root_dir + "contacts.mk"
@@ -7329,7 +7335,7 @@ class UserSelection(ElementSelection):
ElementSelection.__init__(self, **kwargs)
def get_elements(self):
- users = load_users()
+ users = filter_hidden_users(load_users())
elements = dict([ (name, "%s - %s" % (name, us.get("alias",
name))) for (name, us) in users.items() ])
return elements
@@ -7373,7 +7379,7 @@ def mode_roles(phase):
return
roles = load_roles()
- users = load_users()
+ users = filter_hidden_users(load_users())
if phase == "action":
if html.var("_delete"):