"Edit dataset" is disabled in Explore for every non-Admin, including dataset editors
Bug description
The "Edit dataset" action in Explore is disabled for every non-Admin user, including users who are listed as editors of that exact dataset. Editing a chart works normally.
Explore gates the action on datasource.editors, but the Explore payload never contains that field, so the check collapses to "is the user an Admin?".
Root cause
superset-frontend/src/explore/components/controls/DatasourceControl/index.tsx computes:
const userSubjects = getBootstrapData()?.common?.user_subjects ?? [];
const allowEdit =
datasource.editors?.some(o => {
const subjectId = o.id ?? o.value;
return subjectId !== undefined && userSubjects.includes(subjectId);
}) || isUserAdmin(user);allowEdit drives disabled: !allowEdit on the EDIT_DATASET menu item.
The Explore payload is built in superset/commands/explore/get.py, which sets result["dataset"] from SqlaTable.data. Neither SqlaTable.data nor BaseDatasource.data in superset/connectors/sqla/models.py emits an editors key, so datasource.editors is always undefined and the .some(...) short-circuits. Nothing downstream adds it either: sanitize_datasource_data only blanks database parameters.
This looks like an oversight rather than a design decision:
superset/explore/schemas.pyalready declareseditors = fields.List(fields.Nested(SubjectResponseSchema))onDatasetSchema.ExplorableDatainsuperset/superset_typing.pyalready declares and documents aneditorsfield.GET /api/v1/dataset/<id>does returneditorsas[{id, label, type}].- #38831, which introduced the Subject model and entity editors/viewers, replaced the old
ownersgate with aneditorsgate in the frontend and addededitorstoSlice.data, but removed"owners": [owner.id for owner in self.owners]fromBaseDatasource.datawithout addingeditorsin its place.
Steps to reproduce
- As an Admin, create a dataset.
- Add a non-Admin user to that dataset's Editors list, via the Datasets list page or
PUT /api/v1/dataset/<id>. - Confirm the assignment took effect:
GET /api/v1/dataset/<id>returns that user's subject underresult.editors. - Log in as that non-Admin user and open any chart built on that dataset in Explore.
- Open the dataset menu (the "..." next to the dataset name) and look at "Edit dataset".
Expected behavior
"Edit dataset" is enabled, because the user is an editor of the dataset.
Actual behavior
"Edit dataset" is greyed out, with the tooltip "You must be a dataset editor in order to edit. Please reach out to a dataset editor to request modifications or edit access." Only Admins can use it.
The missing field can be confirmed directly by comparing two responses for the same dataset:
GET /api/v1/dataset/<id>->result.editorsis present.GET /api/v1/explore/?datasource_id=<id>&datasource_type=table->result.datasethas noeditorskey at all.
Screenshots/recordings
No response
Superset version
master / latest-dev
Python version
3.11
Node version
18 or greater
Browser
Chrome
Additional context
There is a second consequence of the same missing field, this one affecting Admins.
superset-frontend/src/components/Datasource/DatasourceModal/index.tsx builds its save payload with editors: mapSubjectValuesToIds(datasource.editors || []). Since datasource.editors is undefined in Explore, the modal sends editors: []. On the backend, compute_subject_list in superset/commands/utils.py distinguishes None (preserve) from [] (explicit clear):
subject_ids = (
[s.id for s in current_subjects] if new_subject_ids is None else new_subject_ids
)and the lockout protection in populate_subject_list is skipped when the caller is an Admin. So an Admin who opens "Edit dataset" from Explore and clicks Save clears the dataset's entire editor list.
I verified this at the command layer on a local instance: with editors set to one subject, running UpdateDatasetCommand(dataset_id, {"editors": []}) as an Admin left the dataset with an empty editor list. I did not drive the browser flow end to end, but the modal's payload construction above is what produces that []. The modal then calls onDatasourceSave({...json.result, editors: currentDatasource.editors}), so the local state keeps the pre-save value and the UI does not reveal that anything was cleared.
Both symptoms are fixed by adding editors to the Explore datasource payload.
There is no stacktrace to attach: nothing raises or is logged. The field is simply absent, and both consequences are silent.
Verified on master at 599026a0e5a82f9728a333aea0e07b6a7bf8f771. No feature flags required; no custom code or plugins involved.
Checklist
- I have searched Superset docs and Slack and didn't find a solution to my problem.
- I have searched the GitHub issue tracker and didn't find a similar bug report.
- 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.
Source: apache/superset