You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "dosubot[bot] (via GitHub)" <gi...@apache.org> on 2026/05/02 02:54:45 UTC
Re: [D] To add custom role via superset_config.py [superset]
GitHub user dosubot[bot] edited a comment on the discussion: To add custom role via superset_config.py
<!-- Answer -->
There isn't a supported way to declaratively create or configure custom roles (with specific permissions) directly in superset_config.py. This file is intended for configuration, not for programmatic role or permission management. You can use superset_config.py to set role-related options like `PUBLIC_ROLE_LIKE` or `GUEST_ROLE_NAME` (which control how permissions are copied to the Public role or which role is used for guest/embedded users), but you still need to create and configure the actual roles and permissions via the UI, API, or CLI ([discussion](https://github.com/apache/superset/discussions/33674)).
If you need to automate role creation, the recommended approach is to use the Superset UI (Security → List Roles), the Flask AppBuilder security API (enable with `FAB_ADD_SECURITY_API = True` in superset_config.py), or by customizing the `SupersetSecurityManager` class ([code reference](https://github.com/apache/superset/blob/829e4d92d91ceae4b43b1ed3b063ffe45377799c/superset/security/manager.py)). While you technically can run arbitrary Python code in superset_config.py, there is no officially supported or documented hook to safely create or modify roles at startup via this file.
For restricting a role to only see dashboards and charts, create the role via the UI or API, assign only the necessary permissions (like `can_read` on dashboards and charts), and assign users to that role. If you want to automate this, consider writing a custom initialization script or using the security API, not superset_config.py ([reference](https://github.com/apache/superset/issues/31637)).
<!-- Dosu Comment Footer -->
*To reply, just mention [@dosu](https://go.dosu.dev/dosubot?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=reply-with-mention&utm_term=apache%2Fsuperset).*
---
Docs are dead. Just use [Dosu](https://dosu.dev?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-tagline&utm_term=apache%2Fsuperset).
[](https://app.dosu.dev/response-feedback?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-feedback&utm_term=apache%2Fsuperset&message_id=d1b5a066-ff27-403a-8c30-31b31cd808ef) [](https://github.dosu.com/apache/superset?utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-ask-repo&utm_term=apache%2Fsuperset) [](https://app.dosu.dev/signup?referrer=openSource&source=github-footer&utm_source=github&utm_medium=bot-comment&utm_campaign=github-comment-footer-20260415&utm_content=static-docs-share-team&utm_term=apache%2Fsuperset)
GitHub link: https://github.com/apache/superset/discussions/34551#discussioncomment-14004321
----
This is an automatically sent email for notifications@superset.apache.org.
To unsubscribe, please send an email to: notifications-unsubscribe@superset.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org