uranusjr commented on a change in pull request #20346:
URL: https://github.com/apache/airflow/pull/20346#discussion_r782669453
##########
File path: airflow/www/security.py
##########
@@ -298,6 +298,11 @@ def get_accessible_dag_ids(self, user, user_actions=None,
session=None) -> Set[s
if user.is_anonymous:
roles = self.get_user_roles(user)
else:
+ if (permissions.ACTION_CAN_EDIT in user_actions and
self.can_edit_all_dags()) or (
+ permissions.ACTION_CAN_READ in user_actions and
self.can_read_all_dags()
+ ):
+ return {dag.dag_id for dag in session.query(DagModel.dag_id)}
Review comment:
This is causing tests to fail with
```
E RuntimeError: Working outside of application context.
E
E This typically means that you attempted to use functionality
that needed
E to interface with the current application object in some way.
To solve
E this, set up an application context with app.app_context().
See the
E documentation for more information.
```
because these `can` methods calls `_get_and_cache_perms` under the hood,
which relies on `g.user`.
I think this should be fixable by setting up an application context in
tests. This would make those tests _a lot_ slower, but unfortunately I don’t
see a straightforward alternative.
--
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]