Module: check_mk
Branch: master
Commit: d7332b1053403a089a9e342ee241d51322a4da4e
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=d7332b1053403a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed Aug 30 13:35:00 2017 +0200
5056 FIX WATO: Wrong list of groups shown on user edit page when syncing groups via LDAP
The locked contact group list on the edit user page was listing too many groups when
using the contact group plugin of the LDAP sync.
Change-Id: I17c0253b1805f1f87c4155c6a6f600ac16e546fe
---
.werks/5056 | 12 ++++++++++++
web/htdocs/wato.py | 13 ++++++-------
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/.werks/5056 b/.werks/5056
new file mode 100644
index 0000000..dfcb0d8
--- /dev/null
+++ b/.werks/5056
@@ -0,0 +1,12 @@
+Title: WATO: Wrong list of groups shown on user edit page when syncing groups via LDAP
+Level: 1
+Component: multisite
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.5.0i1
+Date: 1504092814
+
+The locked contact group list on the edit user page was listing too many groups when
+using the contact group plugin of the LDAP sync.
diff --git a/web/htdocs/wato.py b/web/htdocs/wato.py
index dead87c..6e0f953 100644
--- a/web/htdocs/wato.py
+++ b/web/htdocs/wato.py
@@ -11024,23 +11024,22 @@ def mode_edit_user(phase):
html.write(_("Please first create some <a href='%s'>contact
groups</a>") %
groups_page_url)
else:
- entries = sorted([ (group['alias'], c) for c, group in
contact_groups.items() ])
+ entries = sorted([ (group['alias'] or c, c) for c, group in
contact_groups.items() ])
is_member_of_at_least_one = False
for alias, gid in entries:
- if not alias:
- alias = gid
+ is_member = gid in user.get("contactgroups", [])
if not is_locked('contactgroups'):
html.checkbox("cg_" + gid, gid in
user.get("contactgroups", []))
else:
- is_member = gid in user.get("contactgroups", [])
if is_member:
is_member_of_at_least_one = True
html.hidden_field("cg_" + gid, '1' if is_member else
'')
- url = folder_preserving_link([("mode",
"edit_contact_group"), ("edit", gid)])
- html.a(alias, href=url)
- html.br()
+ if not is_locked('contactgroups') or is_member:
+ url = folder_preserving_link([("mode",
"edit_contact_group"), ("edit", gid)])
+ html.a(alias, href=url)
+ html.br()
if is_locked('contactgroups') and not is_member_of_at_least_one:
html.i(_('No contact groups assigned.'))