From 71793eed1cbda489210cb71a1794267f4aef5a62 Mon Sep 17 00:00:00 2001
From: admiralobvious <aferlandqc@gmail.com>
Date: Sat, 6 Sep 2014 14:06:02 -0400
Subject: [PATCH] Make sure we check for lower AND upper case prefix

Fixes #3.
---
 docs/index.rst               | 15 +++++++++++++++
 flask_simpleldap/__init__.py |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/docs/index.rst b/docs/index.rst
index 6b3e774..dc74f68 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -95,3 +95,18 @@ Classes
 
 .. autoclass:: flask_simpleldap.LDAP
    :members:
+
+
+History
+-------
+
+Changes:
+
+- 0.1.1: September 6, 2014
+
+  - Fix GitHub issue `#3<https://github.com/admiralobvious/flask-simpleldap/issues/3>`_,
+    Not compatible with uppercase distinguished names.
+
+- 0.1: August 9, 2014
+
+  - Initial Release
\ No newline at end of file
diff --git a/flask_simpleldap/__init__.py b/flask_simpleldap/__init__.py
index 7d3ab33..be9171a 100644
--- a/flask_simpleldap/__init__.py
+++ b/flask_simpleldap/__init__.py
@@ -188,7 +188,7 @@ class LDAP(object):
             if records:
                 if current_app.config['LDAP_USER_GROUPS_FIELD'] in records[0][1]:
                     groups = records[0][1][current_app.config['LDAP_USER_GROUPS_FIELD']]
-                    result = [re.findall('cn=(.*?),', group)[0] for group in groups]
+                    result = [re.findall('(?:cn=|CN=)(.*?),', group)[0] for group in groups]
                     return result
         except ldap.LDAPError as e:
             raise LDAPException(self.error(e))
-- 
GitLab