Sha256: 75ce597ac6fd1b81c7835c76f711c26bbb94c2a70be5fa24aa972527e8e0bb22

Contents?: true

Size: 1.18 KB

Versions: 48

Compression:

Stored size: 1.18 KB

Contents

module Hyrax
  class FixityChecksController < ApplicationController
    before_action :authenticate_user!

    # request here with param :file_set_id will trigger a fixity check if
    # needed, and respond with a JSON hash that looks something like:
    #
    #     { "file_id" => [
    #         {
    #           "checked_uri" => "http://127.0.0.1:8986/rest/test/12/57/9s/28/12579s28n/files/3ff48171-f625-48bb-a73d-b1ba16dde530/fcr:versions/version1",
    #           "passed" => true,
    #           "expected_result" => "urn:sha1:03434..."
    #           "created_at" => "2017-05-16T15:32:50.961Z"
    #         }
    #       ]
    #     }
    def create
      render json: fixity_check_service.fixity_check
    end

    private

      def fixity_check_service
        # We are calling `async_jobs: false` to ensure we get a fixity result to
        # return even if there are no 'fresh' ones on record. Otherwise, we'd
        # have to sometimes return a 'in progress' status for some bytestreams,
        # which is a possible future enhancement.
        @fixity_check_service ||=
          FileSetFixityCheckService.new(::FileSet.find(params[:file_set_id]), async_jobs: false)
      end
  end
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
hyrax-2.9.6 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-2.9.5 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-2.9.4 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-2.9.3 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-2.9.2 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-2.9.1 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-2.9.0 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-2.8.0 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-2.7.2 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-2.7.1 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-2.7.0 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-2.6.0 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-3.0.0.pre.rc1 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-3.0.0.pre.beta3 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-2.5.1 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-2.5.0 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-3.0.0.pre.beta2 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-2.4.1 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-3.0.0.pre.beta1 app/controllers/hyrax/fixity_checks_controller.rb
hyrax-2.4.0 app/controllers/hyrax/fixity_checks_controller.rb