Anonymous avatar Anonymous committed fa97a5c

Fix copy/paste errors in histry contents API

Comments (0)

Files changed (2)

lib/galaxy/web/api/history_contents.py

         """
         content_id = id
         try:
-            content = self.get_history_dataset_association( trans, content_id, check_ownership=True, check_accessible=True )
+            # get the history just for the access checks
+            history = self.get_history( trans, history_id, check_ownership=True, check_accessible=True, deleted=False )
+            content = self.get_history_dataset_association( trans, history, content_id, check_ownership=True, check_accessible=True )
         except Exception, e:
             return str( e )
         try:

lib/galaxy/web/base/controller.py

             else:
                 error( "You are not allowed to access this dataset" )
         return data
-    def get_history_dataset_association( self, trans, dataset_id, check_ownership=True, check_accessible=False ):
+    def get_history_dataset_association( self, trans, history, dataset_id, check_ownership=True, check_accessible=False ):
         """Get a HistoryDatasetAssociation from the database by id, verifying ownership."""
-        hda = self.get_object( trans, id, 'HistoryDatasetAssociation', check_ownership=check_ownership, check_accessible=check_accessible, deleted=deleted )
-        self.security_check( trans, history, check_ownership=check_ownership, check_accessible=False ) # check accessibility here
+        self.security_check( trans, history, check_ownership=check_ownership, check_accessible=check_accessible )
+        hda = self.get_object( trans, dataset_id, 'HistoryDatasetAssociation', check_ownership=False, check_accessible=False, deleted=False )
+        
         if check_accessible:
             if trans.app.security_agent.can_access_dataset( trans.get_current_user_roles(), hda.dataset ):
                 if hda.state == trans.model.Dataset.states.UPLOAD:
                     error( "Please wait until this dataset finishes uploading before attempting to view it." )
             else:
                 error( "You are not allowed to access this dataset" )
+        return hda
     def get_data( self, dataset, preview=True ):
         """ Gets a dataset's data. """
         # Get data from file, truncating if necessary.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.