projectblacklight / blacklight-access_controls

Provides access controls for Blacklight-based Rails applications.
2 stars 3 forks source link

Solr wrapper fix #53

Closed dgcliff closed 5 years ago

dgcliff commented 5 years ago

Fixes #52

dgcliff commented 5 years ago

It appears to be failing on With an ID instead of a record test. Digging into it.

dgcliff commented 5 years ago

Setting the test to be

context 'With an ID instead of a record' do
      subject { ability }

      let(:user) { create(:user) }
      let(:asset) do
        create_solr_doc(id: id,
                        discover_access_group_ssim: ['public'],
                        read_access_group_ssim: ['public'],
                        download_access_group_ssim: ['public'])
      end

      # It should still work, even if we just pass in an ID
      it { is_expected.to be_able_to(:discover, asset.id) }
      it { is_expected.to be_able_to(:read, asset.id) }
      it { is_expected.to be_able_to(:download, asset.id) }
    end

reduces the error from all three (discover, read, download) to just download

  1) Ability Given an asset that has been made publicly downloadable With an ID instead of a record should be able to download public_download
     Failure/Error: it { is_expected.to be_able_to(:download, asset.id) }
       expected to be able to :download "public_download"
     # ./spec/unit/ability_spec.rb:144:in `block (4 levels) in <main>'

I used pry, and checked the test log - it's definitely entering def test_download(id) as far as I can tell, it's just giving back false

As the test currently stands, by depending on having download to allow the other two cases causes the cascading triple error. But it appears to be download specific.

dgcliff commented 5 years ago

Fixed by adding download_access_group_ssim,download_access_person_ssim, and inheritable_download_access_group_ssim,inheritable_download_access_person_ssim, to solrconfig.xml