-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renaming Identifiers tab to Curator Controlled (#452)
Also only allowing collection admins and super admins access to the edit form refs #421
- Loading branch information
1 parent
1938727
commit 75103bb
Showing
7 changed files
with
80 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<div class="section-title"> | ||
<!-- DOI field (mostly for legacy DSpace works) --> | ||
<div class="field"> | ||
DOI <span class="text-muted field-hint">(enter the Digital Object Identifier, e.g. 10.80021/62qy-nj36)</span><br> | ||
<%= @work.doi %> | ||
</div> | ||
|
||
<!-- ARK field (mostly for legacy DSpace works) --> | ||
<div class="field"> | ||
ARK <span class="text-muted field-hint">(enter the core ARK identifier, e.g. ark:/88435/xyz123)</span><br> | ||
<%= @work.ark %> | ||
</div> | ||
</div> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters