o-nikolas commented on code in PR #55306:
URL: https://github.com/apache/airflow/pull/55306#discussion_r2331045324
##########
airflow-core/src/airflow/api_fastapi/core_api/security.py:
##########
@@ -255,21 +255,28 @@ def inner(
request: BulkBody[PoolBody],
user: GetUserDep,
) -> None:
+ existing_pool_names = [
+ cast("str", entity) if action.action == BulkAction.DELETE else
cast("PoolBody", entity).pool
+ for action in request.actions
+ for entity in action.entities
+ if action.action != BulkAction.CREATE
+ ]
+ teams = Pool.get_bulk_team_name(existing_pool_names)
+
requests: list[IsAuthorizedPoolRequest] = []
for action in request.actions:
- requests.extend(
- [
- {
- "method":
MAP_BULK_ACTION_TO_AUTH_METHOD[action.action],
- "details": PoolDetails(
- name=cast("str", pool)
- if action.action == BulkAction.DELETE
- else cast("PoolBody", pool).pool
- ),
- }
- for pool in action.entities
- ]
- )
+ for pool in action.entities:
+ pool_name = (
+ cast("str", pool) if action.action == BulkAction.DELETE
else cast("PoolBody", pool).pool
+ )
+ req: IsAuthorizedPoolRequest = {
+ "method": MAP_BULK_ACTION_TO_AUTH_METHOD[action.action],
+ "details": PoolDetails(
+ name=pool_name,
+ team_name=teams.get(pool_name),
Review Comment:
Got it, thanks!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]