sha174n commented on PR #45622:
URL: https://github.com/apache/superset/pull/45622#issuecomment-6349326574

   @mikebridge thanks, all addressed in 6f0102ee36:
   
   - 500 vs 403 and the report-email ordering: the dashboard check moved out of 
`set_dash_metadata` into the create/update/copy commands' `validate()` 
(`raise_for_added_chart_datasource_access`), raising `DashboardForbiddenError`. 
On PUT it now runs before the tab/filter diffs. The create endpoint also maps 
it to 403. Default message only, so no dataset name is returned.
   - Repoint + link in one request: the stored datasource is checked only when 
the request does not change it; an incoming datasource is already authorized in 
`validate()`.
   - Shared helper: `raise_for_chart_datasource_access` in `commands/utils.py` 
holds the rule, the admin/no-user exemption and the `None` skip for both paths. 
Its docstring explains why skipping `None` is safe in every case: the read 
paths resolve with the same resolver and deny on `None`, so linking it serves 
nothing.
   - Tests: added 
`tests/integration_tests/dashboards/chart_datasource_access_tests.py` with a 
real Gamma user and no dataset grant, covering dashboard 
PUT/POST/copy-with-layout (403, membership unchanged), chart PUT `dashboards` 
(403), the positive grant cases, repoint + link, and keeping a soft-deleted 
member. Against the previous head, the three dashboard cases and the repoint 
case fail.
   - Annotations added. `Slice.table` is already eager-loaded, so I left out 
`selectinload`. Copy now treats the source dashboard's members as existing, so 
copying its own charts is not re-checked.
   - #45538: the check now lives in `validate()` rather than 
`set_dash_metadata`, so the textual conflict should mostly go away. Happy for 
#45538 to build on these helpers if that works for you.
   


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

Reply via email to