Module: check_mk
Branch: master
Commit: 6958613bf7925c623d64f0f72762cf45a5ac1ab0
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=6958613bf7925c…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Apr 4 22:15:46 2018 +0200
5944 FIX Fixed broken HTTP header auth for not yet existing users
This was broken since ~1.5.0i3. When a user which has not been created
in Check_MK before is being authenticated using the optional HTTP header
authentication and logged in using the "default user profile", some
host- and service views were not working as expected. They were showing
some exception like "KeyError: u'<USER>'".
A workaround in the affected versions is to create the user accounts
before the user try to access the GUI.
Change-Id: I950453b8de15b2d5cc628169f84420e85591b1e3
---
.werks/5944 | 17 +++++++++++++++++
web/htdocs/userdb.py | 2 +-
2 files changed, 18 insertions(+), 1 deletion(-)
diff --git a/.werks/5944 b/.werks/5944
new file mode 100644
index 0000000..c8a3b2a
--- /dev/null
+++ b/.werks/5944
@@ -0,0 +1,17 @@
+Title: Fixed broken HTTP header auth for not yet existing users
+Level: 1
+Component: multisite
+Compatible: compat
+Edition: cre
+Version: 1.5.0i4
+Date: 1522872782
+Class: fix
+
+This was broken since ~1.5.0i3. When a user which has not been created
+in Check_MK before is being authenticated using the optional HTTP header
+authentication and logged in using the "default user profile", some
+host- and service views were not working as expected. They were showing
+some exception like "KeyError: u'<USER>'".
+
+A workaround in the affected versions is to create the user accounts
+before the user try to access the GUI.
diff --git a/web/htdocs/userdb.py b/web/htdocs/userdb.py
index ce3fca9..be52ffa 100644
--- a/web/htdocs/userdb.py
+++ b/web/htdocs/userdb.py
@@ -906,7 +906,7 @@ def contactgroups_of_user(user_id):
user = load_cached_profile()
if user == None:
# No cached profile present. Load all users to get the users data
- user = load_users(lock=False)[user_id]
+ user = load_users(lock=False).get(user_id, {})
return user.get("contactgroups", [])