You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add use_valkyrie parameter to GrantReadJob #perform method. When true, use Valkyrie to get the file set object and set permissions on the valkyrie resource. Otherwise, continue to process the ActiveFedora fileset.
Rationale
Allow jobs to execute correctly with existing AF implementation or the wings Valkyrie implementation.
Expected behavior
GrantReadJob #perform method receives parameters file_set_id, user_key, use_valkyrie: true | false, finding a valkyrie resource when use_valkyrie is true or an AF object if use_valkyrie is false, and in both cases correctly grants read access to the user for the fileset. Parameter use_valkyrie defaults to : Hyrax.config.use_valkyrie?
To find a fileset by id for a resource, use...
id = Valkyrie::ID.new(file_set_id)
file_set_resource = Hyrax.query_service.find_by(id: file_set_id)
The process for setting the read access is the same for both types of objects.
To save a fileset resource, use...
Hyrax.persister.save(resource: file_set_resource)
Actual behavior
GrantReadJob #perform method raises an exception (e.g. Unknown Argument) when use_valkyrie parameter is passed in.
For testing this job, you can use something like...
RSpec.describe GrantReadJob do
[true, false].each do |use_valkyrie|
context "when use_valkyrie is #{use_valkyrie}" do
...
described_class.perform_now(file_set.id, depositor.user_key, use_valkyrie: use_valkyrie)
Descriptive summary
Add use_valkyrie parameter to GrantReadJob #perform method. When true, use Valkyrie to get the file set object and set permissions on the valkyrie resource. Otherwise, continue to process the ActiveFedora fileset.
Rationale
Allow jobs to execute correctly with existing AF implementation or the wings Valkyrie implementation.
Expected behavior
GrantReadJob #perform method receives parameters
file_set_id, user_key, use_valkyrie: true | false
, finding a valkyrie resource when use_valkyrie is true or an AF object if use_valkyrie is false, and in both cases correctly grants read access to the user for the fileset. Parameteruse_valkyrie
defaults to: Hyrax.config.use_valkyrie?
To find a fileset by id for a resource, use...
The process for setting the read access is the same for both types of objects.
To save a fileset resource, use...
Actual behavior
GrantReadJob #perform method raises an exception (e.g. Unknown Argument) when use_valkyrie parameter is passed in.
Approach for Conversion
See Pattern for Jobs Receiving Parameter that may be an AF Object or a Valkyrie Resource
Steps to reproduce the behavior
See example of processing both objects in... file_set_actor_spec.rb
For testing this job, you can use something like...
Related work
The text was updated successfully, but these errors were encountered: