You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by sa...@apache.org on 2016/11/12 20:59:33 UTC
incubator-airflow git commit: [AIRFLOW-623] LDAP attributes not
always a list
Repository: incubator-airflow
Updated Branches:
refs/heads/master 98f32184a -> 6adb15ca0
[AIRFLOW-623] LDAP attributes not always a list
Sometimes the search attributes that come back are
not a list always, but a string, so we need to
check for an exact match as well as if it's a list
Closes #1876 from wyndhblb/master
Project: http://git-wip-us.apache.org/repos/asf/incubator-airflow/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-airflow/commit/6adb15ca
Tree: http://git-wip-us.apache.org/repos/asf/incubator-airflow/tree/6adb15ca
Diff: http://git-wip-us.apache.org/repos/asf/incubator-airflow/diff/6adb15ca
Branch: refs/heads/master
Commit: 6adb15ca0cdb1f065f55c5061f4695ebb2e56852
Parents: 98f3218
Author: Wyndham Blanton <bo...@gmail.com>
Authored: Sat Nov 12 12:59:00 2016 -0800
Committer: Siddharth Anand <si...@yahoo.com>
Committed: Sat Nov 12 12:59:03 2016 -0800
----------------------------------------------------------------------
airflow/contrib/auth/backends/ldap_auth.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-airflow/blob/6adb15ca/airflow/contrib/auth/backends/ldap_auth.py
----------------------------------------------------------------------
diff --git a/airflow/contrib/auth/backends/ldap_auth.py b/airflow/contrib/auth/backends/ldap_auth.py
index 2b81b4c..3e175ae 100644
--- a/airflow/contrib/auth/backends/ldap_auth.py
+++ b/airflow/contrib/auth/backends/ldap_auth.py
@@ -75,7 +75,12 @@ def group_contains_user(conn, search_base, group_filter, user_name_attr, usernam
LOG.warn("Unable to find group for %s %s", search_base, search_filter)
else:
for resp in conn.response:
- if 'attributes' in resp and resp['attributes'].get(user_name_attr)[0] == username:
+ if (
+ 'attributes' in resp and (
+ resp['attributes'].get(user_name_attr)[0] == username or
+ resp['attributes'].get(user_name_attr) == username
+ )
+ ):
return True
return False