From ec2bd513747eadbb8b9c5bfba0e60847b977f9a3 Mon Sep 17 00:00:00 2001 From: davelopez <46503462+davelopez@users.noreply.github.com> Date: Wed, 22 May 2024 15:22:46 +0200 Subject: [PATCH] Remove unnecessary catch all --- .../webapps/galaxy/controllers/history.py | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/lib/galaxy/webapps/galaxy/controllers/history.py b/lib/galaxy/webapps/galaxy/controllers/history.py index 2dbe94cb44ef..5a7824fd3129 100644 --- a/lib/galaxy/webapps/galaxy/controllers/history.py +++ b/lib/galaxy/webapps/galaxy/controllers/history.py @@ -192,21 +192,17 @@ def make_private(self, trans, history_id=None, all_histories=False, **kwd): trans.app.security_agent.permitted_actions.DATASET_ACCESS: [private_role], } for history in histories: - try: - # Set default role for history to private - trans.app.security_agent.history_set_default_permissions(history, private_permissions) - # Set private role for all datasets - for hda in history.datasets: - if ( - not hda.dataset.library_associations - and not trans.app.security_agent.dataset_is_private_to_user(trans, hda.dataset) - and trans.app.security_agent.can_manage_dataset(user_roles, hda.dataset) - ): - # If it's not private to me, and I can manage it, set fixed private permissions. - trans.app.security_agent.set_all_dataset_permissions(hda.dataset, private_permissions) - except Exception: - log.exception("Error making datasets private.") - continue + # Set default role for history to private + trans.app.security_agent.history_set_default_permissions(history, private_permissions) + # Set private role for all datasets + for hda in history.datasets: + if ( + not hda.dataset.library_associations + and not trans.app.security_agent.dataset_is_private_to_user(trans, hda.dataset) + and trans.app.security_agent.can_manage_dataset(user_roles, hda.dataset) + ): + # If it's not private to me, and I can manage it, set fixed private permissions. + trans.app.security_agent.set_all_dataset_permissions(hda.dataset, private_permissions) return { "message": f"Success, requested permissions have been changed in {'all histories' if all_histories else history.name}." }