Search code examples
apache-superset

Creating a Superset user programmatically


How to go about creating users programmatically in Superset with a defined role?

Say I have an email sign in page. User signs up. After sign up I would like to programmatically create the user with the gamma role into a Superset instance.


Solution

  • If you're set on creating users programmatically, then your best bet is probably to look into overriding the SecurityManager of the underlying Flask-App-Builder (F.A.B.) framework - which Superset is based off.

    The documentation can be found here: https://github.com/dpgaspar/Flask-AppBuilder/blob/master/docs/security.rst#your-custom-security

    That being said - it feels your question is really about how to allow users to self-register in Superset and give them the Gamma role by default.

    This is a use-case FAB addresses explicitly, and you should be able to achieve this just through configuration: http://flask-appbuilder.readthedocs.io/en/latest/user_registration.html