airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alan Ma (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AIRFLOW-1021) Double logging required for new users with LDAP
Date Mon, 09 Oct 2017 18:31:00 GMT

    [ https://issues.apache.org/jira/browse/AIRFLOW-1021?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16197457#comment-16197457
] 

Alan Ma commented on AIRFLOW-1021:
----------------------------------

I tested this fix and it works! Have you submitted a PR for this fix, Marcelo?

If not, I can do it if you like.

> Double logging required for new users with LDAP
> -----------------------------------------------
>
>                 Key: AIRFLOW-1021
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-1021
>             Project: Apache Airflow
>          Issue Type: Bug
>          Components: contrib
>    Affects Versions: Airflow 1.8
>            Reporter: Marcelo G. Almiron
>
> Every user needs to login twice to access Airflow for the first time with LDAP. 
> In the first trial the user is not persistent, so there is no `id` associated, which
leads to `None` value returned by `load_user(userid)`, since `userid` is none `None`.
> A quick fix is to add the new user to the session and commit before merging.  That is,
in module `airflow/contrib/auth/backends/ldap_auth.py`,  we can change
> ```
> if not user:
>     user = models.User(
>         username=username,
>         is_superuser=False)
> session.merge(user)
> session.commit()
> flask_login.login_user(LdapUser(user))
> ```
> by
> ```
> if not user:
>     user = models.User(
>         username=username,
>         is_superuser=False)
>     session.add(user)
>             
> session.commit()
> session.merge(user)
> flask_login.login_user(LdapUser(user))
> ```



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message