Skip to content

Commit

Permalink
Add field to store whether a workflow allows setting access grants
Browse files Browse the repository at this point in the history
Sufia allows depositors to set other users who can edit a work.  This is
perfect for a zero step workflow, but for a mediated deposit workflow,
we don't want anyone to be able to edit the work once it is accepted.

We need a place to store whether we should be showing the UI widget that
allows the creator to share access.

Ref samvera-deprecated/sufia#3134
  • Loading branch information
jcoyne committed Mar 8, 2017
1 parent b54431b commit 2628ec2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
Expand Up @@ -72,6 +72,7 @@ def find_or_create_from(configuration:)
workflow = Sipity::Workflow.find_or_initialize_by(name: configuration.fetch(:name)) do |wf|
wf.label = configuration.fetch(:label, nil)
wf.description = configuration.fetch(:description, nil)
wf.allows_access_grant = configuration.fetch(:allows_access_grant, nil)
wf.save!
end

Expand Down
1 change: 1 addition & 0 deletions app/services/curation_concerns/workflow/workflow_schema.rb
Expand Up @@ -34,6 +34,7 @@ def constant_name?(value)
required(:name).filled(:str?) # Sipity::Workflow#name
optional(:label).filled(:str?) # Sipity::Workflow#label
optional(:description).filled(:str?) # Sipity::Workflow#description
optional(:allows_access_grant).filled(:bool?) # Sipity::Workflow#allows_access_grant?
required(:actions).each do
required(:name).filled(:str?) # Sipity::WorkflowAction#name
required(:from_states).each do
Expand Down
@@ -0,0 +1,5 @@
class AddAllowsAccessGrantToWorkflow < ActiveRecord::Migration
def change
add_column :sipity_workflows, :allows_access_grant, :boolean
end
end
Expand Up @@ -10,6 +10,7 @@
"name": "ulra_submission",
"label": "This is the label",
"description": "This description could get really long",
"allows_access_grant": true,
"actions": [{
"name": "approve",
"transition_to": "reviewed",
Expand Down Expand Up @@ -42,8 +43,10 @@
result = described_class.generate_from_json_file(path: path)
end.to change { Sipity::Workflow.count }.by(1)
expect(result).to match_array(kind_of(Sipity::Workflow))
expect(result.first.label).to eq "This is the label"
expect(result.first.description).to eq "This description could get really long"
first_workflow = result.first
expect(first_workflow.label).to eq "This is the label"
expect(first_workflow.description).to eq "This description could get really long"
expect(first_workflow.allows_access_grant?).to be true
end
end
end
Expand Up @@ -8,6 +8,7 @@ module Workflow
workflows: [
{
name: "valid",
allows_access_grant: true,
actions: [
{
name: "finalize_digitization",
Expand Down

0 comments on commit 2628ec2

Please sign in to comment.