Sha256: d5aadfb439cc4983599224bc7402817df5617333c512b28bd13be461575dc4d3

Contents?: true

Size: 581 Bytes

Versions: 23

Compression:

Stored size: 581 Bytes

Contents

ActiveFedora::QueryMethods.module_eval do
  extend ActiveSupport::Concern
  included do
    include Hydra::AccessControlsEnforcement
  end

  def accessible_by(ability, action = :index)
    permission_types = case action
      when :index then [:discover, :read, :edit]
      when :show, :read then [:read, :edit]
      when :update, :edit, :create, :new, :destroy then [:edit]
    end

    filters = gated_discovery_filters(permission_types, ability).join(" OR ")
    spawn.where!(filters)
  end
end

ActiveFedora::Querying.module_eval do
  delegate :accessible_by, :to=>:all
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
hydra-access-controls-11.0.7 lib/active_fedora/accessible_by.rb
hydra-access-controls-11.0.6 lib/active_fedora/accessible_by.rb
hydra-access-controls-11.0.1 lib/active_fedora/accessible_by.rb
hydra-access-controls-11.0.0 lib/active_fedora/accessible_by.rb
hydra-access-controls-11.0.0.rc2 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.7.0 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.6.2 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.6.1 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.6.0 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.5.1 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.5.0 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.4.0 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.4.0.rc2 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.4.0.rc1 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.3.4 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.3.3 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.3.2 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.3.0 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.2.0 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.1.0 lib/active_fedora/accessible_by.rb