欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Superset查询用户报表看板权限

程序员文章站 2022-03-10 16:21:25
...

本来想google一下的,结果没找到,写完了就分享出来,方便大家。

SELECT  a.dashboard_title
       ,a.id
       ,c.datasource_id
       ,c.perm
       ,c.schema_perm
       ,h.last_name
FROM dashboards a
LEFT JOIN dashboard_slices b
ON a.id = b.dashboard_id
LEFT JOIN slices c
ON b.slice_id=c.id
JOIN ab_view_menu d
ON d.name=c.schema_perm
JOIN ab_permission_view e
ON e.view_menu_id = d.id
JOIN ab_permission_view_role f
ON f.permission_view_id = e.id
JOIN ab_user_role g
ON g.role_id = f.role_id
JOIN ab_user h
ON h.id = g.user_id AND active = 1
GROUP BY  1
         ,2
         ,3
         ,4
         ,5
         ,6 
union
SELECT  a.dashboard_title
       ,a.id
       ,c.datasource_id
       ,c.perm
       ,c.schema_perm
       ,h.last_name
FROM dashboards a
LEFT JOIN dashboard_slices b
ON a.id = b.dashboard_id
LEFT JOIN slices c
ON b.slice_id=c.id
JOIN ab_view_menu d
ON d.name=c.perm
JOIN ab_permission_view e
ON e.view_menu_id = d.id
JOIN ab_permission_view_role f
ON f.permission_view_id = e.id
JOIN ab_user_role g
ON g.role_id = f.role_id
JOIN ab_user h
ON h.id = g.user_id AND active = 1
GROUP BY  1
         ,2
         ,3
         ,4
         ,5
         ,6;