Class: Hyrax::IIIFAuthorizationService

Inherits:
Object
  • Object
show all
Defined in:
app/services/hyrax/iiif_authorization_service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(controller) ⇒ IIIFAuthorizationService

Returns a new instance of IIIFAuthorizationService.


4
5
6
# File 'app/services/hyrax/iiif_authorization_service.rb', line 4

def initialize(controller)
  @controller = controller
end

Instance Attribute Details

#controllerObject (readonly)

Returns the value of attribute controller


3
4
5
# File 'app/services/hyrax/iiif_authorization_service.rb', line 3

def controller
  @controller
end

Instance Method Details

#can?(_action, object) ⇒ Boolean

Note:

we ignore the `action` param here in favor of the `:show` action for all permissions

Returns:

  • (Boolean)

9
10
11
# File 'app/services/hyrax/iiif_authorization_service.rb', line 9

def can?(_action, object)
  controller.current_ability.can?(:show, file_set_id_for(object))
end