dosubot[bot] commented on issue #29523:
URL: https://github.com/apache/superset/issues/29523#issuecomment-2217628674
<!-- Answer -->
To ensure that the role field is mandatory for users logging in via OAuth in
Superset without modifying the codebase, you can configure the
`AUTH_USER_REGISTRATION_ROLE` and `AUTH_ROLES_SYNC_AT_LOGIN` settings in your
`superset_config.py` file. This will enforce role assignment during user
registration and synchronization at login.
Here is how you can configure it:
```python
# Enable user self-registration
AUTH_USER_REGISTRATION = True
# Set the default user self-registration role
AUTH_USER_REGISTRATION_ROLE = "Public"
# Ensure roles are synced at every login
AUTH_ROLES_SYNC_AT_LOGIN = True
# Map OAuth groups to Superset roles
AUTH_ROLES_MAPPING = {
"superset_users": ["Gamma", "Alpha"],
"superset_admins": ["Admin"],
}
```
This configuration ensures that every user who logs in via OAuth will have a
role assigned, and their roles will be synchronized at each login.
Additionally, you can refer to the main configuration file for more details on
authentication and role settings
<sup>[[1]](https://github.com/apache/superset/blob/master/docs/docs/configuration/configuring-superset.mdx)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset/config.py)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]