-
Notifications
You must be signed in to change notification settings - Fork 160
Description
Motivation
Superset implements role-based access control (RBAC) to ensure users only interact with features they have permission to use. When users click on a chart's "View query" option, they see a modal displaying the SQL query. This modal currently shows a "View in SQL Lab" button to all users, regardless of whether they have access to SQL Lab.
This creates a poor user experience and potential security concern.
Current Behavior
The "View query" modal displays a "View in SQL Lab" button to all users, even those who lack the menu access on SQL Lab permission.
Reproduction Steps:
- Create a user account with a role that does NOT include the
menu access on SQL Labpermission (e.g., a basic viewer role) - Log in with this restricted user account
- Navigate to any dashboard with charts
- Click on a chart's ellipsis menu (three dots) and select "View query"
- Observe: The modal opens and displays a "View in SQL Lab" button, even though the user cannot access SQL Lab
Expected Behavior
The "View query" modal should conditionally render the "View in SQL Lab" button based on the user's permissions. Users without the menu access on SQL Lab permission should not see this button at all.
Acceptance Criteria:
- Users with
menu access on SQL Labpermission see the "View in SQL Lab" button in the View query modal - Users without
menu access on SQL Labpermission do NOT see the "View in SQL Lab" button in the View query modal - Other modal functionality (Copy button, SQL display, format toggle) remains visible and functional for all users regardless of SQL Lab access
Steps To Test
- Create two test user accounts: one with SQL Lab access and one without
- Log in as the user WITH SQL Lab access
- Open a dashboard, click on a chart's ellipsis menu, and select "View query"
- Confirm the "View in SQL Lab" button is visible
- Log out and log in as the user WITHOUT SQL Lab access
- Repeat step 3
- Confirm the "View in SQL Lab" button is NOT visible, but the Copy button and other modal elements are still present
Submission
Download https://cap.so/ to record your screen (use Studio mode). Export as an mp4, and drag and drop into an issue comment below.
Guide to submitting pull requests: https://hackmd.io/@timothy1ee/Hky8kV3hlx