This method is used in DagFileProcessor.process_file - it may be easier to migrate all it's internal calls instead of the whole method.
mock_sync_perm_for_dag.reset_mock()
                frozen_time.shift(20)
                dagbag.sync_to_db(session=session)
            dag = dagbag.dags["test_example_bash_operator"]
            _sync_to_db()
            mock_sync_perm_for_dag.assert_called_once_with(dag, session=session)
            
            _sync_to_db()
            mock_sync_perm_for_dag.assert_not_called()
            
            dag.tags = ["new_tag"]
            _sync_to_db()
            mock_sync_perm_for_dag.assert_called_once_with(dag, session=session)
    @patch("airflow.www.security.ApplessAirflowSecurityManager")
    def test_sync_perm_for_dag(self, mock_security_manager):
        """
        Test that dagbag._sync_perm_for_dag will call ApplessAirflowSecurityManager.sync_perm_for_dag
        when DAG specific perm views don't exist already or the DAG has access_control set.
        """
        db_clean_up()
        with create_session() as session:
            security_manager = ApplessAirflowSecurityManager(session)
            mock_sync_perm_for_dag = mock_security_manager.return_value.sync_perm_for_dag
            mock_sync_perm_for_dag.side_effect = security_manager.sync_perm_for_dag
            dagbag = DagBag(
                dag_folder=os.path.join(TEST_DAGS_FOLDER, "test_example_bash_operator.py"),
                include_examples=False,
            )
            dag = dagbag.dags["test_example_bash_operator"]
            def _sync_perms():