Skip to content

Commit

Permalink
Allow service owner to be identified by both IDs
Browse files Browse the repository at this point in the history
To facilitate the transition between the service owner being identified
by the old IATI reference `GB-GOV-13` and being identified by the new
IATI reference `GB-GOV-26`, allow both identifiers to be used.

This will prevent user permissions from being lost during the short
interval between the code being deployed and the migration being run.
  • Loading branch information
CristinaRO committed Jan 19, 2024
1 parent 8ba7b20 commit 761e660
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- Exclude health check requests from host authorisation
- Remove the feature flag for ODA bulk upload
- Change the transparency identifier and names for the DSIT organisations (DSIT and DSIT Finance)
- Allow service owner to be identified by both IDs during the transition between BEIS and DSIT

## Release 142 - 2024-01-16

Expand Down
2 changes: 1 addition & 1 deletion app/models/organisation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,6 @@ def is_reporter?
end

def self.service_owner
find_by(iati_reference: SERVICE_OWNER_IATI_REFERENCE)
find_by(iati_reference: ["GB-GOV-13", "GB-GOV-26"])
end
end
17 changes: 17 additions & 0 deletions spec/models/organisation_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,26 @@

describe ".service_owner" do
let!(:service_owner) { create(:beis_organisation) }

it "returns the service owner" do
expect(Organisation.service_owner).to eq(service_owner)
end

context "when the organisation's iati_reference is 'GB-GOV-13'" do
before { service_owner.update(iati_reference: "GB-GOV-13") }

it "identifies it as the service owner" do
expect(Organisation.service_owner).to eq(service_owner)
end
end

context "when the organisation's iati_reference is 'GB-GOV-26'" do
before { service_owner.update(iati_reference: "GB-GOV-26") }

it "identifies it as the service owner" do
expect(Organisation.service_owner).to eq(service_owner)
end
end
end

describe ".sorted_by_name" do
Expand Down

0 comments on commit 761e660

Please sign in to comment.