Create or Update Roles in SuperSet Programmatically

Viewed 1084

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.

1 Answers

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
Related