Skip to content

Commit

Permalink
add ROLE_DEV. #731
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Apr 23, 2021
1 parent 1a7d88d commit 96449c6
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 19 deletions.
2 changes: 1 addition & 1 deletion app/controllers/members_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def show
def set_provider
@provider =
Provider.unscoped.where(
"allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM' , 'ROLE_CONSORTIUM_ORGANIZATION', 'ROLE_ALLOCATOR', 'ROLE_MEMBER', 'ROLE_REGISTRATION_AGENCY')",
"allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM' , 'ROLE_CONSORTIUM_ORGANIZATION', 'ROLE_ALLOCATOR', 'ROLE_MEMBER', 'ROLE_DEV')",
).
where(deleted_at: nil).
where(symbol: params[:id]).
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/organizations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def show
def set_provider
@provider =
Provider.unscoped.where(
"allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM' , 'ROLE_CONSORTIUM_ORGANIZATION', 'ROLE_ALLOCATOR', 'ROLE_ADMIN', 'ROLE_MEMBER', 'ROLE_REGISTRATION_AGENCY')",
"allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM' , 'ROLE_CONSORTIUM_ORGANIZATION', 'ROLE_ALLOCATOR', 'ROLE_ADMIN', 'ROLE_MEMBER', 'ROLE_DEV')",
).
where(deleted_at: nil).
where(symbol: params[:id]).
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ def set_include
def set_provider
@provider =
Provider.unscoped.where(
"allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM' , 'ROLE_CONSORTIUM_ORGANIZATION', 'ROLE_ALLOCATOR', 'ROLE_ADMIN', 'ROLE_MEMBER', 'ROLE_REGISTRATION_AGENCY')",
"allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM' , 'ROLE_CONSORTIUM_ORGANIZATION', 'ROLE_ALLOCATOR', 'ROLE_ADMIN', 'ROLE_MEMBER', 'ROLE_DEV')",
).
where(deleted_at: nil).
where(symbol: params[:id]).
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/v3/providers_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def set_include
def set_provider
@provider =
Provider.unscoped.where(
"allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM' , 'ROLE_CONSORTIUM_ORGANIZATION', 'ROLE_ALLOCATOR', 'ROLE_ADMIN', 'ROLE_MEMBER', 'ROLE_REGISTRATION_AGENCY')",
"allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM' , 'ROLE_CONSORTIUM_ORGANIZATION', 'ROLE_ALLOCATOR', 'ROLE_ADMIN', 'ROLE_MEMBER', 'ROLE_DEV')",
).
where(deleted_at: nil).
where(symbol: params[:id]).
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/query_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def members(**args)
end

def member(id:)
Provider.unscoped.where("allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM' , 'ROLE_CONSORTIUM_ORGANIZATION', 'ROLE_ALLOCATOR', 'ROLE_ADMIN', 'ROLE_MEMBER', 'ROLE_REGISTRATION_AGENCY')").where(deleted_at: nil).where(symbol: id).first
Provider.unscoped.where("allocator.role_name IN ('ROLE_FOR_PROFIT_PROVIDER', 'ROLE_CONTRACTUAL_PROVIDER', 'ROLE_CONSORTIUM' , 'ROLE_CONSORTIUM_ORGANIZATION', 'ROLE_ALLOCATOR', 'ROLE_ADMIN', 'ROLE_MEMBER', 'ROLE_DEV')").where(deleted_at: nil).where(symbol: id).first
end

field :me, MeType, null: true
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/authenticable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,13 @@ def decode_auth_param(username: nil, password: nil)
def get_payload(uid: nil, user: nil, password: nil)
roles = {
"ROLE_ADMIN" => "staff_admin",
"ROLE_DEV" => "staff_admin",
"ROLE_DATACENTRE" => "client_admin",
"ROLE_ALLOCATOR" => "provider_admin",
"ROLE_CONSORTIUM" => "consortium_admin",
"ROLE_CONSORTIUM_ORGANIZATION" => "provider_admin",
"ROLE_CONTRACTUAL_PROVIDER" => "provider_admin",
"ROLE_FOR_PROFIT_PROVIDER" => "provider_admin",
"ROLE_REGISTRATION_AGENCY" => "provider_admin",
}
payload = {
"uid" => uid,
Expand Down
6 changes: 2 additions & 4 deletions app/models/provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ class Provider < ApplicationRecord
ROLE_CONSORTIUM_ORGANIZATION
ROLE_ALLOCATOR
ROLE_MEMBER
ROLE_REGISTRATION_AGENCY
ROLE_ADMIN
ROLE_DEV
],
Expand Down Expand Up @@ -710,9 +709,8 @@ def member_type_labels
"ROLE_CONSORTIUM_ORGANIZATION" => "Consortium Organization",
"ROLE_CONTRACTUAL_PROVIDER" => "Contractual Member",
"ROLE_ADMIN" => "DataCite Admin",
"ROLE_DEV" => "DataCite Developer",
"ROLE_DEV" => "Developer",
"ROLE_FOR_PROFIT_PROVIDER" => "Direct Member",
"ROLE_REGISTRATION_AGENCY" => "DOI Registration Agency",
}
end

Expand All @@ -733,7 +731,7 @@ def member_types
"ROLE_CONSORTIUM_ORGANIZATION" => "consortium_organization",
"ROLE_CONTRACTUAL_PROVIDER" => "contractual_member",
"ROLE_FOR_PROFIT_PROVIDER" => "for-profit_provider",
"ROLE_REGISTRATION_AGENCY" => "registration_agency",
"ROLE_DEV" => "developer",
}
end

Expand Down
14 changes: 7 additions & 7 deletions spec/models/provider_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@
end
end

describe "provider with ROLE_REGISTRATION_AGENCY" do
describe "provider with ROLE_DEV" do
subject do
create(
:provider,
role_name: "ROLE_REGISTRATION_AGENCY",
name: "Crossref",
symbol: "CROSSREF",
role_name: "ROLE_DEV",
name: "Super Developer",
symbol: "SUPERDEV",
)
end

it "works" do
expect(subject.role_name).to eq("ROLE_REGISTRATION_AGENCY")
expect(subject.member_type).to eq("registration_agency")
expect(subject.member_type_label).to eq("DOI Registration Agency")
expect(subject.role_name).to eq("ROLE_DEV")
expect(subject.member_type).to eq("developer")
expect(subject.member_type_label).to eq("Developer")
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/requests/providers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@

describe "GET /providers/totals" do
let(:provider) { create(:provider) }
let(:ra) { create(:provider, role_name: "ROLE_REGISTRATION_AGENCY") }
let(:dev) { create(:provider, role_name: "ROLE_DEV") }
let(:client) { create(:client, provider: provider) }
let!(:prefixes) { create_list(:prefix, 10) }
let!(:dois) { create_list(:doi, 3, client: client, aasm_state: "findable") }
Expand Down
2 changes: 1 addition & 1 deletion spec/requests/v3/providers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@

describe "GET /v3/providers/totals" do
let(:provider) { create(:provider) }
let(:ra) { create(:provider, role_name: "ROLE_REGISTRATION_AGENCY") }
let(:dev) { create(:provider, role_name: "ROLE_DEV") }
let(:client) { create(:client, provider: provider) }
let!(:prefixes) { create_list(:prefix, 10) }
let!(:dois) { create_list(:doi, 3, client: client, aasm_state: "findable") }
Expand Down

0 comments on commit 96449c6

Please sign in to comment.