Module: check_mk
Branch: master
Commit: 7d594fddb66f92b2dc9185a2f8c6fd41ec34af2c
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7d594fddb66f92…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Feb 7 14:01:49 2013 +0100
The ldap member attribute of groups is now configruable via WATO
---
ChangeLog | 1 +
web/plugins/userdb/ldap.py | 5 ++++-
web/plugins/wato/check_mk_configuration.py | 9 +++++++--
3 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 47a2a5a..533974d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -41,6 +41,7 @@
is deprecated in python > 2.5 to prevent warning messages in apache error log
* Added host filter for "last host state change" and "last host
check"
* FIX: Preventing autocomplete in password fields of "edit profile" dialog
+ * The ldap member attribute of groups is now configruable via WATO
BI:
* Use Ajax to delay rendering of invisible parts of the tree (this
diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index 810e3b6..2755f9a 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -246,6 +246,9 @@ def ldap_replace_macros(tmpl):
def ldap_user_id_attr():
return config.ldap_userspec.get('user_id', ldap_attr('user_id'))
+def ldap_member_attr():
+ return config.ldap_groupspec.get('member', ldap_attr('member'))
+
def ldap_get_user(username, no_escape = False):
if username in g_ldap_user_cache:
return g_ldap_user_cache[username]
@@ -303,7 +306,7 @@ def ldap_user_groups(username, attr = 'cn'):
# Apply configured group ldap filter and only reply with groups
# having the current user as member
- filt = '(&%s(%s=%s))' % (ldap_filter('groups'),
ldap_attr('member'),
+ filt = '(&%s(%s=%s))' % (ldap_filter('groups'),
ldap_member_attr(),
ldap.filter.escape_filter_chars(user_dn))
# First get all groups
groups_cn = []
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index f0fea9e..59a773d 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -424,7 +424,7 @@ register_configvar(group,
default_value = lambda: userdb.ldap_filter('users', False),
)),
("user_id", TextAscii(
- title = _("User-ID Attrubute"),
+ title = _("User-ID Attribute"),
help = _("The attribute used to identify the individual users. It
must have "
"unique values to make an user identifyable by the value
of this "
"attribute."),
@@ -469,8 +469,13 @@ register_configvar(group,
size = 80,
default_value = lambda: userdb.ldap_filter('groups', False),
)),
+ ("member", TextAscii(
+ title = _("Member Attribute"),
+ help = _("The attribute used to identify users group
memberships."),
+ default_value = lambda: userdb.ldap_attr('member'),
+ )),
],
- optional_keys = ['scope', 'filter'],
+ optional_keys = ['scope', 'filter', 'member'],
),
domain = "multisite",
)