diff --git a/app/controllers/dois_controller.rb b/app/controllers/dois_controller.rb index 0a0b82382..b67689457 100644 --- a/app/controllers/dois_controller.rb +++ b/app/controllers/dois_controller.rb @@ -492,7 +492,7 @@ def safe_params :descriptions, { descriptions: [:description, :descriptionType, :lang] }, :rightsList, - { rightsList: [:rights, :rightsUri] }, + { rightsList: [:rights, :rightsUri, :lang] }, :xml, :regenerate, :source, @@ -510,9 +510,9 @@ def safe_params :should_validate, :client, :creators, - { creators: [:nameType, { nameIdentifiers: [:nameIdentifier, :nameIdentifierScheme, :schemeUri] }, :name, :givenName, :familyName, :affiliation] }, + { creators: [:nameType, { nameIdentifiers: [:nameIdentifier, :nameIdentifierScheme, :schemeUri] }, :name, :givenName, :familyName, :affiliation, :lang] }, :contributors, - { contributors: [:nameType, { nameIdentifiers: [:nameIdentifier, :nameIdentifierScheme, :schemeUri] }, :name, :givenName, :familyName, :affiliation, :contributorType] }, + { contributors: [:nameType, { nameIdentifiers: [:nameIdentifier, :nameIdentifierScheme, :schemeUri] }, :name, :givenName, :familyName, :affiliation, :contributorType, :lang] }, :identifiers, { identifiers: [:identifier, :identifierType] }, :relatedIdentifiers, diff --git a/spec/requests/dois_spec.rb b/spec/requests/dois_spec.rb index 2866e3ea7..f41ded754 100644 --- a/spec/requests/dois_spec.rb +++ b/spec/requests/dois_spec.rb @@ -1919,6 +1919,26 @@ # end end + context 'update rightsList' do + let(:rights_list) { [{ "rights" => "Creative Commons Attribution 3.0", "rightsUri" => "http://creativecommons.org/licenses/by/3.0/", "lang" => "en"}] } + let(:update_attributes) do + { + "data" => { + "type" => "dois", + "attributes" => { + "rightsList" => rights_list + } + } + } + end + + before { patch "/dois/#{doi.doi}", params: update_attributes.to_json, headers: headers } + + it 'updates the Doi' do + expect(json.dig('data', 'attributes', 'rightsList')).to eq(rights_list) + end + end + context 'landing page' do let(:url) { "https://blog.datacite.org/re3data-science-europe/" } let(:xml) { Base64.strict_encode64(file_fixture('datacite.xml').read) }