Skip to content

Instantly share code, notes, and snippets.

@jcoyne
Last active May 7, 2017 01:29
Show Gist options
  • Save jcoyne/e3a487f0722438f4402aeed5cf3292f1 to your computer and use it in GitHub Desktop.
Save jcoyne/e3a487f0722438f4402aeed5cf3292f1 to your computer and use it in GitHub Desktop.
Workflow Lesson plan for Advanced Hydra Camp
git checkout day3/workflow-start
$ ls config/workflows/
default_workflow.json		mediated_deposit_workflow.json

Open config/workflows/default_workflow.json Open config/workflows/mediated_deposit_workflow.json

The schema

https://github.com/projecthydra-labs/hyrax/blob/master/app/services/hyrax/workflow/workflow_schema.rb

Admin access

Let's see how this functions. First we grant ourselves admin access.

# config/role_map.yml

development:
  admin:
    - [email protected]

The Rails server must be restarted after this change.

Loading workflows

solr_wrapper
fcrepo_wrapper
bin/rails hyrax:default_admin_set:create

rails server

Create a new admin set

Set up a new admin set and make it mediated_depost. Grant deposit access to the registered group.

Create a new generic_work. Flip to the relationships tab. See how sharing goes away. Make a deposit in the mediated group. Login as another user and see that it's not visibile. Login as reviewer and see that it's visible. Approve it. Login as another user and see it's now visible.

YAML files are templates for workflows

We need to have each admin set have it’s own workflows (even if they’re made from the same template) because we might need to give a different set of agents access per admin set.

Create a new workflow.

curl https://github.com/pulibrary/plum/blob/master/config/workflows/books_workflow.json -o config/workflows/books_workflow.json
bin/rails hyrax:workflow:load

Create a new admin set using that WF.

try it out.

Future enhancements:

  • Restrict worktype - workflow mapping.

Bugs:

  • Depositor can't edit when something is sent back.

Let's look at the data model.

  • Workflow
  • WorkflowProxy (proxy for a work)
  • State
  • Action
  • Responsibility
  • Agent (proxy for a user/group)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment