Git Product home page Git Product logo

airflow-user-management-plugin's Introduction

airflow-user-management-plugin

Description

A plugin to Apache Airflow (Documentation: https://airflow.apache.org/, Source Code: https://github.com/apache/airflow) to provide an interface where you can add a PasswordUser to Airflow and manage

RBAC Support

If you are using the Airflow versions 1.10.x and higher then this plugin is useful only when RBAC feature is disabled. You can check the rbac setting in airflow.cfg config file under webserver category. When RBAC feature is enabled you can manage users directly from the Security menu provided by Airflow UI.

Note: Once you enable the RBAC support, it will create new set of Database Tables. So, you need to manually migrate your existing users from users table to the new table ab_users. While migrating you need to specify the role for each user. Please check Create User for more details.

How do Deploy

  1. Copy the user_management_plugin.py file into the Airflow Plugins directory

    • The Airflow Plugins Directory is defined in the airflow.cfg file as the variable "plugins_folder"

    • The Airflow Plugins Directory is, by default, ${AIRFLOW_HOME}/plugins

    • You may have to create the Airflow Plugins Directory folder as it is not created by default

    • quick way of doing this:

        $ cd {AIRFLOW_PLUGINS_FOLDER}
        $ wget https://raw.githubusercontent.com/teamclairvoyant/airflow-user-management-plugin/master/plugins/user_management_plugin.py
  2. Restart the Airflow Services

  3. Your done!

How to Use

Once you've restarted the Web Application, you should now see a new Tab: Admin -> User Management. From here, you can create new users and update or delete existing ones.

Configuration

Note: superuser flag in the create/edit user form will be effective only from version >= 2.0

####Known issues

  • Issue: When you run the plugin with SQLAlchemy versions >= 1.2.x on Airflow versions < 1.10.x then you might run into the following AttributeError issue

      [2019-03-19 11:07:52,979] {user_management_plugin.py:71} INFO - UserManagementModelView.create_model(form=<flask_admin.contrib.sqla.form.PasswordUserForm object at 0x7fbf3362af90>)
      [2019-03-19 11:07:52,979] {user_management_plugin.py:82} ERROR - Failed to create record.
      Traceback (most recent call last):
       File "/home/dillip/airflow/plugins/user_management_plugin.py", line 75, in create_model
         form.populate_obj(model)
       File "/home/dillip/.local/lib/python2.7/site-packages/wtforms/form.py", line 96, in populate_obj
         field.populate_obj(obj, name)
       File "/home/dillip/.local/lib/python2.7/site-packages/wtforms/fields/core.py", line 330, in populate_obj
         setattr(obj, name, self.data)
       File "/home/dillip/.local/lib/python2.7/site-packages/sqlalchemy/ext/hybrid.py", line 899, in __set__
         raise AttributeError("can't set attribute")
      AttributeError: can't set attribute 
    

    Resolution: Please use SQLAlchemy versions <= 1.1.18 to resolve the issue.

airflow-user-management-plugin's People

Contributors

rssanders3 avatar shrmnk avatar sudhakar-nallam avatar

Stargazers

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

Watchers

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

airflow-user-management-plugin's Issues

Can't update user password.

I changed my password, but show error.

Node: work-pc

Traceback (most recent call last):
File "/home/u01/airflow/env/lib/python3.4/site-packages/flask/app.py", line 1988, in wsgi_app
response = self.full_dispatch_request()
File "/home/u01/airflow/env/lib/python3.4/site-packages/flask/app.py", line 1641, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/u01/airflow/env/lib/python3.4/site-packages/flask/app.py", line 1544, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/u01/airflow/env/lib/python3.4/site-packages/flask/_compat.py", line 33, in reraise
raise value
File "/home/u01/airflow/env/lib/python3.4/site-packages/flask/app.py", line 1639, in full_dispatch_request
rv = self.dispatch_request()
File "/home/u01/airflow/env/lib/python3.4/site-packages/flask/app.py", line 1625, in dispatch_request
return self.view_functionsrule.endpoint
File "/home/u01/airflow/env/lib/python3.4/site-packages/flask_admin/base.py", line 69, in inner
return self._run_view(f, *args, **kwargs)
File "/home/u01/airflow/env/lib/python3.4/site-packages/flask_admin/base.py", line 368, in _run_view
return fn(self, *args, **kwargs)
File "/home/u01/airflow/env/lib/python3.4/site-packages/flask_admin/model/base.py", line 1974, in edit_view
if self.update_model(form, model):
File "/home/u01/airflow/plugins/airflow-user-management-plugin/plugins/user_management_plugin.py", line 96, in update_model
logging.info("form.password_confirm: " + str(form.password_confirm))
AttributeError: 'PasswordUserForm' object has no attribute 'password_confirm'

i try change code:
user_management_plugin.py
line 96:
# logging.info("form.password_confirm: " + str(form.password_confirm))

Then it runs fine.

Security Issue

Hi,

I tried using this plugin and I noticed even when the users are logged out they can access the user management page which shouldn't be an expected behavior when it comes to managing users and in security perspective.

I hope you find this useful for improving this plugin.

Thanks for this plugin!

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.