ferruzzi commented on code in PR #37666: URL: https://github.com/apache/airflow/pull/37666#discussion_r1518053030
########## 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: Maybe not. Is the casting just to appease MyPy? It doesn't seem to have any practical effect. I had expected it to at least verify that the value being cast was a valid value... ![image](https://github.com/apache/airflow/assets/1920178/52325b4f-1dc4-480d-a607-802973a15104) You can't iterate over a Literal so `for method in Literal["GET", "PUT"]` is out.... Yeah, I guess I retract this comment, sorry about that. Using a Literal there limited our options, I guess. -- 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-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org