Sha256: 21f240193fe11cd0adeaf70fa8ec9902b5b4250e028ec36c1f620bb3b45614b1

Contents?: true

Size: 477 Bytes

Versions: 14

Compression:

Stored size: 477 Bytes

Contents

# frozen_string_literal: true
module Hyrax
  class IIIFAuthorizationService
    attr_reader :controller
    def initialize(controller)
      @controller = controller
    end

    # @note we ignore the `action` param here in favor of the `:show` action for all permissions
    def can?(_action, object)
      controller.current_ability.can?(:show, file_set_id_for(object))
    end

    private

    def file_set_id_for(object)
      object.id.split('/').first
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
hyrax-3.6.0 app/services/hyrax/iiif_authorization_service.rb
hyrax-3.5.0 app/services/hyrax/iiif_authorization_service.rb
hyrax-3.4.2 app/services/hyrax/iiif_authorization_service.rb
hyrax-3.4.1 app/services/hyrax/iiif_authorization_service.rb
hyrax-3.4.0 app/services/hyrax/iiif_authorization_service.rb
hyrax-3.3.0 app/services/hyrax/iiif_authorization_service.rb
hyrax-3.2.0 app/services/hyrax/iiif_authorization_service.rb
hyrax-3.1.0 app/services/hyrax/iiif_authorization_service.rb
hyrax-3.0.2 app/services/hyrax/iiif_authorization_service.rb
hyrax-3.0.1 app/services/hyrax/iiif_authorization_service.rb
hyrax-3.0.0 app/services/hyrax/iiif_authorization_service.rb
hyrax-3.0.0.pre.rc4 app/services/hyrax/iiif_authorization_service.rb
hyrax-3.0.0.pre.rc3 app/services/hyrax/iiif_authorization_service.rb
hyrax-3.0.0.pre.rc2 app/services/hyrax/iiif_authorization_service.rb