valkyrie
valkyrie copied to clipboard
Mark Resource as read only.
Solr is not always roundtrip-able (fields can be indexed without being stored). That means if you retrieve a record from Solr, you should not attempt to persist that record (to the database perhaps) or data could be lost.
It should be possible to configure QueryService to return only read only records. The Persister, before saving should validate that the record is not so marked.
Thinking about an api for this...
resource = Book.new
resource.lock!
resource.locked?
resource = Book.new
resource.read_only!
resource.read_only?
Something similar?
Yes. I'm in favor of read_only! / read_only?
Success Criteria:
class Resource < Valkyrie::Resource
end
resource = Resource.new
resource.read_only!
persister.save(resource: resource) # raises Valkyrie::Persistence::ReadOnlyPersistence