diff --git a/app/views/works/_curator_controlled_display.html.erb b/app/views/works/_curator_controlled_display.html.erb
new file mode 100644
index 000000000..41771c7eb
--- /dev/null
+++ b/app/views/works/_curator_controlled_display.html.erb
@@ -0,0 +1,13 @@
+
+
+
+ DOI (enter the Digital Object Identifier, e.g. 10.80021/62qy-nj36)
+ <%= @work.doi %>
+
+
+
+
+ ARK (enter the core ARK identifier, e.g. ark:/88435/xyz123)
+ <%= @work.ark %>
+
+
diff --git a/app/views/works/_identifier_form.html.erb b/app/views/works/_curator_controlled_form.html.erb
similarity index 100%
rename from app/views/works/_identifier_form.html.erb
rename to app/views/works/_curator_controlled_form.html.erb
diff --git a/app/views/works/_form.html.erb b/app/views/works/_form.html.erb
index 389442a91..7494cb8a2 100644
--- a/app/views/works/_form.html.erb
+++ b/app/views/works/_form.html.erb
@@ -11,7 +11,7 @@
-
+
@@ -30,9 +30,13 @@
<%= render 'additional_form' %>
-
-
- <%= render 'identifier_form' %>
+
+
+ <% if current_user.has_role?(:collection_admin, @work.collection) %>
+ <%= render 'curator_controlled_form' %>
+ <% else %>
+ <%= render 'curator_controlled_display' %>
+ <% end %>
diff --git a/spec/system/bitklavier_form_submission_spec.rb b/spec/system/bitklavier_form_submission_spec.rb
index 5f39c423a..75b0e7bb2 100644
--- a/spec/system/bitklavier_form_submission_spec.rb
+++ b/spec/system/bitklavier_form_submission_spec.rb
@@ -2,7 +2,7 @@
require "rails_helper"
RSpec.describe "Form submission for migrating bitklavier", type: :system, mock_ezid_api: true, js: true do
- let(:user) { FactoryBot.create(:princeton_submitter) }
+ let(:user) { FactoryBot.create(:research_data_moderator) }
let(:title) { "bitKlavier Grand Sample Library—Binaural Mic Image" }
let(:description) do
"The bitKlavier Grand consists of sample collections of a new Steinway D grand piano from nine different stereo mic images, with: 16 velocity layers, at every minor 3rd (starting at A0); Hammer release samples; Release resonance samples; Pedal samples. Release packages at 96k/24bit, 88.2k/24bit, 48k/24bit, 44.1k/16bit are available for various applications.
@@ -46,7 +46,7 @@
fill_in "publisher", with: publisher
fill_in "publication_year", with: 2021
find("#collection_id").find(:xpath, "option[1]").select_option
- click_on "v-pills-identifier-tab"
+ click_on "v-pills-curator-controlled-tab"
fill_in "doi", with: doi
fill_in "ark", with: ark
click_on "Create"
diff --git a/spec/system/curator_controlled_metadata_spec.rb b/spec/system/curator_controlled_metadata_spec.rb
new file mode 100644
index 000000000..d5cb67f45
--- /dev/null
+++ b/spec/system/curator_controlled_metadata_spec.rb
@@ -0,0 +1,52 @@
+# frozen_string_literal: true
+require "rails_helper"
+
+RSpec.describe "Curator Controlled metadata tab", type: :system do
+ let(:draft_work) do
+ resource = FactoryBot.build(:resource, creators: [PDCMetadata::Creator.new_person("Harriet", "Tubman", "1234-5678-9012-3456")])
+ FactoryBot.create(:draft_work, resource: resource, created_by_user_id: user.id, collection: Collection.research_data)
+ end
+
+ before do
+ stub_s3
+ sign_in user
+ visit edit_work_path(draft_work)
+ click_on "Curator Controlled"
+ end
+
+ context "As a princeton submitter" do
+ let(:user) { FactoryBot.create :princeton_submitter }
+ it "does not allow editing of curator controlled fields", js: true, mock_ezid_api: true do
+ # I can not edit curator fields
+ expect(page).to have_content("ARK")
+ expect(page).not_to have_css("#ark.input-text-long")
+
+ # I can edit other fields
+ click_on "Required Metadata"
+ fill_in "description", with: "The work can be changed"
+ click_on "Save Work"
+ expect(draft_work.reload.resource.description).to eq "The work can be changed"
+ end
+ end
+ context "As a collection admin" do
+ let(:user) { FactoryBot.create :research_data_moderator }
+
+ it "allows editing of curator controlled fields", js: true, mock_ezid_api: true do
+ expect(page).to have_css("#ark.input-text-long")
+ fill_in "ark", with: "http://arks.princeton.edu/ark:/88435/dsp01hx11xj13h"
+ click_on "Save Work"
+ expect(draft_work.reload.ark).to eq "ark:/88435/dsp01hx11xj13h"
+ end
+ end
+
+ context "As a super admin" do
+ let(:user) { FactoryBot.create :super_admin_user }
+
+ it "allows editing of curator controlled fields", js: true, mock_ezid_api: true do
+ expect(page).to have_css("#ark.input-text-long")
+ fill_in "ark", with: "http://arks.princeton.edu/ark:/88435/dsp01hx11xj13h"
+ click_on "Save Work"
+ expect(draft_work.reload.ark).to eq "ark:/88435/dsp01hx11xj13h"
+ end
+ end
+end
diff --git a/spec/system/migrate_submission_spec.rb b/spec/system/migrate_submission_spec.rb
index 907be193c..3a5f08019 100644
--- a/spec/system/migrate_submission_spec.rb
+++ b/spec/system/migrate_submission_spec.rb
@@ -2,7 +2,7 @@
require "rails_helper"
RSpec.describe "Form submission for a legacy dataset", type: :system, mock_ezid_api: true, js: true do
- let(:user) { FactoryBot.create(:princeton_submitter) }
+ let(:user) { FactoryBot.create(:research_data_moderator) }
let(:doi) { "10.34770/123-abc" }
let(:title) { "Sowing the Seeds for More Usable Web Archives: A Usability Study of Archive-It" }
let(:contributors) do
@@ -51,7 +51,7 @@
fill_in "family_name_1", with: "Abrams"
fill_in "description", with: description
find("#rights_identifier").find(:xpath, "option[2]").select_option
- click_on "Identifiers"
+ click_on "Curator Controlled"
fill_in "doi", with: doi
fill_in "ark", with: ark
click_on "Additional Metadata"
@@ -80,15 +80,15 @@
fill_in "family_name_1", with: "Abrams"
fill_in "description", with: description
find("#rights_identifier").find(:xpath, "option[2]").select_option
- click_on "Identifiers"
+ click_on "Curator Controlled"
fill_in "doi", with: "abc123"
click_on "Create"
expect(page).to have_content "Invalid DOI: does not match format"
- click_on "Identifiers"
+ click_on "Curator Controlled"
fill_in "doi", with: "10.34770/123-ab"
click_on "Create"
expect(page).to have_content "Invalid DOI: can not verify it's authenticity"
- click_on "Identifiers"
+ click_on "Curator Controlled"
fill_in "doi", with: doi
fill_in "ark", with: ark
click_on "Additional Metadata"
diff --git a/spec/system/work_spec.rb b/spec/system/work_spec.rb
index 9d573276e..e38dc1340 100644
--- a/spec/system/work_spec.rb
+++ b/spec/system/work_spec.rb
@@ -48,18 +48,6 @@
expect(page.html.include?("By initiating this new submission, we have reserved a draft DOI for your use")).to be true
end
- it "Handles ARK URLs in the ARK field", js: true, mock_ezid_api: true do
- resource = FactoryBot.build(:resource, creators: [PDCMetadata::Creator.new_person("Harriet", "Tubman", "1234-5678-9012-3456")])
- work = FactoryBot.create(:draft_work, resource: resource)
- user = work.created_by_user
- sign_in user
- visit edit_work_path(work)
- click_on "Identifiers"
- fill_in "ark", with: "http://arks.princeton.edu/ark:/88435/dsp01hx11xj13h"
- click_on "Save Work"
- expect(work.reload.ark).to eq "ark:/88435/dsp01hx11xj13h"
- end
-
it "Handles Rights field", js: true do
resource = FactoryBot.build(:resource, creators: [PDCMetadata::Creator.new_person("Harriet", "Tubman", "1234-5678-9012-3456")])
work = FactoryBot.create(:draft_work, resource: resource)