Skip to content

Commit

Permalink
Remove unnecessary catch all
Browse files Browse the repository at this point in the history
  • Loading branch information
davelopez committed May 22, 2024
1 parent c1a8fd4 commit ec2bd51
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions lib/galaxy/webapps/galaxy/controllers/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}."
}
Expand Down

0 comments on commit ec2bd51

Please sign in to comment.