Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Assigning a person to review a submission based on properties of the work


Assigning a person to review a submission based on properties of the work. And you don't need multiple admin sets to do this.

Whirlwind Workflow

Two primary concepts of the workflow in Hyrax 2.0:

  1. Permissions are assigned at two levels:
  2. Sipity::WorkflowResponsibility - A person has permissions to all things using this workflow
  3. Sipity::EntitySpecificResponsibility - A person has permissions to only the work/entity
  4. Sipity::Method - Something we "call" when we take a Sipity::Action.
  5. Hyrax::Workflow::PermissionGenerator

How to Do This

You'll need to understand the JSON workflow schema. See the [default workflow][template_workflows] of the method called when a user deposits a work: One method object, Hyrax::Workflow::GrantEditToDepositor, grants the user depositing rights for the deposit worked (eg. Sipity::EntitySpecificResponsibility).

You'll need to modify the workflow (an exercise left up to the reader) to include a method for the appropriate action.

Then create (and test) your method object.

module Hyrax::Workflow::AssignReviewerByDepartment
   def, **)
     reviewer = find_reviewer_for(department: target.department)
     # This assigns database permissions, but does not grant permissions on the Fedora object. target, agent: reviewer, role: 'Reviewer')
     # Do you want to update the Fedora object? Then you'll need to make adjustments.

   def self.find_reviewer_for(department:)
     # You do the work

# Make sure to test that your method conforms to the Hyrax workflow method interface
RSpec.describe Hyrax::Workflow::AssignReviewerByDepartment do
  let(:workflow_method) { described_class }
  it_behaves_like "a Hyrax workflow method"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.