Fix for deleting histories when not logged in

This commit is contained in:
James Taylor
2009-03-29 00:01:46 -04:00
parent 0229e08185
commit 9a23884cea
2 changed files with 17 additions and 1 deletions
+16
View File
@@ -196,6 +196,22 @@ class HistoryController( BaseController ):
return self.rename( trans, **kwargs )
return self._list_grid( trans, *args, **kwargs )
@web.expose
def delete_current( self, trans ):
"""
Delete just the active history -- this does not require a logged
in user.
"""
history = trans.get_history()
if not history.deleted:
history.deleted = True
history.flush()
trans.log_event( "History id %d marked as deleted" % history.id )
# Regardless of whether it was previously deleted, we make a new
# history active
trans.new_history()
return trans.show_ok_message( "History deleted, a new history is active" )
@web.expose
def rename_async( self, trans, id=None, new_name=None ):
history = model.History.get( id )
+1 -1
View File
@@ -22,5 +22,5 @@
<li><a href="${h.url_for( action='history_set_default_permissions' )}">Change default permissions</a> for the current history</li>
%endif
<li><a href="${h.url_for( controller='root', action='history', show_deleted=True)}" target="galaxy_history">Show deleted</a> datasets in history</li>
<li><a href="${h.url_for( controller='history', action='list', operation="delete", id=history.id )}" confirm="Are you sure you want to delete the current history?">Delete</a> current history</div>
<li><a href="${h.url_for( controller='history', action='delete_current' )}" confirm="Are you sure you want to delete the current history?">Delete</a> current history</div>
</ul>