Anonymous avatar Anonymous committed fa97a5c

Fix copy/paste errors in histry contents API

Comments (0)

Files changed (2)


         content_id = id
-            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 )


                 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.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." )
                 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
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.