Skip to content

Commit

Permalink
Move FABs base Security Manager into Airflow. (#16647)
Browse files Browse the repository at this point in the history
* Move FABs base Security Manager into Airflow.

* Remove AbstractSecurityManager class.

* Remove import of BaseManager class.

* Add licenses

* Add reference to FAB creator Daniel Vaz Gaspar.

* Correct argument name in test.

* Fix missing colon in docblock.

* Add line to docblock so doc build passes.

* Add __init__.py files to fab_security directories.
  • Loading branch information
jhtimmins authored Sep 28, 2021
1 parent 2fbd238 commit 48d4c5d
Show file tree
Hide file tree
Showing 10 changed files with 2,451 additions and 8 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ repos:
pass_filenames: true
exclude: >
(?x)
^airflow/www/fab_security/manager\.py$|
^airflow/providers/apache/cassandra/hooks/cassandra\.py$|
^airflow/providers/apache/hive/operators/hive_stats\.py$|
^airflow/providers/apache/hive/.*PROVIDER_CHANGES_*|
Expand Down
8 changes: 8 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ This product contains a modified portion of 'Hue' developed by Cloudera, Inc.
(https://github.com/cloudera/hue/).

* Copyright 2009-2017 Cloudera Inc.


Flask App Builder:
-----
This product contains a modified portion of 'Flask App Builder' developed by Daniel Vaz Gaspar.
(https://github.com/dpgaspar/Flask-AppBuilder).

* Copyright 2013, Daniel Vaz Gaspar
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def patch_role(role_name, update_mask=None):
(item['permission']['name'], item['view_menu']['name']) for item in data['permissions'] if item
]
_check_action_and_resource(security_manager, perms)
security_manager.update_role(pk=role.id, name=data['name'])
security_manager.update_role(role_id=role.id, name=data['name'])
security_manager.init_role(role_name=data['name'], perms=perms or role.permissions)
return role_schema.dump(role)

Expand Down
10 changes: 5 additions & 5 deletions airflow/config_templates/default_webserver_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
"""Default configuration for the Airflow webserver"""
import os

from flask_appbuilder.security.manager import AUTH_DB
from airflow.www.fab_security.manager import AUTH_DB

# from flask_appbuilder.security.manager import AUTH_LDAP
# from flask_appbuilder.security.manager import AUTH_OAUTH
# from flask_appbuilder.security.manager import AUTH_OID
# from flask_appbuilder.security.manager import AUTH_REMOTE_USER
# from airflow.www.fab_security.manager import AUTH_LDAP
# from airflow.www.fab_security.manager import AUTH_OAUTH
# from airflow.www.fab_security.manager import AUTH_OID
# from airflow.www.fab_security.manager import AUTH_REMOTE_USER


basedir = os.path.abspath(os.path.dirname(__file__))
Expand Down
16 changes: 16 additions & 0 deletions airflow/www/fab_security/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
Loading

0 comments on commit 48d4c5d

Please sign in to comment.