diff options
author | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2013-04-29 15:43:57 +0200 |
---|---|---|
committer | Jeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com> | 2013-04-29 15:43:57 +0200 |
commit | d42a9205b56948ed265ea7a818281a56ba296461 (patch) | |
tree | 6146d4bfcca7d2a18ea2dbe7b99fb99a31b82b2b | |
parent | ab36c62050a7967131a7cf8e4e1719c6f449a5ca (diff) | |
download | pykolab-d42a9205b56948ed265ea7a818281a56ba296461.tar.gz |
Add a --with-ad option for the LDAP setup
-rw-r--r-- | pykolab/setup/setup_ldap.py | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/pykolab/setup/setup_ldap.py b/pykolab/setup/setup_ldap.py index acb4cea..5eb05d5 100644 --- a/pykolab/setup/setup_ldap.py +++ b/pykolab/setup/setup_ldap.py @@ -76,6 +76,14 @@ def cli_options(): help = _("Setup configuration for OpenLDAP compatibility.") ) + ldap_group.add_option( + "--with-ad", + dest = "with_ad", + action = "store_true", + default = False, + help = _("Setup configuration for Active Directory compatibility.") + ) + def description(): return _("Setup LDAP.") @@ -91,7 +99,7 @@ def execute(*args, **kw): _input = {} - if conf.with_openldap: + if conf.with_openldap and not conf.with_ad: conf.command_set('ldap', 'unique_attribute', 'entryuuid') @@ -101,6 +109,28 @@ def execute(*args, **kw): return + elif conf.with_ad and not conf.with_openldap: + conf.command_set('ldap', 'auth_attributes', 'samaccountname') + conf.command_set('ldap', 'modifytimestamp_format', '%%Y%%m%%d%%H%%M%%S.0Z') + conf.command_set('ldap', 'unique_attribute', 'userprincipalname') + + # TODO: These attributes need to be checked + conf.command_set('ldap', 'mail_attributes', 'mail') + conf.command_set('ldap', 'mailserver_attributes', 'mailhost') + conf.command_set('ldap', 'quota_attribute', 'mailquota') + + return + + elif conf.with_ad and conf.with_openldap: + print >> sys.stderr, utils.multiline_message( + _(""" + You can not configure Kolab to run against OpenLDAP + and Active Directory simultaneously. + """) + ) + + sys.exit(1) + # Pre-execution checks for path, directories, files in os.walk('/etc/dirsrv/'): for direct in directories: |