Andrushika commented on code in PR #76515:
URL: https://github.com/apache/airflow/pull/76515#discussion_r4661901340


##########
airflow-core/src/airflow/api_fastapi/core_api/security.py:
##########
@@ -1412,18 +1416,33 @@ def inner(
     return inner
 
 
+# Request parameter identifying a team-scoped resource, and the columns to 
read its team from.
+TEAM_SCOPED_RESOURCES = {
+    "pool_name": (Pool.team_name, Pool.pool),
+    "variable_key": (Variable.team_name, Variable.key),
+    "connection_id": (Connection.team_name, Connection.conn_id),
+}
+
+
 async def _collect_teams_to_check(
     method: ResourceMethod,
     request: Request,
-    resource_id: str | None,
-    get_existing_team: Callable[[str], str | None],
+    resource_param: str,
+    *,
+    session: AsyncSession,

Review Comment:
   Fixed!



##########
airflow-core/tests/unit/api_fastapi/test_event_loop_blocking.py:
##########
@@ -158,6 +158,26 @@ def test_known_route_no_longer_blocks(self, test_client, 
event_loop_queries, ent
         method, path = route.split(" ", 1)
         assert not _send_request(test_client, event_loop_queries, method, 
path, mode)
 
+    @conf_vars({("core", "multi_team"): "True"})
+    @pytest.mark.parametrize(
+        ("url", "body"),
+        [
+            pytest.param("/api/v2/pools", {"name": "team_pool", "slots": 1}, 
id="pool"),
+            pytest.param(
+                "/api/v2/connections", {"connection_id": "team_conn", 
"conn_type": "http"}, id="connection"
+            ),
+            pytest.param("/api/v2/variables", {"key": "team_var", "value": 
"v"}, id="variable"),
+        ],
+    )
+    def test_team_lookup_runs_no_sync_sql_on_the_event_loop(

Review Comment:
   Added, 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]

Reply via email to