Skip to content

Commit

Permalink
Disabled edit button in task instances list view page (#20659)
Browse files Browse the repository at this point in the history
  • Loading branch information
subkanthi authored Jan 5, 2022
1 parent e374fae commit 1cff451
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 31 deletions.
7 changes: 0 additions & 7 deletions airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
]
Expand Down
24 changes: 0 additions & 24 deletions tests/www/views/test_views_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
[
Expand Down

0 comments on commit 1cff451

Please sign in to comment.