alexandrusoare opened a new pull request, #38515: URL: https://github.com/apache/superset/pull/38515
### SUMMARY Matrixify charts throws access errors when it is embedded. #### Root Cause When a chart is matrixified, it generates multiple cells that each make independent API requests. The `MatrixifyGridGenerator.ts` was explicitly setting `slice_id: undefined` in each cell's formData (line 130). The backend permission check for embedded/guest users (`superset/security/manager.py:2559-2604`) requires **both**: 1. `dashboardId` - to identify the dashboard context 2. `slice_id` - to verify the chart belongs to the dashboard When `slice_id` was removed, the backend couldn't verify the chart belonged to the dashboard, so it denied access and required `all_datasource_access` instead. #### Possible Solutions | Solution | Description | Pros | Cons | | --- | --- | --- | --- | | **1. Preserve `slice_id` (Implemented)** | Remove `slice_id: undefined` from overrides so cells inherit parent's `slice_id` | Minimal change (1 line), no backend changes, works immediately | Cells share same `slice_id` (but this is semantically correct) | | **2. Add `parent_slice_id`** | Keep `slice_id: undefined` but add new `parent_slice_id` field; modify backend to check both | Explicit separation of concerns | Requires frontend + backend changes, more complex | | **3. Pass permission context separately** | Send `slice_id`/`dashboardId` as API query params instead of in formData | Clean separation between query data and permissions | Requires changes to StatefulChart, API handling, and backend | #### Implemented Fix **Solution 1** - Removed `slice_id: undefined` from the overrides in `MatrixifyGridGenerator.ts`. This is safe because: - Matrixify uses `StatefulChart` which doesn't use Redux or the dashboard's chart action system - Backend cache keys are based on query parameters (metrics, filters), not `slice_id` - Cells ARE derived from the parent chart, so sharing `slice_id` is semantically correct ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF <!--- Skip this if not applicable --> ### TESTING INSTRUCTIONS <!--- Required! What steps can be taken to manually verify the changes? --> ### ADDITIONAL INFORMATION <!--- Check any relevant boxes with "x" --> <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue --> - [ ] Has associated issue: - [ ] Required feature flags: - [ ] Changes UI - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351)) - [ ] Migration is atomic, supports rollback & is backwards-compatible - [ ] Confirm DB migration upgrade and downgrade tested - [ ] Runtime estimates and downtime expectations provided - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
