uranusjr commented on code in PR #32838:
URL: https://github.com/apache/airflow/pull/32838#discussion_r1274419762
##########
airflow/auth/managers/fab/fab_auth_manager.py:
##########
@@ -39,13 +40,19 @@ def get_user_name(self) -> str:
For backward compatibility reasons, the username in FAB auth manager
is the concatenation of the
first name and the last name.
"""
- first_name = current_user.first_name or ""
- last_name = current_user.last_name or ""
+ user = self.get_user()
+ first_name = user.first_name or ""
+ last_name = user.last_name or ""
return f"{first_name} {last_name}".strip()
+ def get_user(self) -> User:
+ """Return the user associated to the user in session."""
+ return current_user
+
def is_logged_in(self) -> bool:
"""Return whether the user is logged in."""
- return current_user and not current_user.is_anonymous
+ user = self.get_user()
+ return user and not user.is_anonymous
Review Comment:
```suggestion
return not user.is_anonymous
```
Can the user ever be falsy…?
##########
airflow/auth/managers/fab/fab_auth_manager.py:
##########
@@ -39,13 +40,19 @@ def get_user_name(self) -> str:
For backward compatibility reasons, the username in FAB auth manager
is the concatenation of the
first name and the last name.
"""
- first_name = current_user.first_name or ""
- last_name = current_user.last_name or ""
+ user = self.get_user()
+ first_name = user.first_name or ""
+ last_name = user.last_name or ""
return f"{first_name} {last_name}".strip()
+ def get_user(self) -> User:
+ """Return the user associated to the user in session."""
+ return current_user
+
def is_logged_in(self) -> bool:
"""Return whether the user is logged in."""
- return current_user and not current_user.is_anonymous
+ user = self.get_user()
+ return user and not user.is_anonymous
Review Comment:
```suggestion
return not user.is_anonymous
```
Can the user ever be falsy…?
--
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]