Skip to content

Wrong sample code for "dag level permissions" #36349

@oshyun

Description

@oshyun

What do you see as an issue?

The three actions allowed in DAG-level permissions are as follows:

DAG_ACTIONS = {ACTION_CAN_READ, ACTION_CAN_EDIT, ACTION_CAN_DELETE}

However, the sample code in this document includes can_create.

DAG(
    dag_id="example_fine_grained_access",
    start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),
    access_control={
        "Viewer": {"can_edit", "can_create", "can_delete"},
    },
)

If you use the above code, the following error occurs:image

Solving the problem

Change the document sample code as follows:

DAG(
    dag_id="example_fine_grained_access",
    start_date=pendulum.datetime(2021, 1, 1, tz="UTC"),
    access_control={
-        "Viewer": {"can_edit", "can_create", "can_delete"},
+        "Viewer": {"can_edit", "can_read", "can_delete"},
    },
)

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions