Browse Source

Update agreement template

CLDC-2322-read-and-sign-data-sharing-agreement
Jack S 2 years ago
parent
commit
c7830ef7a3
  1. 2
      app/controllers/organisations_controller.rb
  2. 28
      app/helpers/data_sharing_agreement_helper.rb
  3. 4
      app/models/organisation.rb
  4. 16
      app/views/organisations/data_sharing_agreement.html.erb
  5. 2
      spec/requests/organisations_controller_spec.rb
  6. 17
      spec/views/organisations/data_sharing_agreement.html.erb_spec.rb

2
app/controllers/organisations_controller.rb

@ -171,7 +171,7 @@ class OrganisationsController < ApplicationController
signed_at: Time.zone.now, signed_at: Time.zone.now,
data_protection_officer: current_user, data_protection_officer: current_user,
organisation_name: @organisation.name, organisation_name: @organisation.name,
organisation_address: @organisation.address_string, organisation_address: @organisation.address_row,
organisation_phone_number: @organisation.phone, organisation_phone_number: @organisation.phone,
dpo_email: current_user.email, dpo_email: current_user.email,
dpo_name: current_user.name, dpo_name: current_user.name,

28
app/helpers/data_sharing_agreement_helper.rb

@ -34,12 +34,36 @@ module DataSharingAgreementHelper
def org_name_for_data_sharing_agreement(data_sharing_agreement, user) def org_name_for_data_sharing_agreement(data_sharing_agreement, user)
if data_sharing_agreement.present? if data_sharing_agreement.present?
data_sharing_agreement.organisation_name data_sharing_agreement.organisation_name
elsif user.is_dpo? else
user.organisation.name user.organisation.name
end
end
# rubocop:disable Rails/HelperInstanceVariable
def section_12_2(data_sharing_agreement:, user:, organisation:)
if data_sharing_agreement
@org_address = data_sharing_agreement.organisation_address
@org_name = data_sharing_agreement.organisation_name
@org_phone = data_sharing_agreement.organisation_phone_number
@dpo_name = data_sharing_agreement.dpo_name
@dpo_email = data_sharing_agreement.dpo_email
else else
"[Data provider organisation]" @org_name = organisation.name
@org_address = organisation.address_row
@org_phone = organisation.phone
if user.is_dpo?
@dpo_name = user.name
@dpo_email = user.email
else
@dpo_name = "[DPO name]"
@dpo_email = "[DPO email]"
end
end end
"12.2. For #{@org_name}: Name: #{@dpo_name}, Postal Address: #{@org_address}, E-mail address: #{@dpo_email}, Telephone number: #{@org_phone}"
end end
# rubocop:enable Rails/HelperInstanceVariable
private private

4
app/models/organisation.rb

@ -75,6 +75,10 @@ class Organisation < ApplicationRecord
%i[address_line1 address_line2 postcode].map { |field| public_send(field) }.join("\n") %i[address_line1 address_line2 postcode].map { |field| public_send(field) }.join("\n")
end end
def address_row
%i[address_line1 address_line2 postcode].map { |field| public_send(field) }.join(", ")
end
def rent_periods def rent_periods
organisation_rent_periods.pluck(:rent_period) organisation_rent_periods.pluck(:rent_period)
end end

16
app/views/organisations/data_sharing_agreement.html.erb

@ -18,7 +18,7 @@
<% if @data_sharing_agreement %> <% if @data_sharing_agreement %>
<p class="govuk-body-m">1) <%= @data_sharing_agreement.organisation_name %> of <%= @data_sharing_agreement.organisation_address %> (“CORE Data Provider”)</p> <p class="govuk-body-m">1) <%= @data_sharing_agreement.organisation_name %> of <%= @data_sharing_agreement.organisation_address %> (“CORE Data Provider”)</p>
<% else %> <% else %>
<p class="govuk-body-m">1) [Data provider organisation] of [full address] (“CORE Data Provider”)</p> <p class="govuk-body-m">1) <%= @organisation.name %> of <%= @organisation.address_row %> (“CORE Data Provider”)</p>
<% end %> <% end %>
<p class="govuk-body-m">and</p> <p class="govuk-body-m">and</p>
<p class="govuk-body-m">2) The Department for Levelling Up, Housing and Communities of 2 Marsham Street, London, SW1P 4DF (“DLUHC”)</p> <p class="govuk-body-m">2) The Department for Levelling Up, Housing and Communities of 2 Marsham Street, London, SW1P 4DF (“DLUHC”)</p>
@ -105,13 +105,11 @@
<p class="govuk-body-m">11.2. CORE data providers and DLUHC acknowledge that any loss or unauthorised release of the Data can be treated as valid grounds for immediately terminating this agreement by DLUHC.</p> <p class="govuk-body-m">11.2. CORE data providers and DLUHC acknowledge that any loss or unauthorised release of the Data can be treated as valid grounds for immediately terminating this agreement by DLUHC.</p>
<h3 id="12-authorised-representatives" class="govuk-heading-m">12. Authorised representatives</h3> <h3 id="12-authorised-representatives" class="govuk-heading-m">12. Authorised representatives</h3>
<p class="govuk-body-m">12.1. CORE data providers and DLUHC will each appoint an Authorised Representative to be the primary point of contact in all day-to-day matters relating to this Agreement:</p> <p class="govuk-body-m">12.1. CORE data providers and DLUHC will each appoint an Authorised Representative to be the primary point of contact in all day-to-day matters relating to this Agreement:</p>
<% if @data_sharing_agreement %> <p class="govuk-body-m">
<p class="govuk-body-m">12.2. For <%= @data_sharing_agreement.organisation_name %>: Name: <%= @data_sharing_agreement.dpo_name %>, Postal Address: <%= @data_sharing_agreement.organisation_address %>, E-mail address: <%= @data_sharing_agreement.dpo_email %>, Telephone number: <%= @data_sharing_agreement.organisation_phone_number %></p> <%= section_12_2(data_sharing_agreement: @data_sharing_agreement, user: current_user, organisation: @organisation) %>
<% else %> </p>
<p class="govuk-body-m">12.2. For [Organisation name]: Name: [DPO name], Postal Address: [Organisation address], E-mail address: [DPO email], Telephone number: [Organisation telephone number]</p> <p class="govuk-body-m">12.3. For DLUHC: Name: Rachel Worledge,
<% end %> Postal Address: South-west section, 4th Floor, Fry Building, 2 Marsham Street, London, SW1P 4DF,
<p class="govuk-body-m">12.3. For DLUHC: Name: Rachel Worledge
Postal Address: South-west section, 4th Floor, Fry Building, 2 Marsham Street, London, SW1P 4DF
E-mail address: Rachel.Worledge@levellingup.gov.uk </p> E-mail address: Rachel.Worledge@levellingup.gov.uk </p>
<h3 id="13-products-and-publications" class="govuk-heading-m">13. Products and publications</h3> <h3 id="13-products-and-publications" class="govuk-heading-m">13. Products and publications</h3>
<p class="govuk-body-m">13.1. The Data potentially allows for persons to be identified, although the risk of this happening should be minimised by the steps taken in clause 9. CORE data providers should agree to carry out a thorough check of the Data and ensure that all steps are taken within its powers to minimise the risk that any outputs lead to identification of a person by a third party.</p> <p class="govuk-body-m">13.1. The Data potentially allows for persons to be identified, although the risk of this happening should be minimised by the steps taken in clause 9. CORE data providers should agree to carry out a thorough check of the Data and ensure that all steps are taken within its powers to minimise the risk that any outputs lead to identification of a person by a third party.</p>
@ -125,7 +123,7 @@
<h3 id="16-statutory-compliance" class="govuk-heading-m">16. Statutory compliance</h3> <h3 id="16-statutory-compliance" class="govuk-heading-m">16. Statutory compliance</h3>
<p class="govuk-body-m">16.1. The Parties shall comply with all relevant legislation, regulations, orders, statutory instruments and any amendments or re-enactments thereof from the commencement of this agreement.</p> <p class="govuk-body-m">16.1. The Parties shall comply with all relevant legislation, regulations, orders, statutory instruments and any amendments or re-enactments thereof from the commencement of this agreement.</p>
<p class="govuk-body-m">As witness of which the parties have set their hands on the day and year first above written <p class="govuk-body-m">As witness of which the parties have set their hands on the day and year first above written
signed for and on behalf of [job title of an officer with appropriate delegated authority] for <%= org_name_for_data_sharing_agreement(@data_sharing_agreement, current_user) %>, by:</p> signed for and on behalf of the Data Protection Officer for <%= org_name_for_data_sharing_agreement(@data_sharing_agreement, current_user) %>, by:</p>
<ul class="govuk-list govuk-list--bullet"> <ul class="govuk-list govuk-list--bullet">
<li>Name: <%= name_for_data_sharing_agreement(@data_sharing_agreement, current_user) %></li> <li>Name: <%= name_for_data_sharing_agreement(@data_sharing_agreement, current_user) %></li>
<li>Title: Data Protection Officer</li> <li>Title: Data Protection Officer</li>

2
spec/requests/organisations_controller_spec.rb

@ -1525,7 +1525,7 @@ RSpec.describe OrganisationsController, type: :request do
data_sharing_agreement = organisation.reload.data_sharing_agreement data_sharing_agreement = organisation.reload.data_sharing_agreement
expect(data_sharing_agreement.organisation_address).to eq(organisation.address_string) expect(data_sharing_agreement.organisation_address).to eq(organisation.address_row)
expect(data_sharing_agreement.organisation_name).to eq(organisation.name) expect(data_sharing_agreement.organisation_name).to eq(organisation.name)
expect(data_sharing_agreement.organisation_phone_number).to eq(organisation.phone) expect(data_sharing_agreement.organisation_phone_number).to eq(organisation.phone)
expect(data_sharing_agreement.data_protection_officer).to eq(user) expect(data_sharing_agreement.data_protection_officer).to eq(user)

17
spec/views/organisations/data_sharing_agreement.html.erb_spec.rb

@ -26,15 +26,14 @@ RSpec.describe "organisations/data_sharing_agreement.html.erb", :aggregate_failu
# dpo name # dpo name
expect(fragment).to have_content("Name: #{user.name}") expect(fragment).to have_content("Name: #{user.name}")
# org details # org details
expect(fragment).to have_content("[Data provider organisation] of [full address] (“CORE Data Provider”)") expect(fragment).to have_content("#{organisation.name} of #{organisation.address_row} (“CORE Data Provider”)")
# header # header
expect(fragment).to have_css("h2", text: "#{user.organisation.name} and Department for Levelling Up, Housing and Communities") expect(fragment).to have_css("h2", text: "#{organisation.name} and Department for Levelling Up, Housing and Communities")
# action buttons # action buttons
expect(fragment).to have_button(text: "Accept this agreement") expect(fragment).to have_button(text: "Accept this agreement")
expect(fragment).to have_link(text: "Cancel", href: "/organisations/#{organisation.id}/details") expect(fragment).to have_link(text: "Cancel", href: "/organisations/#{organisation.id}/details")
# Shows DPO and org details in 12.2
# Shows placeholder details in 12.2 expect(fragment).to have_content("12.2. For #{organisation.name}: Name: #{user.name}, Postal Address: #{organisation.address_row}, E-mail address: #{user.email}, Telephone number: #{organisation.phone}")
expect(fragment).to have_content("12.2. For [Organisation name]: Name: [DPO name], Postal Address: [Organisation address], E-mail address: [DPO email], Telephone number: [Organisation telephone number]")
end end
context "when accepted" do context "when accepted" do
@ -61,7 +60,7 @@ RSpec.describe "organisations/data_sharing_agreement.html.erb", :aggregate_failu
expect(fragment).not_to have_link(text: "Cancel", href: "/organisations/#{organisation.id}/details") expect(fragment).not_to have_link(text: "Cancel", href: "/organisations/#{organisation.id}/details")
# sees signed_at date # sees signed_at date
expect(fragment).to have_content("9th day of January 2023") expect(fragment).to have_content("9th day of January 2023")
# Shows filled in details in 12.2 # Shows DPO and org details in 12.2
expect(fragment).to have_content("12.2. For #{data_sharing_agreement.organisation_name}: Name: #{data_sharing_agreement.dpo_name}, Postal Address: #{data_sharing_agreement.organisation_address}, E-mail address: #{data_sharing_agreement.dpo_email}, Telephone number: #{data_sharing_agreement.organisation_phone_number}") expect(fragment).to have_content("12.2. For #{data_sharing_agreement.organisation_name}: Name: #{data_sharing_agreement.dpo_name}, Postal Address: #{data_sharing_agreement.organisation_address}, E-mail address: #{data_sharing_agreement.dpo_email}, Telephone number: #{data_sharing_agreement.organisation_phone_number}")
end end
end end
@ -77,14 +76,14 @@ RSpec.describe "organisations/data_sharing_agreement.html.erb", :aggregate_failu
# dpo name placedholder # dpo name placedholder
expect(fragment).to have_content("Name: [DPO name]") expect(fragment).to have_content("Name: [DPO name]")
# org details # org details
expect(fragment).to have_content("[Data provider organisation] of [full address] (“CORE Data Provider”)") expect(fragment).to have_content("#{organisation.name} of #{organisation.address_row} (“CORE Data Provider”)")
# header # header
expect(fragment).to have_css("h2", text: "[Data provider organisation] and Department for Levelling Up, Housing and Communities") expect(fragment).to have_css("h2", text: "#{organisation.name} and Department for Levelling Up, Housing and Communities")
# does not show action buttons # does not show action buttons
expect(fragment).not_to have_button(text: "Accept this agreement") expect(fragment).not_to have_button(text: "Accept this agreement")
expect(fragment).not_to have_link(text: "Cancel", href: "/organisations/#{organisation.id}/details") expect(fragment).not_to have_link(text: "Cancel", href: "/organisations/#{organisation.id}/details")
# Shows placeholder details in 12.2 # Shows placeholder details in 12.2
expect(fragment).to have_content("12.2. For [Organisation name]: Name: [DPO name], Postal Address: [Organisation address], E-mail address: [DPO email], Telephone number: [Organisation telephone number]") expect(fragment).to have_content("12.2. For #{organisation.name}: Name: [DPO name], Postal Address: #{organisation.address_row}, E-mail address: [DPO email], Telephone number: #{organisation.phone}")
end end
context "when accepted" do context "when accepted" do

Loading…
Cancel
Save