apache-airflow-providers-fab 2.4.3__py3-none-any.whl → 2.4.4rc1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of apache-airflow-providers-fab might be problematic. Click here for more details.

@@ -29,7 +29,7 @@ from airflow import __version__ as airflow_version
29
29
 
30
30
  __all__ = ["__version__"]
31
31
 
32
- __version__ = "2.4.3"
32
+ __version__ = "2.4.4"
33
33
 
34
34
  if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
35
35
  "3.0.2"
@@ -57,7 +57,7 @@ from airflow.cli.cli_config import (
57
57
  )
58
58
  from airflow.configuration import conf
59
59
  from airflow.exceptions import AirflowConfigException, AirflowException
60
- from airflow.models import DagModel
60
+ from airflow.models import Connection, DagModel, Pool, Variable
61
61
  from airflow.providers.fab.auth_manager.cli_commands.definition import (
62
62
  DB_COMMANDS,
63
63
  PERMISSIONS_CLEANUP_COMMAND,
@@ -437,6 +437,26 @@ class FabAuthManager(BaseAuthManager[User]):
437
437
  )
438
438
  ]
439
439
 
440
+ @provide_session
441
+ def get_authorized_connections(
442
+ self,
443
+ *,
444
+ user: User,
445
+ method: ResourceMethod = "GET",
446
+ session: Session = NEW_SESSION,
447
+ ) -> set[str]:
448
+ """
449
+ Get connection ids (``conn_id``) the user has access to.
450
+
451
+ Fab auth manager does not allow fine-grained access with connections. Thus, return all the connection ids.
452
+
453
+ :param user: the user
454
+ :param method: the method to filter on
455
+ :param session: the session
456
+ """
457
+ rows = session.execute(select(Connection.conn_id)).scalars().all()
458
+ return set(rows)
459
+
440
460
  @provide_session
441
461
  def get_authorized_dag_ids(
442
462
  self,
@@ -477,6 +497,46 @@ class FabAuthManager(BaseAuthManager[User]):
477
497
  resources.add(resource[len(permissions.RESOURCE_DAG_PREFIX) :])
478
498
  return set(session.scalars(select(DagModel.dag_id).where(DagModel.dag_id.in_(resources))))
479
499
 
500
+ @provide_session
501
+ def get_authorized_pools(
502
+ self,
503
+ *,
504
+ user: User,
505
+ method: ResourceMethod = "GET",
506
+ session: Session = NEW_SESSION,
507
+ ) -> set[str]:
508
+ """
509
+ Get pools the user has access to.
510
+
511
+ Fab auth manager does not allow fine-grained access with pools. Thus, return all the pool names.
512
+
513
+ :param user: the user
514
+ :param method: the method to filter on
515
+ :param session: the session
516
+ """
517
+ rows = session.execute(select(Pool.pool)).scalars().all()
518
+ return set(rows)
519
+
520
+ @provide_session
521
+ def get_authorized_variables(
522
+ self,
523
+ *,
524
+ user: User,
525
+ method: ResourceMethod = "GET",
526
+ session: Session = NEW_SESSION,
527
+ ) -> set[str]:
528
+ """
529
+ Get variable keys the user has access to.
530
+
531
+ Fab auth manager does not allow fine-grained access with variables. Thus, return all the variable keys.
532
+
533
+ :param user: the user
534
+ :param method: the method to filter on
535
+ :param session: the session
536
+ """
537
+ rows = session.execute(select(Variable.key)).scalars().all()
538
+ return set(rows)
539
+
480
540
  @cached_property
481
541
  def security_manager(self) -> FabAirflowSecurityManagerOverride:
482
542
  """Return the security manager specific to FAB."""
@@ -127,7 +127,7 @@ if AIRFLOW_V_3_1_PLUS:
127
127
  with create_session() as session:
128
128
  yield from DBDagBag().iter_all_latest_version_dags(session=session)
129
129
  else:
130
- from airflow.models.dagbag import DagBag
130
+ from airflow.models.dagbag import DagBag # type: ignore[attr-defined, no-redef]
131
131
 
132
132
  def _iter_dags() -> Iterable[DAG | SerializedDAG]:
133
133
  dagbag = DagBag(read_dags_from_db=True) # type: ignore[call-arg]
@@ -21,7 +21,12 @@ from typing import TYPE_CHECKING, Any
21
21
  from flask import Flask
22
22
 
23
23
  if TYPE_CHECKING:
24
- from airflow.models.dagbag import DagBag
24
+ from airflow.providers.fab.version_compat import AIRFLOW_V_3_1_PLUS
25
+
26
+ if AIRFLOW_V_3_1_PLUS:
27
+ from airflow.models.dagbag import DBDagBag as DagBag
28
+ else:
29
+ from airflow.models.dagbag import DagBag # type: ignore[no-redef]
25
30
 
26
31
 
27
32
  class AirflowApp(Flask):
@@ -22,7 +22,7 @@
22
22
  "copy-webpack-plugin": "^13.0.1",
23
23
  "css-loader": "7.1.2",
24
24
  "css-minimizer-webpack-plugin": "^7.0.2",
25
- "eslint": "^9.35.0",
25
+ "eslint": "^9.36.0",
26
26
  "eslint-config-prettier": "^10.1.8",
27
27
  "eslint-plugin-html": "^8.1.3",
28
28
  "eslint-plugin-import": "^2.32.0",
@@ -1807,9 +1807,9 @@
1807
1807
  }
