GitHub user user1500177 edited a discussion: Best Way to Attach Dashboard RBAC 
Roles Automatically in Superset

I’m currently working on a Superset deployment where I need to automatically 
attach specific roles (e.g., Gamma) to all dashboards. The goal is to ensure 
that every dashboard has predefined roles assigned for RBAC (Role-Based Access 
Control). I’ve explored a few approaches, but I’d like to get feedback from the 
community on the best and most maintainable way to achieve this.

  -- Assign 'Gamma' role to all dashboards
  WITH role_cte AS (
      SELECT id AS role_id
      FROM ab_role
      WHERE name = 'Gamma'
  )
  INSERT INTO dashboard_roles (dashboard_id, role_id)
  SELECT d.id, r.role_id
  FROM dashboards d
  CROSS JOIN role_cte r
  LEFT JOIN dashboard_roles dr ON d.id = dr.dashboard_id AND dr.role_id = 
r.role_id
  WHERE dr.dashboard_id IS NULL;

How to add this role to all the dashboards
How to uploaded ONLY to specific dashboards or to the dashboards that are going 
to be uploaded in future

CAN I DO THIS VIA superset_config.py , Which is the best way to automate this ?
I have already adde the Falg for this  DASHBOARD_RBAC

GitHub link: https://github.com/apache/superset/discussions/35570

----
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]

Reply via email to