[checkmk-commits] Check_MK Git: check_mk: Restructured LDAP connection settings

git version control git at mathias-kettner.de
Wed Nov 21 14:35:07 CET 2012


Module: check_mk
Branch: master
Commit: a02cc36390e12f83d2778a51ad090741ea96f1e3
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a02cc36390e12f83d2778a51ad090741ea96f1e3

Author: Lars Michelsen <lm at mathias-kettner.de>
Date:   Fri Nov 16 15:39:12 2012 +0100

Restructured LDAP connection settings

---

 web/plugins/userdb/ldap.py                 |    4 +-
 web/plugins/wato/check_mk_configuration.py |   42 +++++++++++++--------------
 2 files changed, 22 insertions(+), 24 deletions(-)

diff --git a/web/plugins/userdb/ldap.py b/web/plugins/userdb/ldap.py
index a771ccb..00cb989 100644
--- a/web/plugins/userdb/ldap.py
+++ b/web/plugins/userdb/ldap.py
@@ -86,7 +86,7 @@ class MKLDAPException(MKGeneralException):
 ldap_connection = None
 
 def ldap_uri():
-    if config.ldap_connection.get('use_ssl', False):
+    if 'use_ssl' in config.ldap_connection:
         uri = 'ldaps://'
     else:
         uri = 'ldap://'
@@ -139,7 +139,7 @@ def ldap_connect():
 # Bind with the default credentials
 def ldap_default_bind():
     try:
-        if config.ldap_connection['bind']:
+        if 'bind' in config.ldap_connection:
             ldap_bind(ldap_replace_macros(config.ldap_connection['bind'][0]),
                       config.ldap_connection['bind'][1], catch = False)
         else:
diff --git a/web/plugins/wato/check_mk_configuration.py b/web/plugins/wato/check_mk_configuration.py
index 5bd68c7..7d68aa9 100644
--- a/web/plugins/wato/check_mk_configuration.py
+++ b/web/plugins/wato/check_mk_configuration.py
@@ -312,10 +312,11 @@ register_configvar(group,
                 maxvalue = 65535,
                 default_value = 389,
             )),
-            ("use_ssl", Checkbox(
-                title = _("Use SSL"),
-                label = _("SSL encrypted connection"),
-                help = _("Connect to the LDAP server with a SSL encrypted connection."),
+            ("use_ssl", FixedValue(
+                title  = _("Use SSL"),
+                help   = _("Connect to the LDAP server with a SSL encrypted connection."),
+                value  = True,
+                totext = _("Encrypt the network connection using SSL."),
             )),
             ("version", Integer(
                 title = _("LDAP Version"),
@@ -335,22 +336,7 @@ register_configvar(group,
                     ("openldap", _("OpenLDAP")),
                 ],
             )),
-            ("bind", Optional(
-                Tuple(
-                    elements = [
-                        LDAPDistinguishedName(
-                            title = _("Bind DN"),
-                            help  = _("Specify the distinguished name to be used to bind to "
-                                      "the LDAP directory."),
-                            size = 80,
-                        ),
-                        Password(
-                            title = _("Bind Password"),
-                            help  = _("Specify the password to be used to bind to "
-                                      "the LDAP directory."),
-                        ),
-                    ],
-                ),
+            ("bind", Tuple(
                 title = _("LDAP Bind Credentials"),
                 help  = _("Set the credentials to be used to connect to the LDAP server. The "
                           "used account must not be allowed to do any changes in the directory "
@@ -359,10 +345,22 @@ register_configvar(group,
                           "case you don't have to configure anything here."
                           "It must be possible to list all needed user and group objects from the "
                           "directory."),
-                label = _("Specify bind credentials"),
+                elements = [
+                    LDAPDistinguishedName(
+                        title = _("Bind DN"),
+                        help  = _("Specify the distinguished name to be used to bind to "
+                                  "the LDAP directory."),
+                        size = 80,
+                    ),
+                    Password(
+                        title = _("Bind Password"),
+                        help  = _("Specify the password to be used to bind to "
+                                  "the LDAP directory."),
+                    ),
+                ],
             )),
         ],
-        optional_keys = [],
+        optional_keys = ['use_ssl', 'bind', ],
     ),
     domain = "multisite",
 )



More information about the checkmk-commits mailing list