Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AIRFLOW-3103][AIRFLOW-3147] Update flask-appbuilder (#3937) #20

Merged
merged 1 commit into from
Oct 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
142 changes: 121 additions & 21 deletions UPDATING.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions airflow/contrib/auth/backends/github_enterprise_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,17 @@ class GHEUser(models.User):
def __init__(self, user):
self.user = user

@property
def is_active(self):
"""Required by flask_login"""
return True

@property
def is_authenticated(self):
"""Required by flask_login"""
return True

@property
def is_anonymous(self):
"""Required by flask_login"""
return False
Expand Down
3 changes: 3 additions & 0 deletions airflow/contrib/auth/backends/google_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,17 @@ class GoogleUser(models.User):
def __init__(self, user):
self.user = user

@property
def is_active(self):
"""Required by flask_login"""
return True

@property
def is_authenticated(self):
"""Required by flask_login"""
return True

@property
def is_anonymous(self):
"""Required by flask_login"""
return False
Expand Down
5 changes: 4 additions & 1 deletion airflow/contrib/auth/backends/kerberos_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,14 +73,17 @@ def authenticate(username, password):

return

@property
def is_active(self):
"""Required by flask_login"""
return True

@property
def is_authenticated(self):
"""Required by flask_login"""
return True

@property
def is_anonymous(self):
"""Required by flask_login"""
return False
Expand Down Expand Up @@ -110,7 +113,7 @@ def load_user(userid, session=None):

@provide_session
def login(self, request, session=None):
if current_user.is_authenticated():
if current_user.is_authenticated:
flash("You are already logged in")
return redirect(url_for('index'))

Expand Down
5 changes: 4 additions & 1 deletion airflow/contrib/auth/backends/ldap_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,17 @@ def try_login(username, password):
log.info("Password incorrect for user %s", username)
raise AuthenticationError("Invalid username or password")

@property
def is_active(self):
"""Required by flask_login"""
return True

@property
def is_authenticated(self):
"""Required by flask_login"""
return True

@property
def is_anonymous(self):
"""Required by flask_login"""
return False
Expand Down Expand Up @@ -274,7 +277,7 @@ def load_user(userid, session=None):

@provide_session
def login(self, request, session=None):
if current_user.is_authenticated():
if current_user.is_authenticated:
flash("You are already logged in")
return redirect(url_for('admin.index'))

Expand Down
5 changes: 4 additions & 1 deletion airflow/contrib/auth/backends/password_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,17 @@ def password(self, plaintext):
def authenticate(self, plaintext):
return check_password_hash(self._password, plaintext)

@property
def is_active(self):
"""Required by flask_login"""
return True

@property
def is_authenticated(self):
"""Required by flask_login"""
return True

@property
def is_anonymous(self):
"""Required by flask_login"""
return False
Expand Down Expand Up @@ -137,7 +140,7 @@ def authenticate(session, username, password):

@provide_session
def login(self, request, session=None):
if current_user.is_authenticated():
if current_user.is_authenticated:
flash("You are already logged in")
return redirect(url_for('admin.index'))

Expand Down
3 changes: 3 additions & 0 deletions airflow/default_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,17 @@ class DefaultUser(object):
def __init__(self, user):
self.user = user

@property
def is_active(self):
"""Required by flask_login"""
return True

@property
def is_authenticated(self):
"""Required by flask_login"""
return True

@property
def is_anonymous(self):
"""Required by flask_login"""
return False
Expand Down
8 changes: 4 additions & 4 deletions airflow/www/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ class LoginMixin(object):
def is_accessible(self):
return (
not AUTHENTICATE or (
not current_user.is_anonymous() and
current_user.is_authenticated()
not current_user.is_anonymous and
current_user.is_authenticated
)
)

Expand All @@ -73,15 +73,15 @@ class SuperUserMixin(object):
def is_accessible(self):
return (
not AUTHENTICATE or
(not current_user.is_anonymous() and current_user.is_superuser())
(not current_user.is_anonymous and current_user.is_superuser())
)


class DataProfilingMixin(object):
def is_accessible(self):
return (
not AUTHENTICATE or
(not current_user.is_anonymous() and current_user.data_profiling())
(not current_user.is_anonymous and current_user.data_profiling())
)


Expand Down
2 changes: 1 addition & 1 deletion airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ def data_profiling_required(f):
def decorated_function(*args, **kwargs):
if (
current_app.config['LOGIN_DISABLED'] or
(not current_user.is_anonymous() and current_user.data_profiling())
(not current_user.is_anonymous and current_user.data_profiling())
):
return f(*args, **kwargs)
else:
Expand Down
2 changes: 1 addition & 1 deletion airflow/www_rbac/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def action_logging(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
session = settings.Session()
if g.user.is_anonymous():
if g.user.is_anonymous:
user = 'anonymous'
else:
user = g.user.username
Expand Down
Loading