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

Log migrations info in consistent way #14158

Merged
merged 1 commit into from
Feb 10, 2021
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
Create Date: 2021-02-04 12:45:58.138224

"""
import logging

from airflow.security import permissions
from airflow.www.app import create_app
Expand All @@ -36,6 +37,9 @@

def upgrade():
"""Remove can_read permission on config resource for User and Viewer role"""
log = logging.getLogger()
handlers = log.handlers[:]

appbuilder = create_app(config={'FAB_UPDATE_PERMS': False}).appbuilder
roles_to_modify = [role for role in appbuilder.sm.get_all_roles() if role.name in ["User", "Viewer"]]
can_read_on_config_perm = appbuilder.sm.find_permission_view_menu(
Expand All @@ -48,6 +52,8 @@ def upgrade():
):
appbuilder.sm.del_permission_role(role, can_read_on_config_perm)

log.handlers = handlers


def downgrade():
"""Add can_read permission on config resource for User and Viewer role"""
Expand Down