mostopalove opened a new issue, #32552:
URL: https://github.com/apache/superset/issues/32552

   ### Bug description
   
   When using Apache Superset in embedded mode with the Gamma role assigned to 
the guest user, charts fail to load data with a `403` error. The error message 
displayed is:
   
   ```
   This endpoint requires the datasource *, database or all_datasource_access 
permission
   ```
   Granting the `all_datasource_access` permission does not resolve the issue.
   
   ### Steps to Reproduce
   1. Pull the latest Superset code from GitHub.
   2. Configure the application to work in embedded mode by setting:
   
   ```python
   FEATURE_FLAGS = {"EMBEDDED_SUPERSET": True}
   GUEST_ROLE_NAME = "Gamma"
   ```
   
   3. Use the `Gamma` role for the guest user.
   4. Start the application using the following command:
   
   ```bash
   docker compose up --build
   ```
   
   5. Open any dashboard and enable embedding.
   6. Use the dashboard ID in the frontend application (in this case, using 
`@superset-ui/embedded-sdk`).
   7. Open the frontend application in the browser.
   
   ### Expected Behavior
   The user should be able to view all charts with data.
   
   ### Actual Behavior
   All charts fail to load and display the following error:
   
   ```
   This endpoint requires the datasource *, database or all_datasource_access 
permission
   ```
   
   Granting the `all_datasource_access` permission does not fix the issue.
   
   
   
   
   
   ### Screenshots/recordings
   
   ### Root Cause Analysis
   This bug appeared after the `<Charts/>` component was refactored. The issue 
occurs because the request is sent to the backend without the `dashboardID` in 
the `form_data` object. In the previous working implementation, this was 
correctly set, as seen in:
   
   [Previous working 
implementation](https://github.com/apache/superset/blob/superset-helm-chart-0.13.4/superset-frontend/src/dashboard/containers/Chart.jsx#L90)
   
   The refactored implementation can be found here:
   [Refactored `<Charts/>` 
component](https://github.com/apache/superset/blob/master/superset-frontend/src/dashboard/components/gridComponents/Chart.jsx)
   
   ### Proposed Solution
   The fix is simple and requires only two lines of code to ensure 
`dashboardID` is included in `form_data`:
   
   ```javascript
   const dashboardInfo = useSelector(state => state.dashboardInfo);
   formData.dashboardId = dashboardInfo.id;
   ```
   
   ### Screenshots
   #### Before Fix:
   <img width="1512" alt="Image" 
src="https://github.com/user-attachments/assets/11a464e2-7668-4bb8-977d-72c68c75e7ac";
 />
   
   #### After Fix:
   <img width="1506" alt="Image" 
src="https://github.com/user-attachments/assets/6b485e0e-7b2a-4244-8951-5ae3a5004e67";
 />
   
   
   ### Superset version
   
   master / latest-dev
   
   ### Python version
   
   3.9
   
   ### Node version
   
   16
   
   ### Browser
   
   Chrome
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [x] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@superset.apache.org
For additional commands, e-mail: notifications-h...@superset.apache.org

Reply via email to