ferruzzi commented on code in PR #37666:
URL: https://github.com/apache/airflow/pull/37666#discussion_r1511932893


##########
airflow/providers/amazon/aws/auth_manager/aws_auth_manager.py:
##########
@@ -443,6 +443,62 @@ def batch_is_authorized_variable(
         ]
         return self.avp_facade.batch_is_authorized(requests=facade_requests, 
user=self.get_user())
 
+    def filter_permitted_dag_ids(
+        self,
+        *,
+        dag_ids: set[str],
+        methods: Container[ResourceMethod] | None = None,
+        user=None,
+    ):
+        """
+        Filter readable or writable DAGs for user.
+
+        :param dag_ids: the list of DAG ids
+        :param methods: whether filter readable or writable
+        :param user: the current user
+        """
+        if not methods:
+            methods = ["PUT", "GET"]
+
+        if not user:
+            user = self.get_user()
+
+        requests: dict[str, dict[ResourceMethod, IsAuthorizedRequest]] = {}
+        requests_list: list[IsAuthorizedRequest] = []
+        for dag_id in dag_ids:
+            for method in ["GET", "PUT"]:

Review Comment:
   Adding on to Niko's comment above, if you use type ResourceMethod instead of 
a string, this simplifies the rest of this code as well.  You only ever use 
`method` after casting it (twice) anyway.  Seems like you might as well use it 
directly as a ResourceMethod



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