55from airflow .providers .fab .auth_manager .models import User
66from airflow .providers .fab .auth_manager .fab_auth_manager import FabAuthManager
77
8- from airflow .api_fastapi .auth .managers .base_auth_manager import ResourceMethod
9- from airflow .configuration import conf
10- from airflow .api_fastapi .auth .managers .models .resource_details import (
11- from airflow .providers .fab .auth_manager .models import User
12- from airflow .providers .fab .auth_manager .fab_auth_manager import FabAuthManager
13-
148from airflow .api_fastapi .auth .managers .base_auth_manager import ResourceMethod
159from airflow .configuration import conf
1610from airflow .api_fastapi .auth .managers .models .resource_details import (
1711 AccessView ,
1812 AssetDetails ,
1913 AssetAliasDetails ,
2014 BackfillDetails ,
21- AssetDetails ,
22- AssetAliasDetails ,
23- BackfillDetails ,
2415 ConfigurationDetails ,
2516 ConnectionDetails ,
2617 DagAccessEntity ,
@@ -83,33 +74,22 @@ class OpaFabAuthManager(FabAuthManager, LoggingMixin):
8374 AUTH_OPA_REQUEST_URL_DEFAULT = "http://opa:8081/v1/data/airflow"
8475 AUTH_OPA_REQUEST_TIMEOUT_DEFAULT = 10
8576
86- @override
87- def init_flask_resources (self ) -> None :
8877 @override
8978 def init_flask_resources (self ) -> None :
9079 """
9180 Run operations when Airflow is initializing.
9281 """
9382
94- super ().init_flask_resources ()
9583 super ().init_flask_resources ()
9684
9785 Stats .incr (METRIC_NAME_OPA_CACHE_LIMIT_REACHED , count = 0 )
9886
9987 self .opa_cache = Cache (
100- maxsize = conf .getint (
101- "core" ,
102- "AUTH_OPA_CACHE_MAXSIZE" ,
103- fallback = self .AUTH_OPA_CACHE_MAXSIZE_DEFAULT ,
10488 maxsize = conf .getint (
10589 "core" ,
10690 "AUTH_OPA_CACHE_MAXSIZE" ,
10791 fallback = self .AUTH_OPA_CACHE_MAXSIZE_DEFAULT ,
10892 ),
109- ttl = conf .getint (
110- "core" ,
111- "AUTH_OPA_CACHE_TTL_IN_SEC" ,
112- fallback = self .AUTH_OPA_CACHE_TTL_IN_SEC_DEFAULT ,
11393 ttl = conf .getint (
11494 "core" ,
11595 "AUTH_OPA_CACHE_TTL_IN_SEC" ,
@@ -151,10 +131,6 @@ def _is_authorized_in_opa(self, endpoint: str, input: OpaInput) -> bool:
151131 response = self .call_opa (
152132 f"{ opa_url } /{ endpoint } " ,
153133 json = input .to_dict (),
154- timeout = conf .getint (
155- "core" ,
156- "AUTH_OPA_REQUEST_TIMEOUT" ,
157- fallback = self .AUTH_OPA_REQUEST_TIMEOUT_DEFAULT ,
158134 timeout = conf .getint (
159135 "core" ,
160136 "AUTH_OPA_REQUEST_TIMEOUT" ,
@@ -173,7 +149,6 @@ def is_authorized_configuration(
173149 method : ResourceMethod ,
174150 details : Optional [ConfigurationDetails ] = None ,
175151 user : User ,
176- user : User ,
177152 ) -> bool :
178153 """
179154 Return whether the user is authorized to perform a given action on
@@ -217,7 +192,6 @@ def is_authorized_connection(
217192 method : ResourceMethod ,
218193 details : Optional [ConnectionDetails ] = None ,
219194 user : User ,
220- user : User ,
221195 ) -> bool :
222196 """
223197 Return whether the user is authorized to perform a given action on a connection.
@@ -261,7 +235,6 @@ def is_authorized_dag(
261235 access_entity : Optional [DagAccessEntity ] = None ,
262236 details : Optional [DagDetails ] = None ,
263237 user : User ,
264- user : User ,
265238 ) -> bool :
266239 """
267240 Return whether the user is authorized to perform a given action on a DAG.
@@ -426,7 +399,6 @@ def is_authorized_pool(
426399 method : ResourceMethod ,
427400 details : Optional [PoolDetails ] = None ,
428401 user : User ,
429- user : User ,
430402 ) -> bool :
431403 """
432404 Return whether the user is authorized to perform a given action on a pool.
@@ -469,7 +441,6 @@ def is_authorized_variable(
469441 method : ResourceMethod ,
470442 details : Optional [VariableDetails ] = None ,
471443 user : User ,
472- user : User ,
473444 ) -> bool :
474445 """
475446 Return whether the user is authorized to perform a given action on a variable.
@@ -511,7 +482,6 @@ def is_authorized_view(
511482 * ,
512483 access_view : AccessView ,
513484 user : User ,
514- user : User ,
515485 ) -> bool :
516486 """
517487 Return whether the user is authorized to access a read-only state of the installation.
@@ -545,7 +515,6 @@ def is_authorized_custom_view(
545515 method : Union [ResourceMethod , str ],
546516 resource_name : str ,
547517 user : User ,
548- user : User ,
549518 ) -> bool :
550519 """
551520 Return whether the user is authorized to perform a given action on a custom view.
0 commit comments