configuration: add ldap support

This commit is contained in:
Jérôme Schneider 2014-09-16 21:04:58 +02:00
parent 55ce8f87c6
commit e9269d9b95
2 changed files with 20 additions and 5 deletions

View File

@ -30,6 +30,12 @@ config.read(SETTINGS_INI)
# dialect+driver://username:password@host:port/database
db_url = config.get('database', 'url')
## LDAP Backend config
ldap_url = config.get('ldap', 'url')
ldap_bind_dn = config.get('ldap', 'base_dn')
ldap_bind_password = config.get('ldap', 'bind_password')
ldap_base_dn = config.get('ldap', 'base_dn')
debug = config.getboolean('debug', 'debug')
# Log configuration
@ -140,12 +146,14 @@ mandaye_offline_toolbar = config.getboolean('mandaye', 'offline_toolbar')
# Authentic 2 auto connection
a2_auto_connection = config.getboolean('mandaye', 'a2_auto_connection')
# Choose storage
# Only mandaye.backends.sql at the moment
# Choose storage (sql or ldap)
if config.get('mandaye', 'storage_backend') == 'sql':
storage_backend = "mandaye.backends.sql"
elif config.get('mandaye', 'storage_backend') == 'ldap':
storage_backend = "mandaye.backends.ldap_back"
else:
ImproperlyConfigured('Storage backend must be sql')
ImproperlyConfigured('Storage backend must be sql or ldap')
# Encrypt service provider passwords with a secret
# You should install pycypto to use this feature

View File

@ -5,6 +5,13 @@ base_dir: .
; http://docs.sqlalchemy.org/en/rel_0_8/core/engines.html
url: sqlite:///%(base_dir)s/mandaye_vincennes.db
[ldap]
; use by ldap backend
url: ldap://127.0.0.1
bind_dn: cn=admin,dc=acompany,dc=org
bind_password: AdminPassword
base_dn: ou=mandaye,dc=acompany,dc=org
[dirs]
config_root: %(base_dir)s/conf.d
data_dir: %(base_dir)s/data
@ -23,8 +30,8 @@ sentry_dsn:
toolbar: true
offline_toolbar: false
a2_auto_connection: true
; only sql at the moment
storage_backend: sql
; sql or ldap
storage_backend: ldap
auto_decompress: true
; if you want to encypt password set to true
; you need to install pycrypto for this feature