Fury0508 commented on code in PR #60973:
URL: https://github.com/apache/airflow/pull/60973#discussion_r2722964593


##########
providers/fab/src/airflow/providers/fab/auth_manager/api_fastapi/routes/users.py:
##########
@@ -45,3 +51,83 @@
 def create_user(body: UserBody) -> UserResponse:
     with get_application_builder():
         return FABAuthManagerUsers.create_user(body=body)
+
+
+@users_router.get(
+    "/users",
+    response_model=UserCollectionResponse,
+    responses=create_openapi_http_exception_doc(
+        [
+            status.HTTP_400_BAD_REQUEST,
+            status.HTTP_401_UNAUTHORIZED,
+            status.HTTP_403_FORBIDDEN,
+        ]
+    ),
+    dependencies=[Depends(requires_fab_custom_view("GET", 
permissions.RESOURCE_USER))],
+)
+def get_users(
+    order_by: str = Query("id", description="Field to order by. Prefix with 
'-' for descending."),
+    limit: int = Depends(get_effective_limit()),
+    offset: int = Query(0, ge=0, description="Number of items to skip before 
starting to collect results."),
+) -> UserCollectionResponse:
+    """List users with pagination and ordering."""
+    with get_application_builder():
+        return FABAuthManagerUsers.get_users(order_by=order_by, limit=limit, 
offset=offset)
+
+
+@users_router.get(
+    "/users/{username}",
+    responses=create_openapi_http_exception_doc(
+        [
+            status.HTTP_401_UNAUTHORIZED,
+            status.HTTP_403_FORBIDDEN,
+            status.HTTP_404_NOT_FOUND,
+        ]
+    ),
+    dependencies=[Depends(requires_fab_custom_view("GET", 
permissions.RESOURCE_USER))],
+)
+def get_user(username: str = Path(..., min_length=1)) -> UserResponse:
+    """Get a user by username."""
+    with get_application_builder():
+        return FABAuthManagerUsers.get_user(username=username)
+
+
+@users_router.patch(
+    "/users/{username}",
+    responses=create_openapi_http_exception_doc(
+        [
+            status.HTTP_400_BAD_REQUEST,
+            status.HTTP_401_UNAUTHORIZED,
+            status.HTTP_403_FORBIDDEN,
+            status.HTTP_404_NOT_FOUND,
+            status.HTTP_409_CONFLICT,
+        ]
+    ),
+    dependencies=[Depends(requires_fab_custom_view("PUT", 
permissions.RESOURCE_USER))],
+)
+def update_user(
+    body: UserPatchBody,
+    username: str = Path(..., min_length=1),
+    update_mask: str | None = Query(None, description="Comma-separated list of 
fields to update"),
+) -> UserResponse:
+    """Update an existing user."""
+    with get_application_builder():
+        return FABAuthManagerUsers.update_user(username=username, body=body, 
update_mask=update_mask)
+
+
+@users_router.delete(
+    "/users/{username}",
+    status_code=status.HTTP_204_NO_CONTENT,
+    responses=create_openapi_http_exception_doc(
+        [
+            status.HTTP_401_UNAUTHORIZED,
+            status.HTTP_403_FORBIDDEN,
+            status.HTTP_404_NOT_FOUND,
+        ]
+    ),
+    dependencies=[Depends(requires_fab_custom_view("DELETE", 
permissions.RESOURCE_USER))],
+)
+def delete_user(username: str = Path(..., min_length=1)) -> None:
+    """Delete a user by username."""
+    with get_application_builder():
+        FABAuthManagerUsers.delete_user(username=username)

Review Comment:
   Sounds good — I’ll remove the -> None return annotation first and re-run CI. 
If it still fails, I’ll follow up with the results.



-- 
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