1
0
Fork 0
mirror of https://github.com/Kozea/Radicale.git synced 2025-07-02 16:58:30 +00:00
Radicale/radicale/acl/authLdap.py

25 lines
518 B
Python
Raw Normal View History

2010-12-02 10:01:09 +01:00
# -*- coding: utf-8 -*-
import sys, ldap
from radicale import config
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)
cn="%s%s,%s" % (LDAPPREPEND, user, LDAPAPPEND)
l.simple_bind_s(cn, password);
return True
except:
return False
LDAPSERVER = config.get("authLdap", "LDAPServer")
LDAPPREPEND = config.get("authLdap", "LDAPPrepend")
LDAPAPPEND = config.get("authLdap", "LDAPAppend")