Skip to content

Commit

Permalink
[AIRFLOW-3947] Flash msg for no DAG-level access error
Browse files Browse the repository at this point in the history
It will show and remind user when a user clicks on a DAG that
he/she doesn't have can_dag_read or can_dag_edit permissions.
  • Loading branch information
XD-DENG committed Feb 25, 2019
1 parent 31cd02f commit f9eff53
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion airflow/www/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import functools
import pendulum
from io import BytesIO as IO
from flask import after_this_request, redirect, request, url_for, g
from flask import after_this_request, flash, redirect, request, url_for, g
from airflow.models.log import Log
from airflow.utils.db import create_session

Expand Down Expand Up @@ -120,6 +120,7 @@ def wrapper(self, *args, **kwargs):
dag_id)))):
return f(self, *args, **kwargs)
else:
flash("User can't access DAG {}.".format(dag_id), "danger")
return redirect(url_for(self.appbuilder.sm.auth_view.
__class__.__name__ + ".login"))
return wrapper
Expand Down

0 comments on commit f9eff53

Please sign in to comment.