diff --git a/lib/galaxy/managers/collections.py b/lib/galaxy/managers/collections.py index e3e62d33fef..2d7d6572c8b 100644 --- a/lib/galaxy/managers/collections.py +++ b/lib/galaxy/managers/collections.py @@ -264,7 +264,11 @@ class DatasetCollectionManager: if recursive: for dataset in dataset_collection_instance.collection.dataset_instances: - self.hda_manager.error_unless_owner(dataset, user=trans.get_user(), current_history=trans.history) + try: + self.hda_manager.error_unless_owner(dataset, user=trans.get_user(), current_history=trans.history) + except hdas.HistoryDatasetAssociationNoHistoryException: + log.info("Cannot delete HistoryDatasetAssociation {}, HistoryDatasetAssociation has no associated History, cannot verify owner".format(dataset.id)) + continue if not dataset.deleted: dataset.deleted = True diff --git a/lib/galaxy/managers/hdas.py b/lib/galaxy/managers/hdas.py index c1aac8c4747..e82a492b549 100644 --- a/lib/galaxy/managers/hdas.py +++ b/lib/galaxy/managers/hdas.py @@ -25,6 +25,10 @@ from galaxy.structured_app import MinimalManagerApp log = logging.getLogger(__name__) +class HistoryDatasetAssociationNoHistoryException(Exception): + pass + + class HDAManager(datasets.DatasetAssociationManager, secured.OwnableManagerMixin, taggable.TaggableManagerMixin, @@ -70,9 +74,11 @@ class HDAManager(datasets.DatasetAssociationManager, """ Use history to see if current user owns HDA. """ - history = hda.history if self.user_manager.is_admin(user, trans=kwargs.get("trans", None)): return True + history = hda.history + if history is None: + raise HistoryDatasetAssociationNoHistoryException # allow anonymous user to access current history # TODO: some dup here with historyManager.is_owner but prevents circ import # TODO: awkward kwarg (which is my new band name); this may not belong here - move to controller? diff --git a/templates/webapps/galaxy/workflow/build_from_current_history.mako b/templates/webapps/galaxy/workflow/build_from_current_history.mako index 208c2715a3f..03d1731d4c8 100644 --- a/templates/webapps/galaxy/workflow/build_from_current_history.mako +++ b/templates/webapps/galaxy/workflow/build_from_current_history.mako @@ -33,10 +33,12 @@ $(function() { $("#checkall").click( function() { $("input[type=checkbox]").attr( 'checked', true ); + $(".as-named-input").prop( 'disabled', false ); return false; }).show(); $("#uncheckall").click( function() { $("input[type=checkbox]").attr( 'checked', false ); + $(".as-named-input").prop( 'disabled', true ); return false; }).show(); }); @@ -62,7 +64,8 @@ %if disabled: + name="${data.history_content_type}_ids" value="${data.hid}" checked="true" + onclick="document.getElementById('as-named-input-${ encoded_id }').disabled = !document.getElementById('as-input-${ encoded_id }').checked" />