samvera-deprecated / curation_concerns

A Hydra-based Rails Engine that extends an application, adding the ability to Create, Read, Update and Destroy (CRUD) objects (based on Hydra::Works) and providing a generator for defining object types with custom workflows, views, access controls, etc.
Other
15 stars 27 forks source link

prevents child relationship when parent is owned by a different depositor #1154

Closed revgum closed 7 years ago

revgum commented 7 years ago

First step in surfacing a fix for Sufia Issue 3042: https://github.com/projecthydra/sufia/issues/3042

revgum commented 7 years ago

@vantuyls @straleyb and I worked a bit and explored how to try and address this using a validator, but they fired before the actors ran. The AddToWorkActor is responsible for persisting the relationship from parent to child.. and it was found that we can inject errors on the curation_concern to propagate them to the front-end. So this PR seems like the cleanest approach to getting validation as a byproduct of this persist.

It wasn't clear how else to accomplish this functionality without what seems like significantly reworking what and how the actor operates in conjunction with validations on the backend.