1808
1808
  },
1809
1809
  "node_modules/@eslint/js": {
1810
- "version": "9.35.0",
1811
- "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.35.0.tgz",
1812
- "integrity": "sha512-30iXE9whjlILfWobBkNerJo+TXYsgVM5ERQwMcMKCHckHflCmf7wXDAHlARoWnh0s1U72WqlbeyE7iAcCzuCPw==",
1810
+ "version": "9.36.0",
1811
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.36.0.tgz",
1812
+ "integrity": "sha512-uhCbYtYynH30iZErszX78U+nR3pJU3RHGQ57NXy5QupD4SBVwDeU8TNBy+MjMngc1UyIW9noKqsRqfjQTBU2dw==",
1813
1813
  "dev": true,
1814
1814
  "license": "MIT",
1815
1815
  "engines": {
@@ -3998,9 +3998,9 @@
3998
3998
  }
3999
3999
  },
4000
4000
  "node_modules/eslint": {
4001
- "version": "9.35.0",
4002
- "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.35.0.tgz",
4003
- "integrity": "sha512-QePbBFMJFjgmlE+cXAlbHZbHpdFVS2E/6vzCy7aKlebddvl1vadiC4JFV5u/wqTkNUwEV8WrQi257jf5f06hrg==",
4001
+ "version": "9.36.0",
4002
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.36.0.tgz",
4003
+ "integrity": "sha512-hB4FIzXovouYzwzECDcUkJ4OcfOEkXTv2zRY6B9bkwjx/cprAq0uvm1nl7zvQ0/TsUk0zQiN4uPfJpB9m+rPMQ==",
4004
4004
  "dev": true,
4005
4005
  "license": "MIT",
4006
4006
  "dependencies": {
@@ -4010,7 +4010,7 @@
4010
4010
  "@eslint/config-helpers": "^0.3.1",
4011
4011
  "@eslint/core": "^0.15.2",
4012
4012
  "@eslint/eslintrc": "^3.3.1",
4013
- "@eslint/js": "9.35.0",
4013
+ "@eslint/js": "9.36.0",
4014
4014
  "@eslint/plugin-kit": "^0.3.5",
4015
4015
  "@humanfs/node": "^0.16.6",
4016
4016
  "@humanwhocodes/module-importer": "^1.0.1",
@@ -48,7 +48,7 @@
48
48
  "copy-webpack-plugin": "^13.0.1",
49
49
  "css-loader": "7.1.2",
50
50
  "css-minimizer-webpack-plugin": "^7.0.2",
51
- "eslint": "^9.35.0",
51
+ "eslint": "^9.36.0",
52
52
  "eslint-config-prettier": "^10.1.8",
53
53
  "eslint-plugin-html": "^8.1.3",
54
54
  "eslint-plugin-import": "^2.32.0",