mirror of
https://github.com/kakwa/ldapcherry
synced 2024-11-22 01:14:21 +01:00
adding small example for backend ldap
This commit is contained in:
parent
63062be433
commit
b65fe7bc7b
34
misc/debug_ldapbackend.py
Normal file
34
misc/debug_ldapbackend.py
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import with_statement
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
import sys
|
||||||
|
from sets import Set
|
||||||
|
from ldapcherry.backend.backendLdap import Backend
|
||||||
|
from ldapcherry import syslog_error
|
||||||
|
from ldapcherry.exceptions import *
|
||||||
|
import cherrypy
|
||||||
|
from ldap import SERVER_DOWN
|
||||||
|
|
||||||
|
cfg = {
|
||||||
|
'module' : 'ldapcherry.backend.ldap',
|
||||||
|
'groupdn' : 'ou=group,dc=example,dc=org',
|
||||||
|
'userdn' : 'ou=People,dc=example,dc=org',
|
||||||
|
'binddn' : 'cn=dnscherry,dc=example,dc=org',
|
||||||
|
'password' : 'password',
|
||||||
|
'uri' : 'ldap://ldap.ldapcherry.org:390',
|
||||||
|
'ca' : './tests/test_env/etc/ldapcherry/TEST-cacert.pem',
|
||||||
|
'starttls' : 'off',
|
||||||
|
'checkcert' : 'off',
|
||||||
|
'user_filter_tmpl' : '(uid=%(username)s)',
|
||||||
|
'group_filter_tmpl' : '(member=%(userdn)s)',
|
||||||
|
}
|
||||||
|
|
||||||
|
cherrypy.log.error = syslog_error
|
||||||
|
attr = ['shéll', 'cn', 'uid', 'uidNumber', 'gidNumber', 'home', 'userPassword', 'givenName', 'email', 'sn']
|
||||||
|
|
||||||
|
inv = Backend(cfg, cherrypy.log, 'ldap', attr)
|
||||||
|
print inv.get_user('jwatson')
|
Loading…
Reference in New Issue
Block a user