Skip to content

[AIRFLOW-2504] Log username correctly and Add extra to search columns#3438

Closed
youngyjd wants to merge 1 commit intoapache:masterfrom
youngyjd:log-username-old-ui
Closed

[AIRFLOW-2504] Log username correctly and Add extra to search columns#3438
youngyjd wants to merge 1 commit intoapache:masterfrom
youngyjd:log-username-old-ui

Conversation

@youngyjd
Copy link
Contributor

Make sure you have checked all steps below.

JIRA

  • My PR addresses the following Airflow JIRA issues and references them in the PR title. For example, "[AIRFLOW-XXX] My Airflow PR"

Description

  • Here are some details about my PR, including screenshots of any UI changes:

Tests

  • My PR adds the following unit tests OR does not need testing for this extremely good reason:

Commits

  • My commits all reference JIRA issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "How to write a good git commit message":
    1. Subject is separated from body by a blank line
    2. Subject is limited to 50 characters
    3. Subject does not end with a period
    4. Subject uses the imperative mood ("add", not "adding")
    5. Body wraps at 72 characters
    6. Body explains "what" and "why", not "how"

Documentation

  • In case of new functionality, my PR adds documentation that describes how to use it.
    • When adding new operators/hooks/sensors, the autoclass documentation generation needs to be added.

Code Quality

  • Passes git diff upstream/master -u -- "*.py" | flake8 --diff

@codecov-io
Copy link

codecov-io commented May 30, 2018

Codecov Report

Merging #3438 into master will not change coverage.
The diff coverage is 75%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #3438   +/-   ##
=======================================
  Coverage   76.75%   76.75%           
=======================================
  Files         203      203           
  Lines       15100    15100           
=======================================
  Hits        11590    11590           
  Misses       3510     3510
Impacted Files Coverage Δ
airflow/www/views.py 71.99% <100%> (ø) ⬆️
airflow/www_rbac/views.py 74.56% <100%> (ø) ⬆️
airflow/www/utils.py 86.33% <50%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3a6cdc8...1ce098d. Read the comment docs.

@kaxil
Copy link
Member

kaxil commented May 30, 2018

Can you please squash commits?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch! this seems like a bug and I wonder if we can remove this completely given it's always None.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use google authentication and current_user.username is always None, but I am not sure whether there is any other use cases or authentication methods that current_user.username is not None. I did a quick code search for current_user.username and it looks like there are some usage of current_user.username in UI. What do you think?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, looks like the use case is trivial (airflow logo title) in the main UI, and it's currently returning None when you hover your mouse over it, so it can be replaced as well :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. Will replace that part as well. Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jgao54 Done. I checked current_user.username for the rbac UI and it worked fine. I assume the bug only exits in the old UI.

@youngyjd
Copy link
Contributor Author

@kaxil sure. I though it was better to have 2 separate commits.. I will squash them

@youngyjd youngyjd force-pushed the log-username-old-ui branch 5 times, most recently from d9f7e36 to 37d1e76 Compare June 1, 2018 18:56
@jgao54
Copy link

jgao54 commented Jun 1, 2018

Could you prepend your commit with [AIRFLOW-XXX], will merge after.

@youngyjd youngyjd changed the title [AIRFLOW-2504] Improve Airflow UI auditing [AIRFLOW-2504] Log username correctly and Add extra to search columns Jun 1, 2018
@youngyjd youngyjd force-pushed the log-username-old-ui branch 4 times, most recently from fc5b4a8 to 1ce098d Compare June 1, 2018 20:37
@youngyjd youngyjd force-pushed the log-username-old-ui branch from 1ce098d to b286cd1 Compare June 1, 2018 21:26
@youngyjd
Copy link
Contributor Author

youngyjd commented Jun 1, 2018

Cannot simply change title="{{ current_user.username }}" to title="{{ current_user.user.username }}" because tests will fail. The AnonymousUserMixin() object does not have user attribute while DefaultUser(), GoogleUser(), etc have.

@jgao54
Copy link

jgao54 commented Jun 1, 2018

ah i see! thanks for digging.

@asfgit asfgit closed this in 86d0960 Jun 1, 2018
@feng-tao
Copy link
Member

feng-tao commented Jun 1, 2018

does this pr need to change for the rbac UI(under www_rbac directory)? @youngyjd

@youngyjd
Copy link
Contributor Author

youngyjd commented Jun 1, 2018

@feng-tao rbac is using flask g, which works fine.

aliceabe pushed a commit to aliceabe/incubator-airflow that referenced this pull request Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants