You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/06/14 09:45:52 UTC

[GitHub] [airflow] bhavaniravi commented on a diff in pull request #24079: Add: #23880 :: Audit log for AirflowModelViews(Variables/Connection)

bhavaniravi commented on code in PR #24079:
URL: https://github.com/apache/airflow/pull/24079#discussion_r896609957


##########
airflow/www/views.py:
##########
@@ -3667,6 +3667,19 @@ class AirflowModelView(ModelView):
 
     CustomSQLAInterface = wwwutils.CustomSQLAInterface
 
+    def __getattribute__(self, attr):
+        attribute = object.__getattribute__(self, attr)
+        if callable(attribute) and attr in [
+            "add",
+            "edit",
+            "delete",
+            "download",
+            "action",
+            "action_post",
+        ]:
+            return action_logging(event=f"{self.route_base.strip('/')}.{attr}")(attribute)
+        return attribute

Review Comment:
   The problem with overriding is how to generate the event name at the decorator level. `{self.route_base.strip('/')}.{attr}` we won't have the `self` to recognize if the action is for variable or connection



-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org