Sha256: ce250204e6087e715d8984001bfdad970f850ad41bd91de8851462b4366496db

Contents?: true

Size: 559 Bytes

Versions: 46

Compression:

Stored size: 559 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

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

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

Version data entries

46 entries across 46 versions & 1 rubygems

Version Path
hydra-access-controls-8.2.0 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.0.0.beta4 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.0.0.beta3 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.0.0.beta2 lib/active_fedora/accessible_by.rb
hydra-access-controls-10.0.0.beta1 lib/active_fedora/accessible_by.rb
hydra-access-controls-9.10.0 lib/active_fedora/accessible_by.rb
hydra-access-controls-9.9.0 lib/active_fedora/accessible_by.rb
hydra-access-controls-9.8.1 lib/active_fedora/accessible_by.rb
hydra-access-controls-9.8.0 lib/active_fedora/accessible_by.rb
hydra-access-controls-9.7.1 lib/active_fedora/accessible_by.rb
hydra-access-controls-9.7.0 lib/active_fedora/accessible_by.rb
hydra-access-controls-9.6.0 lib/active_fedora/accessible_by.rb
hydra-access-controls-9.5.0 lib/active_fedora/accessible_by.rb
hydra-access-controls-9.4.1 lib/active_fedora/accessible_by.rb
hydra-access-controls-9.4.0 lib/active_fedora/accessible_by.rb
hydra-access-controls-9.3.0 lib/active_fedora/accessible_by.rb
hydra-access-controls-9.2.2 lib/active_fedora/accessible_by.rb
hydra-access-controls-9.2.1 lib/active_fedora/accessible_by.rb
hydra-access-controls-9.2.0 lib/active_fedora/accessible_by.rb
hydra-access-controls-9.2.0.rc1 lib/active_fedora/accessible_by.rb