vincbeck commented on code in PR #77559:
URL: https://github.com/apache/airflow/pull/77559#discussion_r4685585403


##########
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/services/users.py:
##########
@@ -235,3 +236,5 @@ def delete_user(cls, username: str) -> None:
         user.roles = []
         security_manager.session.delete(user)
         security_manager.session.commit()
+        with FabAuthManager.cache_lock:
+            FabAuthManager.cache.pop(user.id, None)

Review Comment:
   nit: this is now the third copy of this block, with `update_user` in 
`override.py` and `_evict_cached_user` in `views/user.py`. Any chance to 
factorize it in a `FabAuthManager` classmethod?



##########
providers/fab/docs/changelog.rst:
##########
@@ -25,9 +25,11 @@ Changelog
     ``ab_user`` table. Run ``airflow db migrate`` after upgrading the provider.
 
     Changing or resetting a password now ends the API tokens and UI sessions 
issued before the
-    change. API servers cache users for up to ``[fab] cache_ttl`` seconds, so 
for a change made
-    from another process, such as ``airflow users reset-password`` or another 
API server, the
-    earlier API tokens stop working there once its cached user expires.
+    change, and deactivating or deleting a user in the UI or through the API 
now ends their API
+    tokens. API servers cache users for up to ``[fab] cache_ttl`` seconds, so 
for a

Review Comment:
   nit: the users API can't deactivate a user (`UserPatchBody` has no `active` 
field), it can only delete one
   
   ```suggestion
       change, and deactivating or deleting a user in the UI, or deleting one 
through the API, now
       ends their API tokens. API servers cache users for up to ``[fab] 
cache_ttl`` seconds, so for a
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to