lib/hydra/access_controls_enforcement.rb in hydra-access-controls-6.3.3 vs lib/hydra/access_controls_enforcement.rb in hydra-access-controls-6.3.4

- old
+ new

@@ -42,10 +42,11 @@ end false end def is_public? + ActiveSupport::Deprecation.warn("Hydra::AccessControlsEnforcement.is_public? has been deprecated. Use can? instead.") load_permissions_from_solr access_key = ActiveFedora::SolrService.solr_name("access", Hydra::Datastream::RightsMetadata.indexer) @permissions_solr_document[access_key].present? && @permissions_solr_document[access_key].first.downcase == "public" end @@ -56,19 +57,16 @@ # Controller "before" filter for enforcing access controls on show actions # @param [Hash] opts (optional, not currently used) def enforce_show_permissions(opts={}) permissions = current_ability.permissions_doc(params[:id]) - unless permissions.is_public? - #its not 'public' - if permissions.under_embargo? && !can?(:edit, permissions) - raise Hydra::AccessDenied.new("This item is under embargo. You do not have sufficient access privileges to read this document.", :edit, params[:id]) - end - unless can? :read, permissions - raise Hydra::AccessDenied.new("You do not have sufficient access privileges to read this document, which has been marked private.", :read, params[:id]) - end + if permissions.under_embargo? && !can?(:edit, permissions) + raise Hydra::AccessDenied.new("This item is under embargo. You do not have sufficient access privileges to read this document.", :edit, params[:id]) end + unless can? :read, permissions + raise Hydra::AccessDenied.new("You do not have sufficient access privileges to read this document, which has been marked private.", :read, params[:id]) + end end # Solr query modifications # @@ -118,10 +116,10 @@ end user_access_filters end def escape_filter(key, value) - [key, value.gsub('/', '\/')].join(':') + [key, value.gsub(/[ \/]/, ' ' => '\ ', '/' => '\/')].join(':') end def apply_individual_permissions(permission_types) # for individual person access user_access_filters = []