sha174n opened a new pull request, #42582: URL: https://github.com/apache/superset/pull/42582
### SUMMARY `Dashboard.import_from_dict` matches an existing dashboard on any of the model's unique constraints, which include `slug` as well as `uuid`. `import_dashboard`, however, only looked up an existing dashboard by `uuid` before running the overwrite permission gate. A config carrying a fresh `uuid` but a `slug` that already belongs to an active dashboard therefore skipped that gate and was matched-and-updated by slug. This change resolves a slug collision to the existing dashboard before the gate, so the same `can_write` + `can_access_dashboard` + editorship/admin check applies to it, and aligns the `uuid` so the subsequent import updates that row deterministically. This makes the import overwrite path consistent regardless of whether the incoming config matches an existing dashboard by `uuid` or by `slug`. ### TESTING INSTRUCTIONS Added a unit regression test in `tests/unit_tests/dashboards/commands/importers/v1/import_test.py`: a fresh-`uuid` import whose `slug` collides with an existing active dashboard is rejected for a caller who is neither an editor of that dashboard nor an admin. Existing import tests continue to pass. ### ADDITIONAL INFORMATION - [ ] Has associated issue - [ ] Required feature flags - [x] Changes UI - [ ] Includes DB Migration - [x] 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]
