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.



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

def initialize(controller)
  @controller = controller
end

Instance Attribute Details

#controllerObject (readonly)

Returns the value of attribute controller.



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

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)


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

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