Skip to content
Discussion options

You must be logged in to vote

For anybody interested, the solution is to write this piece of code in superset_config.py:

def FLASK_APP_MUTATOR(app):
    from flask import g, redirect, request
    from flask_login import current_user

    @app.before_request
    def clearbi_role_redirect():
        if request.path != "/superset/welcome/":
            return None

        if not current_user or not current_user.is_authenticated:
            return None

        user_roles = [role.name for role in g.user.roles]

        if "Role1" in user_roles:
            return redirect("/url1")

        if "Role2" in user_roles:
            return redirect("/url2")

        return None

Remember to change the role names and the urls.

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@sfirke
Comment options

sfirke Mar 11, 2026
Collaborator

@carlosaran667
Comment options

Comment options

You must be logged in to vote
1 reply
@dosubot
Comment options

Comment options

You must be logged in to vote
1 reply
@sfirke
Comment options

sfirke Mar 13, 2026
Collaborator

Answer selected by carlosaran667
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants