GitHub user carlosaran667 edited a comment on the discussion: Redirect upon
logging in based on user role in 6.0.0
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 urls.
GitHub link:
https://github.com/apache/superset/discussions/38580#discussioncomment-16112312
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]