diff --git a/Dockerfile b/Dockerfile index fc01aed28..71bc93b07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ghcr.io/scientist-softserv/dev-ops/samvera:f71b284f as hyku-base +FROM ghcr.io/scientist-softserv/dev-ops/samvera:e9200061 as hyku-base COPY --chown=1001:101 $APP_PATH/Gemfile* /app/samvera/hyrax-webapp/ RUN sh -l -c " \ @@ -20,4 +20,4 @@ CMD ./bin/web FROM hyku-base as hyku-worker ENV MALLOC_ARENA_MAX=2 -CMD ./bin/worker +CMD ./bin/worker \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock index 5142b2284..1ef7f724b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -33,7 +33,7 @@ GIT GIT remote: https://github.com/samvera/hyrax.git - revision: 8bc9944164fdf8446b22bd4be66e5478292ceaa8 + revision: 5a29f010dd34a3cfe37677c0b99759825d6505a1 branch: privkey_for_ga4_3.x specs: hyrax (3.6.0) diff --git a/app/models/auth_provider.rb b/app/models/auth_provider.rb index 2960d91cb..9aa62a24f 100644 --- a/app/models/auth_provider.rb +++ b/app/models/auth_provider.rb @@ -4,8 +4,8 @@ class AuthProvider < ApplicationRecord validates :provider, presence: true validates :oidc_client_id, :oidc_client_secret, :oidc_idp_sso_service_url, - presence: true, if: -> { provider == 'oidc' } + presence: true, if: -> { provider == 'oidc' } validates :saml_client_id, :saml_client_secret, :saml_idp_sso_service_url, - presence: true, if: -> { provider == 'saml' } + presence: true, if: -> { provider == 'saml' } end diff --git a/app/models/generic_work.rb b/app/models/generic_work.rb index b76dae487..3b3de0e41 100644 --- a/app/models/generic_work.rb +++ b/app/models/generic_work.rb @@ -35,12 +35,5 @@ class GenericWork < ActiveFedora::Base # including `include ::Hyrax::BasicMetadata`. All properties must # be declared before their values can be ordered. include OrderMetadataValues - - # These needed to be added again in order to enable destroy for based_near, even though they are in Hyrax::BasicMetadata. - # the OrderAlready OrderMetadataValues above somehow prevents them from running - id_blank = proc { |attributes| attributes[:id].blank? } - class_attribute :controlled_properties - self.controlled_properties = [:based_near] - accepts_nested_attributes_for :based_near, reject_if: id_blank, allow_destroy: true self.indexer = GenericWorkIndexer end diff --git a/app/services/hyrax/manifest_builder_service_decorator.rb b/app/services/hyrax/manifest_builder_service_decorator.rb index c39c2ce75..324388f2e 100644 --- a/app/services/hyrax/manifest_builder_service_decorator.rb +++ b/app/services/hyrax/manifest_builder_service_decorator.rb @@ -21,8 +21,8 @@ def loof(text) CGI.unescapeHTML(Loofah.fragment(text.to_s).scrub!(:prune).to_s) end - def sanitize_v3(hash:, presenter:, solr_doc_hits:) - hash = super + def sanitize_v3(input_hash:, presenter:, solr_doc_hits:) + hash = super(input_hash, presenter: presenter, solr_doc_hits: solr_doc_hits) hash['viewingHint'] = 'paged' hash end diff --git a/app/views/hyrax/admin/workflows/index.html.erb b/app/views/hyrax/admin/workflows/index.html.erb index d13cc4cc5..659b74e34 100644 --- a/app/views/hyrax/admin/workflows/index.html.erb +++ b/app/views/hyrax/admin/workflows/index.html.erb @@ -6,88 +6,30 @@
-
- -
-
-
-
-
- - - - - - - - - - - <% @status_list.each do |document| %> - - - - - - - <% end %> - -
WorkDepositorSubmission DateStatus
- <%= link_to document, [main_app, document] %> - - <%# OVERRIDE: show the user/depositor's display_name if available %> - <% user = User.find_by(email: document.depositor) %> - <%= user&.display_name.presence %> - - <%= document.date_modified %> - - <%= document.workflow_state %> -
-
-
-
-
-
-
-
-
- - - - - - - - - - - <% @published_list.each do |document| %> - - - - - - <% end %> - -
WorkDepositorSubmission DateStatus
- <%= link_to document, [main_app, document] %> - - <%# OVERRIDE: show the user/depositor's display_name if available %> - <% user = User.find_by(email: document.depositor) %> - <%= user&.display_name.presence %> - - <%= document.date_modified %> - - <%= document.workflow_state %> -
-
+
+ <%= render 'tabs' %> +
+ + <% if @response.viewing_under_review? %> + <%= I18n.t('hyrax.admin.workflows.index.works_under_review', total_count: @response.total_count).html_safe %> + <% else %> + <%= I18n.t('hyrax.admin.workflows.index.works_published', total_count: @response.total_count).html_safe %> + <% end %> + +
+
+
+
+
+ <%= form_tag hyrax.admin_workflows_path, method: :get, class: 'per_page' do %> +
+ <%= t('hyrax.dashboard.my.sr.results_per_page') %> + <%= label_tag :per_page do %> + Show <%= select_tag :per_page, options_for_select(Hyrax.config.range_for_number_of_results_to_display_per_page.map(&:to_s), h(params[:per_page])), title: "entries" %> per page + <% end %> + <%= render_hash_as_hidden_fields(search_state.params_for_search.except(:per_page, :sort, :utf8)) %> +
+ <% end %>
diff --git a/config/routes.rb b/config/routes.rb index 1605e3eb1..f023183f6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,7 +1,6 @@ # OVERRIDE Hyrax 2.9.0 to add featured collection routes require 'sidekiq/web' -Sidekiq::Web.set :session_secret, Rails.application.secrets[:secret_key_base] Rails.application.routes.draw do diff --git a/spec/features/advanced_search_spec.rb b/spec/features/advanced_search_spec.rb index 4a252f71a..2d61a6611 100644 --- a/spec/features/advanced_search_spec.rb +++ b/spec/features/advanced_search_spec.rb @@ -13,6 +13,7 @@ expect(page).to have_content('ambitious aardvark') expect(page).to have_content('No results found for your search') end + it 'can perform advanced search' do visit '/advanced' fill_in('Title', with: 'ambitious aardvark') diff --git a/spec/models/auth_provider_spec.rb b/spec/models/auth_provider_spec.rb index f8ee3810b..430de4ae1 100644 --- a/spec/models/auth_provider_spec.rb +++ b/spec/models/auth_provider_spec.rb @@ -4,9 +4,12 @@ subject do described_class.new( provider: 'saml', - client_id: 'client_id', - client_secret: 'client_secret', - idp_sso_service_url: 'idp_sso_service_url', + oidc_client_id: 'client_id', + saml_client_id: 'client_id', + oidc_client_secret: 'client_secret', + saml_client_secret: 'client_secret', + oidc_idp_sso_service_url: 'oidc_idp_sso_service_url', + saml_idp_sso_service_url: 'saml_idp_sso_service_url', account_id: 1 ) end @@ -22,12 +25,14 @@ end it 'is not valid without a client_id' do - subject.client_id = nil + subject.oidc_client_id = nil + subject.saml_client_id = nil expect(subject).not_to be_valid end it 'is not valid without a client_secret' do - subject.client_secret = nil + subject.oidc_client_secret = nil + subject.saml_client_secret = nil expect(subject).not_to be_valid end end @@ -39,9 +44,10 @@ it 'has one after adding one' do AuthProvider.create( - provider: 'saml', - client_id: 'client_id', - client_secret: 'client_secret', + provider: 'oidc', + oidc_client_id: 'new oidc_client_id', + oidc_client_secret: 'new oidc_client_secret', + oidc_idp_sso_service_url: 'new oidc_idp_sso_service_url', account_id: 1 ) expect(described_class.count).to eq 1 diff --git a/spec/presenters/hyrax/oer_presenter_spec.rb b/spec/presenters/hyrax/oer_presenter_spec.rb index 7c59c2ae2..3f2ce5ba6 100644 --- a/spec/presenters/hyrax/oer_presenter_spec.rb +++ b/spec/presenters/hyrax/oer_presenter_spec.rb @@ -1,5 +1,7 @@ # Generated via # `rails generate hyrax:work Oer` +# NOTE: The majority of this spec is coming from the hyrax-iiif_av gem. +# See this file for more info: https://github.com/samvera-labs/hyrax-iiif_av/blob/main/lib/hyrax/iiif_av/spec/shared_specs/displays_iiif_av.rb require 'rails_helper' RSpec.describe Hyrax::OerPresenter do @@ -32,6 +34,9 @@ let(:id_present) { false } let(:representative_presenter) { double('representative', present?: false) } let(:image_boolean) { false } + let(:video_boolean) { false } + let(:audio_boolean) { false } + let(:pdf_boolean) { false } let(:iiif_enabled) { true } let(:file_set_presenter) { Hyrax::FileSetPresenter.new(solr_document, ability) } let(:file_set_presenters) { [file_set_presenter] } @@ -44,6 +49,9 @@ allow(file_set_presenter).to receive(:image?).and_return(true) allow(ability).to receive(:can?).with(:read, solr_document.id).and_return(read_permission) allow(representative_presenter).to receive(:image?).and_return(image_boolean) + allow(representative_presenter).to receive(:video?).and_return(video_boolean) + allow(representative_presenter).to receive(:audio?).and_return(audio_boolean) + allow(representative_presenter).to receive(:pdf?).and_return(pdf_boolean) allow(Hyrax.config).to receive(:iiif_image_server?).and_return(iiif_enabled) end @@ -60,7 +68,6 @@ context 'with non-image representative_presenter' do let(:id_present) { true } let(:representative_presenter) { double('representative', present?: true) } - let(:image_boolean) { false } it { is_expected.to be false } end @@ -228,6 +235,18 @@ describe '#iiif_viewer' do subject { presenter.iiif_viewer } + let(:representative_presenter) { instance_double('Hyrax::FileSetPresenter', present?: true) } + let(:image_boolean) { false } + let(:audio_boolean) { false } + let(:video_boolean) { false } + + before do + allow(presenter).to receive(:representative_presenter).and_return(representative_presenter) + allow(representative_presenter).to receive(:image?).and_return(image_boolean) + allow(representative_presenter).to receive(:audio?).and_return(audio_boolean) + allow(representative_presenter).to receive(:video?).and_return(video_boolean) + end + it 'defaults to universal viewer' do expect(subject).to be :universal_viewer end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index e69de046f..203873ad4 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -113,57 +113,6 @@ # this security while still going through the captcha workflow. NegativeCaptcha.test_mode = true -# Uses faster rack_test driver when JavaScript support not needed -Capybara.default_max_wait_time = 8 -Capybara.default_driver = :rack_test - -ENV['WEB_HOST'] ||= `hostname -s`.strip - -if ENV['CHROME_HOSTNAME'].present? - capabilities = Selenium::WebDriver::Remote::Capabilities.chrome( - chromeOptions: { - args: %w[headless disable-gpu no-sandbox whitelisted-ips window-size=1400,1400] - } - ) - - Capybara.register_driver :chrome do |app| - d = Capybara::Selenium::Driver.new(app, - browser: :remote, - desired_capabilities: capabilities, - url: "http://#{ENV['CHROME_HOSTNAME']}:4444/wd/hub") - # Fix for capybara vs remote files. Selenium handles this for us - d.browser.file_detector = lambda do |args| - str = args.first.to_s - str if File.exist?(str) - end - d - end - Capybara.server_host = '0.0.0.0' - Capybara.server_port = 3001 - Capybara.app_host = "http://#{ENV['WEB_HOST']}:#{Capybara.server_port}" -else - capabilities = Selenium::WebDriver::Remote::Capabilities.chrome( - chromeOptions: { - args: %w[headless disable-gpu] - } - ) - - Capybara.register_driver :chrome do |app| - Capybara::Selenium::Driver.new( - app, - browser: :chrome, - desired_capabilities: capabilities - ) - end -end - -Capybara.javascript_driver = :chrome - -# This will ensure that a field named email will not be referred to by a -# hash but by test-email instead. A tool like capybara can now bypass -# this security while still going through the captcha workflow. -NegativeCaptcha.test_mode = true - RSpec.configure do |config| # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures config.fixture_path = "#{::Rails.root}/spec/fixtures" diff --git a/spec/search_builders/adv_search_builder_spec.rb b/spec/search_builders/adv_search_builder_spec.rb index 5f0681269..cc5b10301 100644 --- a/spec/search_builders/adv_search_builder_spec.rb +++ b/spec/search_builders/adv_search_builder_spec.rb @@ -25,6 +25,7 @@ # # When we had those duplicates, the :add_advanced_parse_q_to_solr obliterated the join logic # for files. + # note: :exclude_models, :highlight_search_params, :show_parents_only, :include_allinson_flex_fields are added for the hyrax-iiif_av gem %i[ default_solr_parameters add_query_to_solr @@ -43,11 +44,16 @@ show_works_or_works_that_contain_files show_only_active_records filter_collection_facet_for_access + exclude_models + highlight_search_params + show_parents_only + include_allinson_flex_fields add_advanced_parse_q_to_solr add_advanced_search_to_solr ] end + # TODO: skip to get reshare feature branch merged to main it { is_expected.to eq(expected_default_processor_chain) } end end