From 3ff5aa2627c376211c2491f2de2cffdbcd2c7c5f Mon Sep 17 00:00:00 2001 From: Max Kadel Date: Mon, 8 Mar 2021 09:37:01 -0500 Subject: [PATCH 1/8] WIP failing tests updating embargos --- app/models/ability.rb | 9 ++++--- .../hyrax/dashboard/sidebar/_tasks.html.erb | 2 +- spec/system/admin_dashboard_spec.rb | 25 ++++++++++++++++--- spec/system/embargo_edit_spec.rb | 19 ++++++++++++-- 4 files changed, 45 insertions(+), 10 deletions(-) diff --git a/app/models/ability.rb b/app/models/ability.rb index b52e6c452..c57b6001f 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -16,12 +16,13 @@ def custom_permissions end return unless admin? - can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role can [:destroy], ActiveFedora::Base can [:read], Schools::School + can [:update], Hydra::AccessControls::Embargo end + def test_download(id) super || can_review_submissions? end @@ -30,10 +31,10 @@ def curation_concerns_permissions alias_action :versions, to: :update alias_action :file_manager, to: :update - return if admin? || can_review_submissions? + return if admin? - cannot :index, Hydra::AccessControls::Embargo - cannot :index, Hydra::AccessControls::Lease + cannot :manage, Hydra::AccessControls::Embargo + cannot :manage, Hydra::AccessControls::Lease end def ipe_permissions diff --git a/app/views/hyrax/dashboard/sidebar/_tasks.html.erb b/app/views/hyrax/dashboard/sidebar/_tasks.html.erb index 068cd1fad..89bc3c640 100644 --- a/app/views/hyrax/dashboard/sidebar/_tasks.html.erb +++ b/app/views/hyrax/dashboard/sidebar/_tasks.html.erb @@ -12,7 +12,7 @@ <% end %> <% end %> - <% if can?(:index, Hydra::AccessControls::Embargo) %> + <% if can?(:update, Hydra::AccessControls::Embargo) %> <%= menu.nav_link(hyrax.embargoes_path) do %> <%= t('hyrax.embargoes.index.manage_embargoes') %> <% end %> diff --git a/spec/system/admin_dashboard_spec.rb b/spec/system/admin_dashboard_spec.rb index 3214d198f..affe1413f 100644 --- a/spec/system/admin_dashboard_spec.rb +++ b/spec/system/admin_dashboard_spec.rb @@ -43,8 +43,8 @@ end end - context 'as an approving user' do - let(:user) { User.find_by(ppid: 'candleradmin') } + context 'as a superuser' do + let(:superuser) { User.find_by(uid: 'superman001') } let(:etd) { FactoryBot.build(:sample_data_with_everything_embargoed) } let(:file_set) { FactoryBot.create(:public_pdf) } @@ -53,7 +53,7 @@ etd.representative = file_set etd.save - login_as user + login_as superuser end scenario 'editing an embargo' do @@ -82,4 +82,23 @@ .to eq Date.parse('2199-01-01') end end + + context 'as an approving user' do + let(:approving_user) { User.find_by(ppid: 'candleradmin') } + let(:etd) { FactoryBot.build(:sample_data_with_everything_embargoed) } + let(:file_set) { FactoryBot.create(:public_pdf) } + + before do + etd.ordered_members << file_set + etd.representative = file_set + etd.save + + login_as approving_user + end + + scenario 'editing an embargo' do + visit '/dashboard' + expect(page).not_to have_link 'Manage Embargoes' + end + end end diff --git a/spec/system/embargo_edit_spec.rb b/spec/system/embargo_edit_spec.rb index fd7f6452d..d846e5633 100644 --- a/spec/system/embargo_edit_spec.rb +++ b/spec/system/embargo_edit_spec.rb @@ -47,7 +47,9 @@ FactoryBot.create :primary_uploaded_file, user_id: user.id end let(:six_years_from_today) { Time.zone.today + 6.years } + let(:eight_years_from_today) { Time.zone.today + 8.years } let(:approving_user) { User.find_by(uid: "candleradmin") } + let(:superuser) { User.find_by(uid: 'superman001') } before do allow(CharacterizeJob).to receive(:perform_later) # There is no fits installed on travis-ci @@ -65,18 +67,31 @@ .to have_attributes visibility: restricted end - scenario "Approver can change the embargo settings" do + scenario "A regular user cannot change the embargo settings after saving" do + login_as user + visit("/embargoes/#{etd.id}/edit") + expect(page).to have_content("You are not authorized to access this page.") + end + + scenario "Approver cannot change the embargo settings" do login_as approving_user visit("/embargoes/#{etd.id}/edit") + expect(page).to have_content("You are not authorized to access this page.") + end + + scenario "Superuser can change the embargo settings" do + login_as superuser + visit("/embargoes/#{etd.id}/edit") expect(find('#etd_visibility_during_embargo').find(:xpath, 'option[1]').text).to eq 'All Restricted' find('#etd_embargo_release_date') - fill_in 'etd_embargo_release_date', with: (Time.zone.today + 8.years).to_s, fill_options: { clear: :backspace } + fill_in 'etd_embargo_release_date', with: (eight_years_from_today).to_s, fill_options: { clear: :backspace } execute_script('$("form").submit()') expect(page).to have_current_path("/concern/etds/#{etd.id}?locale=en") expect(page).to have_content etd.title.first expect(page).to have_content "successfully updated" expect(page).to have_content etd.abstract.first expect(page).to have_content etd.table_of_contents.first + expect(etd.reload.embargo_release_date).to eq eight_years_from_today expect(etd.reload.file_sets.first.embargo.embargo_release_date).to eq etd.reload.embargo_release_date end end From 1e0f7213359915a4f851c01ddb42456610f85208 Mon Sep 17 00:00:00 2001 From: fnibbit Date: Wed, 10 Mar 2021 16:08:21 -0500 Subject: [PATCH 2/8] Silence some warnings including URI.escape/unescape Also some style checker changes --- Gemfile | 1 + Gemfile.lock | 2 ++ app/models/ability.rb | 1 - spec/spec_helper.rb | 5 +++++ spec/system/admin_dashboard_spec.rb | 2 +- spec/system/embargo_edit_spec.rb | 2 +- 6 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 8a6112057..7f4a2cc0e 100644 --- a/Gemfile +++ b/Gemfile @@ -49,6 +49,7 @@ gem 'turbolinks', '~> 5' gem 'twitter-bootstrap-rails' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' +gem 'warning' gem 'webpacker', '~> 4' gem 'whenever', require: false gem 'xray-rails' diff --git a/Gemfile.lock b/Gemfile.lock index 554497f69..dbdf33eb8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1013,6 +1013,7 @@ GEM vcr (6.0.0) warden (1.2.9) rack (>= 2.0.9) + warning (1.2.0) web-console (3.7.0) actionview (>= 5.0) activemodel (>= 5.0) @@ -1114,6 +1115,7 @@ DEPENDENCIES twitter-bootstrap-rails uglifier (>= 1.3.0) vcr + warning web-console (>= 3.3.0) webdrivers webmock (~> 3.3) diff --git a/app/models/ability.rb b/app/models/ability.rb index c57b6001f..c78a407ca 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -22,7 +22,6 @@ def custom_permissions can [:update], Hydra::AccessControls::Embargo end - def test_download(id) super || can_review_submissions? end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index cbf364486..baa264f40 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,8 @@ +require 'warning' +Gem.path.each do |path| + Warning.ignore(//, path) +end + # This file was generated by the `rails generate rspec:install` command. # Conventionally, all specs live under a `spec` directory, which RSpec adds to # the `$LOAD_PATH`. diff --git a/spec/system/admin_dashboard_spec.rb b/spec/system/admin_dashboard_spec.rb index affe1413f..7fc996d23 100644 --- a/spec/system/admin_dashboard_spec.rb +++ b/spec/system/admin_dashboard_spec.rb @@ -84,7 +84,7 @@ end context 'as an approving user' do - let(:approving_user) { User.find_by(ppid: 'candleradmin') } + let(:approving_user) { User.find_by(ppid: 'candleradmin') } let(:etd) { FactoryBot.build(:sample_data_with_everything_embargoed) } let(:file_set) { FactoryBot.create(:public_pdf) } diff --git a/spec/system/embargo_edit_spec.rb b/spec/system/embargo_edit_spec.rb index d846e5633..8c6df7f35 100644 --- a/spec/system/embargo_edit_spec.rb +++ b/spec/system/embargo_edit_spec.rb @@ -84,7 +84,7 @@ visit("/embargoes/#{etd.id}/edit") expect(find('#etd_visibility_during_embargo').find(:xpath, 'option[1]').text).to eq 'All Restricted' find('#etd_embargo_release_date') - fill_in 'etd_embargo_release_date', with: (eight_years_from_today).to_s, fill_options: { clear: :backspace } + fill_in 'etd_embargo_release_date', with: eight_years_from_today.to_s, fill_options: { clear: :backspace } execute_script('$("form").submit()') expect(page).to have_current_path("/concern/etds/#{etd.id}?locale=en") expect(page).to have_content etd.title.first From 2f0141b59d4db9e94bd962223c4ef8b3e1574864 Mon Sep 17 00:00:00 2001 From: Max Kadel Date: Thu, 11 Mar 2021 11:04:16 -0500 Subject: [PATCH 3/8] admin_dashboard_spec green, - embargo_edit_spec only failing on last line of test on :76 - comments on current ability --- app/models/ability.rb | 8 +++++--- spec/system/embargo_edit_spec.rb | 4 ++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/models/ability.rb b/app/models/ability.rb index c78a407ca..4c3b767c0 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -14,8 +14,9 @@ def custom_permissions approver_for?(admin_set: obj.admin_set) end end - + # At this point approvers can't update, edit, or manage Hydra::AccessControls::Embargo return unless admin? + # Approvers don't hit this point in the code can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role can [:destroy], ActiveFedora::Base can [:read], Schools::School @@ -31,8 +32,9 @@ def curation_concerns_permissions alias_action :file_manager, to: :update return if admin? - - cannot :manage, Hydra::AccessControls::Embargo + # At this point approvers can't update, edit, or manage Hydra::AccessControls::Embargo + # current_user.ability.rules.map { |rule| rule if rule.subjects == [Hydra::AccessControls::Embargo] }.compact + cannot [:update, :edit, :manage, :index], Hydra::AccessControls::Embargo cannot :manage, Hydra::AccessControls::Lease end diff --git a/spec/system/embargo_edit_spec.rb b/spec/system/embargo_edit_spec.rb index 8c6df7f35..051b543d4 100644 --- a/spec/system/embargo_edit_spec.rb +++ b/spec/system/embargo_edit_spec.rb @@ -75,6 +75,10 @@ scenario "Approver cannot change the embargo settings" do login_as approving_user + expect(approving_user.reload.admin?).to eq false + expect(approving_user.reload.ability.can?(:manage, Hydra::AccessControls::Embargo)).to eq false + expect(approving_user.reload.ability.can?(:edit, Hydra::AccessControls::Embargo)).to eq false + expect(approving_user.reload.ability.can?(:update, Hydra::AccessControls::Embargo)).to eq false visit("/embargoes/#{etd.id}/edit") expect(page).to have_content("You are not authorized to access this page.") end From 36bec49a5013500e72392c24e02de0bf636d8f99 Mon Sep 17 00:00:00 2001 From: Max Kadel Date: Thu, 11 Mar 2021 11:31:54 -0500 Subject: [PATCH 4/8] admin dashboard and embargo edit tests green, - overriding entire embargo_controller_behavior.rb --- .../hyrax/embargoes_controller_behavior.rb | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 app/controllers/concerns/hyrax/embargoes_controller_behavior.rb diff --git a/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb b/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb new file mode 100644 index 000000000..918bb3a2c --- /dev/null +++ b/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb @@ -0,0 +1,55 @@ +module Hyrax + module EmbargoesControllerBehavior + extend ActiveSupport::Concern + include Hyrax::ManagesEmbargoes + include Hyrax::Collections::AcceptsBatches + + def index + add_breadcrumb t(:'hyrax.controls.home'), root_path + add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path + add_breadcrumb t(:'hyrax.embargoes.index.manage_embargoes'), hyrax.embargoes_path + authorize! :index, Hydra::AccessControls::Embargo + end + + # Removes a single embargo + def destroy + Hyrax::Actors::EmbargoActor.new(curation_concern).destroy + flash[:notice] = curation_concern.embargo_history.last + if curation_concern.work? && curation_concern.file_sets.present? + redirect_to confirm_permission_path + else + redirect_to edit_embargo_path + end + end + + # Updates a batch of embargos + def update + filter_docs_with_edit_access! + copy_visibility = params[:embargoes].values.map { |h| h[:copy_visibility] } + ActiveFedora::Base.find(batch).each do |curation_concern| + Hyrax::Actors::EmbargoActor.new(curation_concern).destroy + # if the concern is a FileSet, set its visibility and skip the copy_visibility_to_files, which is built for Works + if curation_concern.file_set? + curation_concern.visibility = curation_concern.to_solr["visibility_after_embargo_ssim"] + curation_concern.save! + elsif copy_visibility.include?(curation_concern.id) + curation_concern.copy_visibility_to_files + end + end + redirect_to embargoes_path, notice: t('.embargo_deactivated') + end + + # This allows us to use the unauthorized template in curation_concerns/base + def self.local_prefixes + ['hyrax/base'] + end + + def edit + add_breadcrumb t(:'hyrax.controls.home'), root_path + add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path + add_breadcrumb t(:'hyrax.embargoes.index.manage_embargoes'), hyrax.embargoes_path + add_breadcrumb t(:'hyrax.embargoes.edit.embargo_update'), '#' + authorize! :edit, Hydra::AccessControls::Embargo + end + end +end From 037d741af8830ba33f28648b946ad09800ebdbbf Mon Sep 17 00:00:00 2001 From: Max Kadel Date: Thu, 11 Mar 2021 11:39:46 -0500 Subject: [PATCH 5/8] Only override the edit behavior for embargoes controller --- .../hyrax/embargoes_controller_behavior.rb | 45 +------------------ 1 file changed, 1 insertion(+), 44 deletions(-) diff --git a/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb b/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb index 918bb3a2c..c8c9d6cd7 100644 --- a/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +++ b/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb @@ -4,51 +4,8 @@ module EmbargoesControllerBehavior include Hyrax::ManagesEmbargoes include Hyrax::Collections::AcceptsBatches - def index - add_breadcrumb t(:'hyrax.controls.home'), root_path - add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path - add_breadcrumb t(:'hyrax.embargoes.index.manage_embargoes'), hyrax.embargoes_path - authorize! :index, Hydra::AccessControls::Embargo - end - - # Removes a single embargo - def destroy - Hyrax::Actors::EmbargoActor.new(curation_concern).destroy - flash[:notice] = curation_concern.embargo_history.last - if curation_concern.work? && curation_concern.file_sets.present? - redirect_to confirm_permission_path - else - redirect_to edit_embargo_path - end - end - - # Updates a batch of embargos - def update - filter_docs_with_edit_access! - copy_visibility = params[:embargoes].values.map { |h| h[:copy_visibility] } - ActiveFedora::Base.find(batch).each do |curation_concern| - Hyrax::Actors::EmbargoActor.new(curation_concern).destroy - # if the concern is a FileSet, set its visibility and skip the copy_visibility_to_files, which is built for Works - if curation_concern.file_set? - curation_concern.visibility = curation_concern.to_solr["visibility_after_embargo_ssim"] - curation_concern.save! - elsif copy_visibility.include?(curation_concern.id) - curation_concern.copy_visibility_to_files - end - end - redirect_to embargoes_path, notice: t('.embargo_deactivated') - end - - # This allows us to use the unauthorized template in curation_concerns/base - def self.local_prefixes - ['hyrax/base'] - end - def edit - add_breadcrumb t(:'hyrax.controls.home'), root_path - add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path - add_breadcrumb t(:'hyrax.embargoes.index.manage_embargoes'), hyrax.embargoes_path - add_breadcrumb t(:'hyrax.embargoes.edit.embargo_update'), '#' + super authorize! :edit, Hydra::AccessControls::Embargo end end From e9ab0d4dcaf19e1b6667b371f052ad2dc88f6349 Mon Sep 17 00:00:00 2001 From: fnibbit Date: Mon, 15 Mar 2021 10:23:13 -0400 Subject: [PATCH 6/8] Check for breadcrumbs --- spec/system/admin_dashboard_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/system/admin_dashboard_spec.rb b/spec/system/admin_dashboard_spec.rb index 7fc996d23..2d435ed73 100644 --- a/spec/system/admin_dashboard_spec.rb +++ b/spec/system/admin_dashboard_spec.rb @@ -59,6 +59,10 @@ scenario 'editing an embargo' do visit '/dashboard' click_link 'Manage Embargoes' + #check that breadcrumbs are present + expect(page).to have_link('Home') + expect(page).to have_link('Dashboard') + expect(page).to have_link('Manage Embargoes') # test that tabs are working correctly click_link 'Expired Active Embargoes' expect(page).to have_content('There are no expired embargoes') From 7719f049181bb37f8f747637f2b746cff9fe6c8b Mon Sep 17 00:00:00 2001 From: fnibbit Date: Mon, 15 Mar 2021 11:29:13 -0400 Subject: [PATCH 7/8] Override edit method in controller rather than behavior --- .../hyrax/embargoes_controller_behavior.rb | 12 ------------ app/controllers/hyrax/embargoes_controller.rb | 15 +++++++++++++++ spec/system/admin_dashboard_spec.rb | 3 ++- 3 files changed, 17 insertions(+), 13 deletions(-) delete mode 100644 app/controllers/concerns/hyrax/embargoes_controller_behavior.rb create mode 100644 app/controllers/hyrax/embargoes_controller.rb diff --git a/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb b/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb deleted file mode 100644 index c8c9d6cd7..000000000 --- a/app/controllers/concerns/hyrax/embargoes_controller_behavior.rb +++ /dev/null @@ -1,12 +0,0 @@ -module Hyrax - module EmbargoesControllerBehavior - extend ActiveSupport::Concern - include Hyrax::ManagesEmbargoes - include Hyrax::Collections::AcceptsBatches - - def edit - super - authorize! :edit, Hydra::AccessControls::Embargo - end - end -end diff --git a/app/controllers/hyrax/embargoes_controller.rb b/app/controllers/hyrax/embargoes_controller.rb new file mode 100644 index 000000000..57f068948 --- /dev/null +++ b/app/controllers/hyrax/embargoes_controller.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true +module Hyrax + class EmbargoesController < ApplicationController + include Hyrax::EmbargoesControllerBehavior + # Override edit method to check authorization + def edit + add_breadcrumb t(:'hyrax.controls.home'), root_path + add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path + add_breadcrumb t(:'hyrax.embargoes.index.manage_embargoes'), hyrax.embargoes_path + add_breadcrumb t(:'hyrax.embargoes.edit.embargo_update'), '#' + authorize! :edit, Hydra::AccessControls::Embargo + end + with_themed_layout 'dashboard' + end +end diff --git a/spec/system/admin_dashboard_spec.rb b/spec/system/admin_dashboard_spec.rb index 2d435ed73..5001777c8 100644 --- a/spec/system/admin_dashboard_spec.rb +++ b/spec/system/admin_dashboard_spec.rb @@ -59,7 +59,8 @@ scenario 'editing an embargo' do visit '/dashboard' click_link 'Manage Embargoes' - #check that breadcrumbs are present + expect(page).to have_content('All Active Embargoes') + # check that breadcrumbs are present expect(page).to have_link('Home') expect(page).to have_link('Dashboard') expect(page).to have_link('Manage Embargoes') From 95aa5d402bd9fa3f1597a8c00532aec26db424d1 Mon Sep 17 00:00:00 2001 From: fnibbit Date: Mon, 15 Mar 2021 11:42:59 -0400 Subject: [PATCH 8/8] Remove testing changes --- Gemfile | 1 - Gemfile.lock | 2 -- app/controllers/hyrax/embargoes_controller.rb | 2 +- app/models/ability.rb | 7 +------ spec/spec_helper.rb | 5 ----- 5 files changed, 2 insertions(+), 15 deletions(-) diff --git a/Gemfile b/Gemfile index 7f4a2cc0e..8a6112057 100644 --- a/Gemfile +++ b/Gemfile @@ -49,7 +49,6 @@ gem 'turbolinks', '~> 5' gem 'twitter-bootstrap-rails' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' -gem 'warning' gem 'webpacker', '~> 4' gem 'whenever', require: false gem 'xray-rails' diff --git a/Gemfile.lock b/Gemfile.lock index dbdf33eb8..554497f69 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1013,7 +1013,6 @@ GEM vcr (6.0.0) warden (1.2.9) rack (>= 2.0.9) - warning (1.2.0) web-console (3.7.0) actionview (>= 5.0) activemodel (>= 5.0) @@ -1115,7 +1114,6 @@ DEPENDENCIES twitter-bootstrap-rails uglifier (>= 1.3.0) vcr - warning web-console (>= 3.3.0) webdrivers webmock (~> 3.3) diff --git a/app/controllers/hyrax/embargoes_controller.rb b/app/controllers/hyrax/embargoes_controller.rb index 57f068948..e7d00de28 100644 --- a/app/controllers/hyrax/embargoes_controller.rb +++ b/app/controllers/hyrax/embargoes_controller.rb @@ -2,7 +2,7 @@ module Hyrax class EmbargoesController < ApplicationController include Hyrax::EmbargoesControllerBehavior - # Override edit method to check authorization + # Override edit method to check authorization def edit add_breadcrumb t(:'hyrax.controls.home'), root_path add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path diff --git a/app/models/ability.rb b/app/models/ability.rb index 4c3b767c0..d9af009c5 100644 --- a/app/models/ability.rb +++ b/app/models/ability.rb @@ -14,13 +14,10 @@ def custom_permissions approver_for?(admin_set: obj.admin_set) end end - # At this point approvers can't update, edit, or manage Hydra::AccessControls::Embargo return unless admin? - # Approvers don't hit this point in the code can [:create, :show, :add_user, :remove_user, :index, :edit, :update, :destroy], Role can [:destroy], ActiveFedora::Base can [:read], Schools::School - can [:update], Hydra::AccessControls::Embargo end def test_download(id) @@ -32,10 +29,8 @@ def curation_concerns_permissions alias_action :file_manager, to: :update return if admin? - # At this point approvers can't update, edit, or manage Hydra::AccessControls::Embargo - # current_user.ability.rules.map { |rule| rule if rule.subjects == [Hydra::AccessControls::Embargo] }.compact cannot [:update, :edit, :manage, :index], Hydra::AccessControls::Embargo - cannot :manage, Hydra::AccessControls::Lease + cannot :index, Hydra::AccessControls::Lease end def ipe_permissions diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index baa264f40..cbf364486 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,8 +1,3 @@ -require 'warning' -Gem.path.each do |path| - Warning.ignore(//, path) -end - # This file was generated by the `rails generate rspec:install` command. # Conventionally, all specs live under a `spec` directory, which RSpec adds to # the `$LOAD_PATH`.