Skip to content

Commit

Permalink
feat(providers/fab): Use asset in common provider (apache#43112)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lee-W authored and PaulKobow7536 committed Oct 24, 2024
1 parent 1f817cf commit c3baf95
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 25 deletions.
6 changes: 3 additions & 3 deletions dev/breeze/tests/test_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def test_get_documentation_package_path():
"fab",
"",
"""
"apache-airflow-providers-common-compat>=1.2.0",
"apache-airflow-providers-common-compat>=1.2.1",
"apache-airflow>=2.9.0",
"flask-appbuilder==4.5.0",
"flask-login>=0.6.2",
Expand All @@ -181,7 +181,7 @@ def test_get_documentation_package_path():
"fab",
"dev0",
"""
"apache-airflow-providers-common-compat>=1.2.0.dev0",
"apache-airflow-providers-common-compat>=1.2.1.dev0",
"apache-airflow>=2.9.0.dev0",
"flask-appbuilder==4.5.0",
"flask-login>=0.6.2",
Expand All @@ -195,7 +195,7 @@ def test_get_documentation_package_path():
"fab",
"beta0",
"""
"apache-airflow-providers-common-compat>=1.2.0b0",
"apache-airflow-providers-common-compat>=1.2.1b0",
"apache-airflow>=2.9.0b0",
"flask-appbuilder==4.5.0",
"flask-login>=0.6.2",
Expand Down
2 changes: 1 addition & 1 deletion generated/provider_dependencies.json
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@
},
"fab": {
"deps": [
"apache-airflow-providers-common-compat>=1.2.0",
"apache-airflow-providers-common-compat>=1.2.1",
"apache-airflow>=2.9.0",
"flask-appbuilder==4.5.0",
"flask-login>=0.6.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,7 @@
from airflow.providers.fab.auth_manager.security_manager.override import FabAirflowSecurityManagerOverride
from airflow.security.permissions import RESOURCE_ASSET
else:
try:
from airflow.security.permissions import RESOURCE_ASSET
except ImportError:
from airflow.security.permissions import RESOURCE_DATASET as RESOURCE_ASSET
from airflow.providers.common.compat.security.permissions import RESOURCE_ASSET


_MAP_DAG_ACCESS_ENTITY_TO_FAB_RESOURCE_TYPE: dict[DagAccessEntity, tuple[str, ...]] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,7 @@
from airflow.auth.managers.base_auth_manager import ResourceMethod
from airflow.security.permissions import RESOURCE_ASSET
else:
try:
from airflow.security.permissions import RESOURCE_ASSET
except ImportError:
from airflow.security.permissions import RESOURCE_DATASET as RESOURCE_ASSET
from airflow.providers.common.compat.security.permissions import RESOURCE_ASSET

log = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion providers/src/airflow/providers/fab/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ versions:

dependencies:
- apache-airflow>=2.9.0
- apache-airflow-providers-common-compat>=1.2.0
- apache-airflow-providers-common-compat>=1.2.1
- flask>=2.2,<2.3
# We are tightly coupled with FAB version as we vendored-in part of FAB code related to security manager
# This is done as part of preparation to removing FAB as dependency, but we are not ready for it yet
Expand Down
9 changes: 1 addition & 8 deletions providers/tests/fab/auth_manager/test_fab_auth_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
from airflow.providers.fab.auth_manager.models import User
from airflow.providers.fab.auth_manager.security_manager.override import FabAirflowSecurityManagerOverride

from airflow.providers.common.compat.security.permissions import RESOURCE_ASSET
from airflow.security.permissions import (
ACTION_CAN_ACCESS_MENU,
ACTION_CAN_CREATE,
Expand All @@ -61,14 +62,6 @@

if TYPE_CHECKING:
from airflow.auth.managers.base_auth_manager import ResourceMethod
from airflow.security.permissions import RESOURCE_ASSET
else:
try:
from airflow.security.permissions import RESOURCE_ASSET
except ImportError:
from airflow.security.permissions import (
RESOURCE_DATASET as RESOURCE_ASSET,
)


IS_AUTHORIZED_METHODS_SIMPLE = {
Expand Down
5 changes: 1 addition & 4 deletions providers/tests/fab/auth_manager/test_security.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,7 @@
if TYPE_CHECKING:
from airflow.security.permissions import RESOURCE_ASSET
else:
try:
from airflow.security.permissions import RESOURCE_ASSET
except ImportError:
from airflow.security.permissions import RESOURCE_DATASET as RESOURCE_ASSET
from airflow.providers.common.compat.security.permissions import RESOURCE_ASSET


pytestmark = pytest.mark.db_test
Expand Down

0 comments on commit c3baf95

Please sign in to comment.