Git Product home page Git Product logo

airflow-rbac-roles-cli's Introduction

airflow-rbac-roles-cli

Airflow provides a way to manage permissions: RBAC. However, this system is only available from UI. Many use cases such as the implementation of an Airflow orchestrator for multiple projects need to take profit of dag-level permissions in order to only authorize some users to access specific project dags. Creating roles with dag-level permissions on multiple dags directly from the UI is very error-prone and time-consuming.

That's why I created a script which given the airflow url, the dag names and the new role name, will automatically create the role with the needed permissions to access only these dags and not the other dags deployed on Airflow.

The tool can be used to create roles for multiple projects inside a same Airflow.

Usage

python3 rbac_roles_cli.py -u airflow_url -r new_role_name -d dag1 dag2

Will create a role named new_role_name on the airflow project at the url airflow_url with enough permissions to only manage the dags dag1 and dag2.

Note that the permissions can be edited directly in the code and following the syntax used in the Airflow code.

Compatibility with Cloud Composer

GCP offers Cloud Composer: a Google-managed Airflow. The script also work with Composer, you only need to add an argument to the command: the Google access-token. This token is used in order to access the Composer page which is protected by a Google authentication page.

python3 rbac_roles_cli.py -u airflow_url -r new_role_name -d dag1 dag2 -t access_token

airflow-rbac-roles-cli's People

Contributors

adamovichaleksey avatar chenzuoli avatar tristanbilot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

airflow-rbac-roles-cli's Issues

Unfortunately, script does not work

Hi,
I have a Airflow installation using Docker on my Linux machine. It has username and password protected. There is no Google authentication used anywhere.
When I run the script :

python3 rbac_roles_cli.py -u http://10.149.32.53:8081 -r NEW_PLATFORMING_ROLE -d IDS_UDL_S3_PLATFORMING_CASES

I get a connection error.

File "rbac_roles_cli.py", line 56, in create_rbac_role_with_permissions
raise PermissionError(f"Error 401 returned, please check the access token if the page is protected by an authentication")

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.