Skip to content

Commit

Permalink
Raise appropriate API exceptions in history controller
Browse files Browse the repository at this point in the history
Instead of the legacy ones.
  • Loading branch information
davelopez committed May 22, 2024
1 parent 7ba9471 commit 4e03914
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/galaxy/webapps/galaxy/controllers/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ def display_by_username_and_slug(self, trans, username, slug, **kwargs):
)
)

@web.legacy_expose_api
@web.expose_api
@web.require_login("changing default permissions")
def permissions(self, trans, payload=None, **kwd):
"""
Sets the permissions on a history.
"""
history_id = kwd.get("id")
if not history_id:
return self.message_exception(trans, f"Invalid history id ({str(history_id)}) received")
raise exceptions.RequestParameterMissingException("No history id received")
history = self.history_manager.get_owned(self.decode_id(history_id), trans.user, current_history=trans.history)
if trans.request.method == "GET":
inputs = []
Expand Down Expand Up @@ -166,7 +166,7 @@ def permissions(self, trans, payload=None, **kwd):
trans.app.security_agent.history_set_default_permissions(history, permissions)
return {"message": "Default history '%s' dataset permissions have been changed." % history.name}

@web.legacy_expose_api
@web.expose_api
@web.require_login("make datasets private")
def make_private(self, trans, history_id=None, all_histories=False, **kwd):
"""
Expand All @@ -184,7 +184,7 @@ def make_private(self, trans, history_id=None, all_histories=False, **kwd):
if history:
histories.append(history)
if not histories:
return self.message_exception(trans, "Invalid history or histories specified.")
raise exceptions.RequestParameterMissingException("No history or histories specified.")
private_role = trans.app.security_agent.get_private_user_role(trans.user)
user_roles = trans.user.all_roles()
private_permissions = {
Expand Down Expand Up @@ -256,12 +256,12 @@ def resume_paused_jobs(self, trans, current=False, ids=None, **kwargs):
return trans.show_ok_message("Your jobs have been resumed.", refresh_frames=refresh_frames)
# TODO: used in index.mako

@web.legacy_expose_api
@web.expose_api
@web.require_login("rename histories")
def rename(self, trans, payload=None, **kwd):
id = kwd.get("id")
if not id:
return self.message_exception(trans, "No history id received for renaming.")
raise exceptions.RequestParameterMissingException("No history id received for renaming.")
user = trans.get_user()
id = listify(id)
histories = []
Expand Down

0 comments on commit 4e03914

Please sign in to comment.