我使用的方法归结为以下几点:
# For superset version >= 0.25.0
from superset.security import SupersetSecurityManager
class CustomSecurityManager(SupersetSecurityManager):
def __init__(self, appbuilder):
super(CustomSecurityManager, self).__init__(appbuilder)
def whatever_you_want_to_override(self, ...):
# Your implementation here
CUSTOM_SECURITY_MANAGER = CustomSecurityManager
# For superset version < 0.25.0
from flask_appbuilder.security.sqla.manager import SecurityManager
class CustomSecurityManager(SecurityManager):
def __init__(self, appbuilder):
super(CustomSecurityManager, self).__init__(appbuilder)
def whatever_you_want_to_override(self, ...):
# Your implementation here
CUSTOM_SECURITY_MANAGER = CustomSecurityManager