From 1cff4516b89e8de08886b523cf09677c93c5c51a Mon Sep 17 00:00:00 2001 From: Kanthi Date: Wed, 5 Jan 2022 09:25:58 -0500 Subject: [PATCH] Disabled edit button in task instances list view page (#20659) --- airflow/www/views.py | 7 ------- tests/www/views/test_views_tasks.py | 24 ------------------------ 2 files changed, 31 deletions(-) diff --git a/airflow/www/views.py b/airflow/www/views.py index 06fba65092c69..85d876643e452 100644 --- a/airflow/www/views.py +++ b/airflow/www/views.py @@ -4367,18 +4367,11 @@ class TaskInstanceModelView(AirflowPrivilegeVerifierModelView): class_permission_name = permissions.RESOURCE_TASK_INSTANCE method_permission_name = { 'list': 'read', - 'action_clear': 'edit', 'action_muldelete': 'delete', - 'action_set_running': 'edit', - 'action_set_failed': 'edit', - 'action_set_success': 'edit', - 'action_set_retry': 'edit', - 'action_set_skipped': 'edit', } base_permissions = [ permissions.ACTION_CAN_CREATE, permissions.ACTION_CAN_READ, - permissions.ACTION_CAN_EDIT, permissions.ACTION_CAN_DELETE, permissions.ACTION_CAN_ACCESS_MENU, ] diff --git a/tests/www/views/test_views_tasks.py b/tests/www/views/test_views_tasks.py index 62415628b81d3..8f9059d1a9e22 100644 --- a/tests/www/views/test_views_tasks.py +++ b/tests/www/views/test_views_tasks.py @@ -710,30 +710,6 @@ def test_task_instance_set_state_failure(admin_client, action): check_content_in_response("Failed to set state", resp) -@pytest.mark.parametrize( - "action", - ["clear", "set_success", "set_failed", "set_running", "set_skipped"], - ids=["clear", "success", "failed", "running", "skipped"], -) -def test_set_task_instance_action_permission_denied(session, client_ti_without_dag_edit, action): - task_id = "runme_0" - - # Set the state to success for clearing. - ti_q = session.query(TaskInstance).filter(TaskInstance.task_id == task_id) - ti_q.update({"state": State.SUCCESS}) - session.commit() - - # Send a request to clear. - rowid = _get_appbuilder_pk_string(TaskInstanceModelView, ti_q.one()) - expected_message = f"Access denied for dag_id {ti_q.one().dag_id}" - resp = client_ti_without_dag_edit.post( - "/taskinstance/action_post", - data={"action": action, "rowid": [rowid]}, - follow_redirects=True, - ) - check_content_in_response(expected_message, resp) - - @pytest.mark.parametrize( "task_search_tuples", [