Sha256: 9a8bc510530197da9f3b3335270e93cdd25acc2277bc17ab3202af85304c578b

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-5.0.4 app/services/hyrax/iiif_authorization_service.rb
hyrax-5.0.3 app/services/hyrax/iiif_authorization_service.rb
hyrax-5.0.2 app/services/hyrax/iiif_authorization_service.rb
hyrax-5.0.1 app/services/hyrax/iiif_authorization_service.rb
hyrax-5.0.0 app/services/hyrax/iiif_authorization_service.rb
hyrax-5.0.0.rc3 app/services/hyrax/iiif_authorization_service.rb
hyrax-5.0.0.rc2 app/services/hyrax/iiif_authorization_service.rb
hyrax-5.0.0.rc1 app/services/hyrax/iiif_authorization_service.rb
hyrax-4.0.0 app/services/hyrax/iiif_authorization_service.rb
hyrax-4.0.0.rc3 app/services/hyrax/iiif_authorization_service.rb
hyrax-4.0.0.rc2 app/services/hyrax/iiif_authorization_service.rb
hyrax-4.0.0.rc1 app/services/hyrax/iiif_authorization_service.rb
hyrax-4.0.0.beta2 app/services/hyrax/iiif_authorization_service.rb
hyrax-4.0.0.beta1 app/services/hyrax/iiif_authorization_service.rb