Skip to content

Map Superset roles to our auth0 RBAC roles - #64

Merged
rudokemper merged 12 commits into
mainfrom
57/map-superset-roles-to-auth0-rbac
Jul 29, 2026
Merged

rudokemper merged 12 commits into
mainfrom
57/map-superset-roles-to-auth0-rbac

Conversation

@rudokemper

@rudokemper rudokemper commented Jul 21, 2026 •

Copy link
Copy Markdown
Member

Goal

Closes #57.

After a evening of wrestling with very sparse Superset AND auth0 documentation plus much debugging, I can't believe I actually got this working! 😮

The lack of synchronization between GC (Landing Page and Explorer) and Superset roles is a major pain point for users! This PR solves that problem by not only reading the roles upon registration, but also synchronizing them every login. (This means no drift between Superset and GC roles.)

What I changed and why

  • Added AUTH_ROLES_SYNC_AT_LOGIN and AUTH_ROLES_MAPPING vars (set to our RBAC definitions)
  • Falls back to Public if no Role is set (de-unionized).
  • Removes USER_ROLE as we no longer need this.
  • Added documentation including the necessary Post-Login Action that needs to be added to auth0 to add user roles to /userinfo response.
  • While I was here, I noticed that Superset /userinfo returns first and last name, so I got rid of some unnecessary and not very robust code that split name into two parts to construct these.

How I convinced myself this is right

By trying it, and through debug logs (now turned off).

To reproduce (can be done on Staging):

  • Have a Guest account.
  • Sign in to Superset (whether first time or account already existing).
  • You will be assigned Gamma role. Log out.
  • Change that account's role to Member.
  • Sign in to Superset again.
  • Now, that account will have Alpha role.

What I'm not doing here

In gc-deploy, we will need to:

  • Document the need to add the Roles Post-Login action
  • Rip out USER_ROLE from one-click-app YAML definition (and adjust onboarding documentation)

EDIT: WIP branch here https://github.com/ConservationMetrics/gc-deploy/tree/rk/superset-rbac-sync-changes

LLM use disclosure

I had Cursor generate docs, very minimal.

@rudokemper
rudokemper force-pushed the 57/map-superset-roles-to-auth0-rbac branch from f12863c to 756da3b Compare July 22, 2026 00:33
@rudokemper
rudokemper force-pushed the 57/map-superset-roles-to-auth0-rbac branch from f63a969 to ddf73ea Compare July 22, 2026 01:26
@rudokemper rudokemper changed the title [WIP] Add AUTH_ROLES_MAPPING to superset_config.py [WIP] Map Superset roles to our auth0 RBAC roles Jul 22, 2026
@rudokemper
rudokemper requested a review from IamJeffG July 22, 2026 02:01
@rudokemper rudokemper changed the title [WIP] Map Superset roles to our auth0 RBAC roles Map Superset roles to our auth0 RBAC roles Jul 22, 2026

@IamJeffG IamJeffG left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing.

Comment on lines +257 to +261
AUTH_ROLES_MAPPING = {
"Admin": ["Admin"],
"Member": ["Alpha"],
"Guest": ["Gamma"],
"SignedIn": ["Public"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

your code comment links to the canonical Superset roles. Is there a similar canonical reference for GC Explorer roles that would come from Auth0?

@rudokemper
rudokemper merged commit b1d9f50 into main Jul 29, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Map Superset roles to our Guardian Connector RBAC roles in auth0

2 participants