Loading client/src/components/PageDisplay/PageDisplay.vue +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ export default { }, computed: { userOwnsPage() { return this.currentUser.username === this.page.username; return this.currentUser?.username === this.page.username; }, dataUrl() { return `/api/pages/${this.pageId}`; Loading lib/galaxy/managers/lddas.py +17 −1 Original line number Diff line number Diff line import logging from typing import ( Any, Optional, ) from galaxy.managers import base as manager_base from galaxy.managers.datasets import DatasetAssociationManager from galaxy.model import LibraryDatasetDatasetAssociation from galaxy.model import ( LibraryDatasetDatasetAssociation, User, ) from galaxy.structured_app import MinimalManagerApp log = logging.getLogger(__name__) Loading @@ -26,6 +33,15 @@ class LDDAManager(DatasetAssociationManager[LibraryDatasetDatasetAssociation]): trans, id, "LibraryDatasetDatasetAssociation", check_ownership=False, check_accessible=check_accessible ) def is_owner(self, item, user: Optional[User], **kwargs: Any) -> bool: """ Return True if user owns the item. """ assert isinstance(item, LibraryDatasetDatasetAssociation) if self.app.config.is_admin_user(user): return True return item.user == user def _set_permissions(self, trans, library_dataset, role_ids_dict): # Check Git history for an older broken implementation, but it was broken # and security related and had not test coverage so it was deleted. Loading lib/galaxy/webapps/galaxy/services/datasets.py +2 −1 Original line number Diff line number Diff line Loading @@ -747,6 +747,7 @@ class DatasetsService(ServiceBase, UsesVisualizationMixin): try: manager = self.dataset_manager_by_type[dataset.src] dataset_instance = manager.get_owned(dataset.id, trans.user) if hasattr(dataset_instance, "history"): manager.error_unless_mutable(dataset_instance.history) if dataset.src == DatasetSourceType.hda: self.hda_manager.error_if_uploading(dataset_instance) Loading lib/galaxy_test/api/test_datasets.py +19 −0 Original line number Diff line number Diff line Loading @@ -19,10 +19,12 @@ from galaxy_test.base.api_asserts import assert_has_keys from galaxy_test.base.decorators import ( requires_admin, requires_new_history, requires_new_library, ) from galaxy_test.base.populators import ( DatasetCollectionPopulator, DatasetPopulator, LibraryPopulator, skip_without_datatype, skip_without_tool, ) Loading @@ -47,6 +49,7 @@ class TestDatasetsApi(ApiTestCase): def setUp(self): super().setUp() self.dataset_populator = DatasetPopulator(self.galaxy_interactor) self.library_populator = LibraryPopulator(self.galaxy_interactor) self.dataset_collection_populator = DatasetCollectionPopulator(self.galaxy_interactor) def test_index(self): Loading Loading @@ -706,6 +709,22 @@ class TestDatasetsApi(ApiTestCase): for purged_source_id in expected_purged_source_ids: self.dataset_populator.wait_for_purge(history_id, purged_source_id["id"]) @requires_new_history @requires_new_library def test_delete_batch_lddas(self): # Create a library dataset ld = self.library_populator.new_library_dataset("lda_test_library") ldda_id = ld["ldda_id"] # Delete the library dataset using the delete_batch endpoint delete_payload = {"datasets": [{"id": ldda_id, "src": "ldda"}]} deleted_result = self._delete_batch_with_payload(delete_payload) assert deleted_result["success_count"] == 1 # Ensure the library dataset is deleted library_dataset = self.library_populator.show_ldda(ldda_id=ldda_id) assert library_dataset["deleted"] is True def test_delete_batch_error(self): num_datasets = 4 dataset_map: Dict[int, str] = {} Loading Loading
client/src/components/PageDisplay/PageDisplay.vue +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ export default { }, computed: { userOwnsPage() { return this.currentUser.username === this.page.username; return this.currentUser?.username === this.page.username; }, dataUrl() { return `/api/pages/${this.pageId}`; Loading
lib/galaxy/managers/lddas.py +17 −1 Original line number Diff line number Diff line import logging from typing import ( Any, Optional, ) from galaxy.managers import base as manager_base from galaxy.managers.datasets import DatasetAssociationManager from galaxy.model import LibraryDatasetDatasetAssociation from galaxy.model import ( LibraryDatasetDatasetAssociation, User, ) from galaxy.structured_app import MinimalManagerApp log = logging.getLogger(__name__) Loading @@ -26,6 +33,15 @@ class LDDAManager(DatasetAssociationManager[LibraryDatasetDatasetAssociation]): trans, id, "LibraryDatasetDatasetAssociation", check_ownership=False, check_accessible=check_accessible ) def is_owner(self, item, user: Optional[User], **kwargs: Any) -> bool: """ Return True if user owns the item. """ assert isinstance(item, LibraryDatasetDatasetAssociation) if self.app.config.is_admin_user(user): return True return item.user == user def _set_permissions(self, trans, library_dataset, role_ids_dict): # Check Git history for an older broken implementation, but it was broken # and security related and had not test coverage so it was deleted. Loading
lib/galaxy/webapps/galaxy/services/datasets.py +2 −1 Original line number Diff line number Diff line Loading @@ -747,6 +747,7 @@ class DatasetsService(ServiceBase, UsesVisualizationMixin): try: manager = self.dataset_manager_by_type[dataset.src] dataset_instance = manager.get_owned(dataset.id, trans.user) if hasattr(dataset_instance, "history"): manager.error_unless_mutable(dataset_instance.history) if dataset.src == DatasetSourceType.hda: self.hda_manager.error_if_uploading(dataset_instance) Loading
lib/galaxy_test/api/test_datasets.py +19 −0 Original line number Diff line number Diff line Loading @@ -19,10 +19,12 @@ from galaxy_test.base.api_asserts import assert_has_keys from galaxy_test.base.decorators import ( requires_admin, requires_new_history, requires_new_library, ) from galaxy_test.base.populators import ( DatasetCollectionPopulator, DatasetPopulator, LibraryPopulator, skip_without_datatype, skip_without_tool, ) Loading @@ -47,6 +49,7 @@ class TestDatasetsApi(ApiTestCase): def setUp(self): super().setUp() self.dataset_populator = DatasetPopulator(self.galaxy_interactor) self.library_populator = LibraryPopulator(self.galaxy_interactor) self.dataset_collection_populator = DatasetCollectionPopulator(self.galaxy_interactor) def test_index(self): Loading Loading @@ -706,6 +709,22 @@ class TestDatasetsApi(ApiTestCase): for purged_source_id in expected_purged_source_ids: self.dataset_populator.wait_for_purge(history_id, purged_source_id["id"]) @requires_new_history @requires_new_library def test_delete_batch_lddas(self): # Create a library dataset ld = self.library_populator.new_library_dataset("lda_test_library") ldda_id = ld["ldda_id"] # Delete the library dataset using the delete_batch endpoint delete_payload = {"datasets": [{"id": ldda_id, "src": "ldda"}]} deleted_result = self._delete_batch_with_payload(delete_payload) assert deleted_result["success_count"] == 1 # Ensure the library dataset is deleted library_dataset = self.library_populator.show_ldda(ldda_id=ldda_id) assert library_dataset["deleted"] is True def test_delete_batch_error(self): num_datasets = 4 dataset_map: Dict[int, str] = {} Loading