Module: check_mk
Branch: master
Commit: b239f0c835093a7fcdec5a74f54d8234cc757830
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b239f0c835093a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Thu Feb 7 14:33:19 2013 +0100
Added option to enforce lower User-IDs during LDAP sync
---
ChangeLog | 1 +
web/plugins/userdb/ldap.py | 6 +++++-
web/plugins/wato/check_mk_configuration.py | 8 +++++++-
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9bfbe10..f136a48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -42,6 +42,7 @@
* 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
+ * Added option to enforce lower User-IDs during LDAP sync
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 2755f9a..bb8f4cc 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -84,7 +84,7 @@ ldap_filter_map = {
def ldap_log(s):
if config.ldap_debug_log is not None:
- file(config.ldap_debug_log, "a").write('%s\n' % s)
+ file(ldap_replace_macros(config.ldap_debug_log),
"a").write('%s\n' % s)
class MKLDAPException(MKGeneralException):
pass
@@ -289,6 +289,10 @@ def ldap_get_users(add_filter = None):
raise MKLDAPException(_('The configured User-ID attribute "%s"
does not '
'exist for the user "%s"') %
(ldap_user_id_attr(), dn))
user_id = ldap_user[ldap_user_id_attr()][0]
+
+ if config.ldap_userspec.get('lower_user_ids', False):
+ user_id = user_id.lower()
+
result[user_id] = ldap_user
return result
diff --git a/web/plugins/wato/check_mk_configuration.py
b/web/plugins/wato/check_mk_configuration.py
index 59a773d..4f99b10 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -430,8 +430,14 @@ register_configvar(group,
"attribute."),
default_value = lambda: userdb.ldap_attr('user_id'),
)),
+ ("lower_user_ids", FixedValue(
+ title = _("Lower Case User-IDs"),
+ help = _("Convert imported User-IDs to lower case during
synchronisation."),
+ value = True,
+ totext = _("Enforce lower case User-IDs."),
+ )),
],
- optional_keys = ['scope', 'filter', 'user_id'],
+ optional_keys = ['scope', 'filter', 'user_id',
'lower_user_ids'],
),
domain = "multisite",
)