samvera / hydra-head

Samvera Repository Rails Engine
Other
98 stars 41 forks source link

Embargo is not enforced #172

Open mstroming opened 10 years ago

mstroming commented 10 years ago

You can set embargo on a Fedora object and the embargo field gets indexed in Solr correctly. However, searches are not enforcing embargo. The under_embargo? check works, though.

It looks like embargo enforcement was removed a while ago: https://github.com/projecthydra/hydra-head/blob/v3.0.0/lib/hydra/access_controls_enforcement.rb#L203

It also looks like it is now possible to enforce it for the show view: https://github.com/projecthydra/hydra-head/blob/2be4b2a0a3a0b7cf68e38bfecc7cd7f318ceee3e/hydra-core/lib/generators/hydra/templates/catalog_controller.rb#L9

https://github.com/projecthydra/hydra-head/blob/2402c71167d3aed9d62bae78ce5c504854f3188d/hydra-access-controls/lib/hydra/access_controls_enforcement.rb#L53

It seems to make more sense to enforce it for all Solr queries, though. This could mean adding code around here:

https://github.com/projecthydra/hydra-head/blob/49a936eef922f9024ffa08a9efff6c816d6032d2/hydra-access-controls/lib/hydra/access_controls_enforcement.rb#L19

A workaround for applications wanting to enforce embargo before this is fixed might look something like this:

https://github.com/projecthydra/curate/blob/197e4535ca2bc8d95450ee9a1272b0fd9abbc7fe/app/controllers/catalog_controller.rb#L18

https://github.com/projecthydra/curate/blob/197e4535ca2bc8d95450ee9a1272b0fd9abbc7fe/app/helpers/hydramata/solr_helper.rb#L8

To enforce on edit/show views: https://github.com/projecthydra/curate/blob/874656adffab69990edfab731afbd2c7f52de279/app/models/concerns/curate/ability.rb#L29 https://github.com/projecthydra/curate/blob/874656adffab69990edfab731afbd2c7f52de279/app/models/concerns/curate/ability.rb#L69 https://github.com/projecthydra/curate/blob/874656adffab69990edfab731afbd2c7f52de279/app/models/concerns/curate/ability.rb#L105 https://github.com/projecthydra/curate/blob/874656adffab69990edfab731afbd2c7f52de279/app/models/concerns/curate/ability.rb#L140

jeremyf commented 10 years ago

This should be brought into Hydra Head on the 6.4, 6.5, and 6.6 branch.

Cherry-pick the #173 pull request

jcoyne commented 10 years ago

Fixed by 7.1.0?