rusackas commented on code in PR #45166:
URL: https://github.com/apache/superset/pull/45166#discussion_r4328008590
##########
superset/mcp_service/dataset/tool/restore_dataset.py:
##########
@@ -44,19 +44,17 @@
def _find_dataset_for_restore(identifier: int | str) -> Any | None:
"""Resolve a dataset by numeric ID or UUID, including soft-deleted rows.
- Both bypasses mirror ``BaseRestoreCommand.validate``'s own lookup:
- ``skip_visibility_filter`` unhides the soft-deleted row, and
- ``skip_base_filter`` keeps an editor's own trash reachable even when the
- dataset's datasource-access base_filter would hide it (a lost grant must
- not hide a row from the one audience that can restore it). The restore
- audience is enforced by ``RestoreDatasetCommand`` via
- ``raise_for_editorship``.
+ Mirrors ``RestoreDatasetCommand``'s own lookup: ``skip_visibility_filter``
+ unhides the soft-deleted row, and the datasource-access base_filter is
+ kept, so a dataset the caller holds no grant on reads as not found. The
+ restore audience is then enforced via ``raise_for_editorship``.
"""
from superset.daos.dataset import DatasetDAO
return DatasetDAO.find_by_id_or_uuid(
str(identifier),
- skip_base_filter=True,
+ # Matches ``RestoreDatasetCommand.skip_base_filter``.
+ skip_base_filter=False,
skip_visibility_filter=True,
Review Comment:
Matches `datasets/api.py`'s pattern of referencing
`RestoreDatasetCommand.skip_base_filter` directly instead of a comment, so the
two can't drift apart.
```suggestion
from superset.commands.dataset.restore import RestoreDatasetCommand
from superset.daos.dataset import DatasetDAO
return DatasetDAO.find_by_id_or_uuid(
str(identifier),
skip_base_filter=RestoreDatasetCommand.skip_base_filter,
skip_visibility_filter=True,
)
```
--
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]