1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-08-31 19:50:55 +00:00
Radicale/radicale/acl/authLdap.py
System User 8ad91b74b6 cn => dn
Default configuration
2010-12-02 17:58:56 +01:00

25 lines
562 B
Python

# -*- coding: utf-8 -*-
import sys, ldap, syslog
from radicale import config, log
def has_right(owner, user, password):
if user == None:
user=""
if password == None:
password=""
if owner != user:
return False
try:
l=ldap.open(LDAPSERVER, 389)
dn="%s%s,%s" % (LDAPPREPEND, user, LDAPAPPEND)
l.simple_bind_s(dn, password);
return True
except:
log.error(sys.exc_info()[0])
return False
LDAPSERVER = config.get("authLdap", "LDAPServer")
LDAPPREPEND = config.get("authLdap", "LDAPPrepend")
LDAPAPPEND = config.get("authLdap", "LDAPAppend")