|
18 | 18 | from airflow.stats import Stats |
19 | 19 | from airflow.utils.log.logging_mixin import LoggingMixin |
20 | 20 | from cachetools import TTLCache, cachedmethod |
21 | | -from typing import override |
| 21 | +from typing import Optional, Union |
| 22 | +from overrides import override |
22 | 23 | import json |
23 | 24 | import requests |
24 | 25 |
|
@@ -132,8 +133,8 @@ def is_authorized_configuration( |
132 | 133 | self, |
133 | 134 | *, |
134 | 135 | method: ResourceMethod, |
135 | | - details: ConfigurationDetails | None = None, |
136 | | - user: BaseUser | None = None, |
| 136 | + details: Optional[ConfigurationDetails] = None, |
| 137 | + user: Optional[BaseUser] = None, |
137 | 138 | ) -> bool: |
138 | 139 | """ |
139 | 140 | Return whether the user is authorized to perform a given action on |
@@ -178,8 +179,8 @@ def is_authorized_connection( |
178 | 179 | self, |
179 | 180 | *, |
180 | 181 | method: ResourceMethod, |
181 | | - details: ConnectionDetails | None = None, |
182 | | - user: BaseUser | None = None, |
| 182 | + details: Optional[ConnectionDetails] = None, |
| 183 | + user: Optional[BaseUser] = None, |
183 | 184 | ) -> bool: |
184 | 185 | """ |
185 | 186 | Return whether the user is authorized to perform a given action on a connection. |
@@ -223,9 +224,9 @@ def is_authorized_dag( |
223 | 224 | self, |
224 | 225 | *, |
225 | 226 | method: ResourceMethod, |
226 | | - access_entity: DagAccessEntity | None = None, |
227 | | - details: DagDetails | None = None, |
228 | | - user: BaseUser | None = None, |
| 227 | + access_entity: Optional[DagAccessEntity] = None, |
| 228 | + details: Optional[DagDetails] = None, |
| 229 | + user: Optional[BaseUser] = None, |
229 | 230 | ) -> bool: |
230 | 231 | """ |
231 | 232 | Return whether the user is authorized to perform a given action on a DAG. |
@@ -277,8 +278,8 @@ def is_authorized_dataset( |
277 | 278 | self, |
278 | 279 | *, |
279 | 280 | method: ResourceMethod, |
280 | | - details: DatasetDetails | None = None, |
281 | | - user: BaseUser | None = None, |
| 281 | + details: Optional[DatasetDetails] = None, |
| 282 | + user: Optional[BaseUser] = None, |
282 | 283 | ) -> bool: |
283 | 284 | """ |
284 | 285 | Return whether the user is authorized to perform a given action on a dataset. |
@@ -322,8 +323,8 @@ def is_authorized_pool( |
322 | 323 | self, |
323 | 324 | *, |
324 | 325 | method: ResourceMethod, |
325 | | - details: PoolDetails | None = None, |
326 | | - user: BaseUser | None = None, |
| 326 | + details: Optional[PoolDetails] = None, |
| 327 | + user: Optional[BaseUser] = None, |
327 | 328 | ) -> bool: |
328 | 329 | """ |
329 | 330 | Return whether the user is authorized to perform a given action on a pool. |
@@ -367,8 +368,8 @@ def is_authorized_variable( |
367 | 368 | self, |
368 | 369 | *, |
369 | 370 | method: ResourceMethod, |
370 | | - details: VariableDetails | None = None, |
371 | | - user: BaseUser | None = None, |
| 371 | + details: Optional[VariableDetails] = None, |
| 372 | + user: Optional[BaseUser] = None, |
372 | 373 | ) -> bool: |
373 | 374 | """ |
374 | 375 | Return whether the user is authorized to perform a given action on a variable. |
@@ -412,7 +413,7 @@ def is_authorized_view( |
412 | 413 | self, |
413 | 414 | *, |
414 | 415 | access_view: AccessView, |
415 | | - user: BaseUser | None = None, |
| 416 | + user: Optional[BaseUser] = None, |
416 | 417 | ) -> bool: |
417 | 418 | """ |
418 | 419 | Return whether the user is authorized to access a read-only state of the installation. |
@@ -446,9 +447,9 @@ def is_authorized_view( |
446 | 447 | def is_authorized_custom_view( |
447 | 448 | self, |
448 | 449 | *, |
449 | | - method: ResourceMethod | str, |
| 450 | + method: Union[ResourceMethod, str], |
450 | 451 | resource_name: str, |
451 | | - user: BaseUser | None = None, |
| 452 | + user: Optional[BaseUser] = None, |
452 | 453 | ) -> bool: |
453 | 454 | """ |
454 | 455 | Return whether the user is authorized to perform a given action on a custom view. |
|
0 commit comments