lib/active_fedora/accessible_by.rb in hydra-access-controls-11.0.0.rc1 vs lib/active_fedora/accessible_by.rb in hydra-access-controls-11.0.0.rc2
- old
+ new
@@ -1,7 +1,10 @@
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]
@@ -9,18 +12,9 @@
end
filters = gated_discovery_filters(permission_types, ability).join(" OR ")
spawn.where!(filters)
end
-
- private
-
- def gated_discovery_filters(types, ability)
- search_builder = Hydra::AccessControls::SearchBuilder.new(self,
- ability: ability,
- permission_types: types)
- search_builder.send(:gated_discovery_filters)
- end
end
ActiveFedora::Querying.module_eval do
delegate :accessible_by, :to=>:all
end