You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/04/28 01:25:09 UTC
[GitHub] [airflow] blag opened a new pull request, #23314: Fix update user auth stats
blag opened a new pull request, #23314:
URL: https://github.com/apache/airflow/pull/23314
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
Copied from my PR to FAB dpgaspar/Flask-AppBuilder#1775.
This PR moves one line around so the `user.last_login` field is only updated when the user has successfully authenticated.
Without this PR the `user.last_login` field is not very useful, as the `last_login` field would be set to the last time anybody - successfully or unsuccessfully - attempted to login, instead of the datetime of the last _successful_ authentication attempt.
---
**^ Add meaningful description above**
Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)** for more information.
In case of fundamental code change, Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)) is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in a newsfragement file, named `{pr_number}.significant.rst`, in [newsfragments](https://github.com/apache/airflow/tree/main/newsfragments).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] jedcunningham merged pull request #23314: Fix update user auth stats
Posted by GitBox <gi...@apache.org>.
jedcunningham merged PR #23314:
URL: https://github.com/apache/airflow/pull/23314
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] github-actions[bot] commented on pull request #23314: Fix update user auth stats
Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #23314:
URL: https://github.com/apache/airflow/pull/23314#issuecomment-1112548961
The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] blag commented on a diff in pull request #23314: Fix update user auth stats
Posted by GitBox <gi...@apache.org>.
blag commented on code in PR #23314:
URL: https://github.com/apache/airflow/pull/23314#discussion_r861224333
##########
tests/www/test_security.py:
##########
@@ -814,3 +816,68 @@ def test_fab_models_use_airflow_base_meta():
# TODO: move this test to appropriate place when we have more tests for FAB models
user = User()
assert user.metadata is Base.metadata
+
+
+@pytest.fixture()
+def mock_security_manager(app_builder):
+ mocked_security_manager = MockSecurityManager(appbuilder=app_builder)
+ mocked_security_manager.update_user = mock.MagicMock()
+ return mocked_security_manager
+
+
+@pytest.fixture()
+def new_user():
+ user = mock.MagicMock()
+ user.login_count = None
+ user.fail_login_count = None
+ user.last_login = None
+ return user
+
+
+@pytest.fixture()
+def old_user():
+ user = mock.MagicMock()
+ user.login_count = 42
+ user.fail_login_count = 9
+ user.last_login = datetime.datetime(1984, 12, 1, 0, 0, 0)
Review Comment:
!["We're sending you back...to the future!"](https://i.giphy.com/media/RmfhMeDyN0bVYBFKNR/giphy.webp)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [airflow] jedcunningham commented on a diff in pull request #23314: Fix update user auth stats
Posted by GitBox <gi...@apache.org>.
jedcunningham commented on code in PR #23314:
URL: https://github.com/apache/airflow/pull/23314#discussion_r861220142
##########
tests/www/test_security.py:
##########
@@ -814,3 +816,68 @@ def test_fab_models_use_airflow_base_meta():
# TODO: move this test to appropriate place when we have more tests for FAB models
user = User()
assert user.metadata is Base.metadata
+
+
+@pytest.fixture()
+def mock_security_manager(app_builder):
+ mocked_security_manager = MockSecurityManager(appbuilder=app_builder)
+ mocked_security_manager.update_user = mock.MagicMock()
+ return mocked_security_manager
+
+
+@pytest.fixture()
+def new_user():
+ user = mock.MagicMock()
+ user.login_count = None
+ user.fail_login_count = None
+ user.last_login = None
+ return user
+
+
+@pytest.fixture()
+def old_user():
+ user = mock.MagicMock()
+ user.login_count = 42
+ user.fail_login_count = 9
+ user.last_login = datetime.datetime(1984, 12, 1, 0, 0, 0)
Review Comment:
Dang, really going back in time here :)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org