diff --git a/app/models/concerns/authenticable.rb b/app/models/concerns/authenticable.rb index 0d6470073..147bd1aa4 100644 --- a/app/models/concerns/authenticable.rb +++ b/app/models/concerns/authenticable.rb @@ -189,7 +189,7 @@ def not_allowed_by_doi_and_user(doi: nil, user: nil) return false if doi.aasm_state == "findable" return true if user.blank? return false if %w(staff_admin staff_user).include?(user.role_id) - return false if %w(consortium_admin).include?(user.role_id) && user.provider_id.present? && user.provider_id == doi.client.consortium_id + return false if %w(consortium_admin).include?(user.role_id) && user.provider_id.present? && user.provider_id.upcase == doi.provider.consortium_id return false if %w(provider_admin provider_user).include?(user.role_id) && user.provider_id.present? && user.provider_id == doi.provider_id return false if %w(client_admin client_user user temporary).include?(user.role_id) && user.client_id.present? && user.client_id == doi.client_id return true diff --git a/spec/concerns/authenticable_spec.rb b/spec/concerns/authenticable_spec.rb index 1f9c65fbc..15a78574a 100644 --- a/spec/concerns/authenticable_spec.rb +++ b/spec/concerns/authenticable_spec.rb @@ -145,7 +145,7 @@ context "draft doi" do let(:consortium) { create(:provider, symbol: "DC", role_name: "ROLE_CONSORTIUM") } - let(:provider) { create(:provider, symbol: "DATACITE", role_name: "ROLE_CONSORTIUM_ORGANIZATION") } + let(:provider) { create(:provider, symbol: "DATACITE", consortium: consortium, role_name: "ROLE_CONSORTIUM_ORGANIZATION") } let(:client) { create(:client, provider: provider, symbol: "DATACITE.RPH") } let(:doi) { create(:doi, client: client) }