vatsrahul1001 commented on code in PR #45609:
URL: https://github.com/apache/airflow/pull/45609#discussion_r1923131925


##########
airflow/api_fastapi/common/db/common.py:
##########
@@ -179,3 +185,91 @@ def paginated_select(
     statement = apply_filters_to_select(statement=statement, 
filters=[order_by, offset, limit])
 
     return statement, total_entries
+
+
+def action_logging(event: str | None):
+    async def log_action(
+        request: Request,
+        session: SessionDep,
+        user: Annotated[BaseUser, Depends(get_user_with_exception_handling)],
+    ):
+        """Log user actions."""
+        if not user:
+            user_name = "anonymous"
+            user_display = ""
+        else:
+            # user_name = user.role
+            # user_display = user.username
+            user_name = getattr(user, "role", "unknown_role")
+            user_display = getattr(user, "username", "unknown_user")
+
+        # Extract basic request details
+        query_params = dict(request.query_params)
+        extra_fields = {
+            "path": request.url.path,
+            "method": request.method,
+            "query_params": query_params,
+        }
+
+        # Add JSON body if present
+        json_body = {}
+        try:
+            if request.headers.get("content-type") == "application/json":
+                json_body = await request.json()
+                extra_fields.update({k: secrets_masker.redact(v, k) for k, v 
in json_body.items()})
+        except Exception as e:
+            extra_fields["json_error"] = str(e)

Review Comment:
   No, updated as per legacy implementation



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