From 7c6801158dda7c987f3b75ad5673bfb2d74dcc0b Mon Sep 17 00:00:00 2001 From: Chuyen Vo Date: Thu, 17 Mar 2016 10:35:53 +0700 Subject: [PATCH] Update models.py Update AD search filter --- app/models.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/models.py b/app/models.py index 2c18969..e9a78f8 100644 --- a/app/models.py +++ b/app/models.py @@ -18,6 +18,7 @@ LDAP_URI = app.config['LDAP_URI'] LDAP_USERNAME = app.config['LDAP_USERNAME'] LDAP_PASSWORD = app.config['LDAP_PASSWORD'] LDAP_SEARCH_BASE = app.config['LDAP_SEARCH_BASE'] +LDAP_TYPE = app.config['LDAP_TYPE'] PDNS_STATS_URL = app.config['PDNS_STATS_URL'] PDNS_API_KEY = app.config['PDNS_API_KEY'] @@ -146,7 +147,10 @@ class User(db.Model): return False elif method == 'LDAP': - searchFilter = "cn=%s" % self.username + if LDAP_TYPE == 'ldap': + searchFilter = "cn=%s" % self.username + else: + searchFilter = "sammaaccount=%s" % self.username try: result = self.ldap_search(searchFilter, LDAP_SEARCH_BASE) except Exception, e: