'Create or Update Roles in SuperSet Programmatically

Is there any way by which we can create new roles programmatically in Superset? I have checked the docs but can't find any hooks to create the roles programmatically.



Solution 1:[1]

I use Superset as a python library, and got the same problem a few months ago...

first you have to create a Custom Security Manager... to do this i read this tutorial https://programmer.group/tutorial-how-to-integrate-superset-in-your-own-application.html

Essentially you make the call from your superset_config.py file like this

from core_utils.security import CustomSecurityManager

CUSTOM_SECURITY_MANAGER = CustomSecurityManager

In the init method of the CustomSecurityManager() you can make the call to add_role() function... this do the trick

--

  • SupersetSecurityManager is the object that have available functions to manage user programatically
  • Sorry for my bad english, this is my first collaboration, hope this helps

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Emmanuel Palomeque Alcázar