mirror of
https://github.com/Kozea/Radicale.git
synced 2025-09-15 20:36:55 +00:00
Logging
This commit is contained in:
parent
8a86f57304
commit
50919133ac
6 changed files with 64 additions and 5 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
import sys, ldap
|
||||
|
||||
from radicale import config
|
||||
from radicale import config, log
|
||||
|
||||
def has_right(owner, user, password):
|
||||
if user == None:
|
||||
|
@ -12,11 +12,15 @@ def has_right(owner, user, password):
|
|||
if owner != user:
|
||||
return False
|
||||
try:
|
||||
log.log(10, "Open LDAP server connexion")
|
||||
l=ldap.open(LDAPSERVER, 389)
|
||||
cn="%s%s,%s" % (LDAPPREPEND, user, LDAPAPPEND)
|
||||
log.log(10, "LDAP bind with dn: %s" %(cn))
|
||||
l.simple_bind_s(cn, password);
|
||||
log.log(20, "LDAP bind Ok")
|
||||
return True
|
||||
except:
|
||||
log.log(40, "LDAP bind error")
|
||||
return False
|
||||
|
||||
LDAPSERVER = config.get("authLdap", "LDAPServer")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue