mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
remove components related to MOU and agreement (#476)
Co-authored-by: Kenneth Kehl <@kkehl@flexion.us>
This commit is contained in:
@@ -5,7 +5,6 @@ no_cookie = Blueprint('no_cookie', __name__)
|
||||
|
||||
from app.main.views import ( # noqa isort:skip
|
||||
add_service,
|
||||
agreement,
|
||||
api_keys,
|
||||
choose_account,
|
||||
code_not_received,
|
||||
|
||||
@@ -1145,25 +1145,6 @@ class OrganisationOrganisationTypeForm(StripWhitespaceForm):
|
||||
organisation_type = OrganisationTypeField('What type of organization is this?')
|
||||
|
||||
|
||||
class OrganisationAgreementSignedForm(StripWhitespaceForm):
|
||||
agreement_signed = GovukRadiosField(
|
||||
'Has this organization signed the agreement?',
|
||||
choices=[
|
||||
('yes', 'Yes'),
|
||||
('no', 'No'),
|
||||
('unknown', 'No (but we have some service-specific agreements in place)'),
|
||||
],
|
||||
thing='whether this organization has signed the agreement',
|
||||
param_extensions={
|
||||
'items': [
|
||||
{'hint': {'html': 'Users will be told their organization has already signed the agreement'}},
|
||||
{'hint': {'html': 'Users will be prompted to sign the agreement before they can go live'}},
|
||||
{'hint': {'html': 'Users will not be prompted to sign the agreement'}}
|
||||
]
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
class AdminOrganisationDomainsForm(StripWhitespaceForm):
|
||||
|
||||
def populate(self, domains_list):
|
||||
@@ -2094,70 +2075,6 @@ class AdminOrganisationGoLiveNotesForm(StripWhitespaceForm):
|
||||
)
|
||||
|
||||
|
||||
class AcceptAgreementForm(StripWhitespaceForm):
|
||||
|
||||
@classmethod
|
||||
def from_organisation(cls, org):
|
||||
|
||||
if org.agreement_signed_on_behalf_of_name and org.agreement_signed_on_behalf_of_email_address:
|
||||
who = 'someone-else'
|
||||
elif org.agreement_signed_version: # only set if user has submitted form previously
|
||||
who = 'me'
|
||||
else:
|
||||
who = None
|
||||
|
||||
return cls(
|
||||
version=org.agreement_signed_version,
|
||||
who=who,
|
||||
on_behalf_of_name=org.agreement_signed_on_behalf_of_name,
|
||||
on_behalf_of_email=org.agreement_signed_on_behalf_of_email_address,
|
||||
)
|
||||
|
||||
version = GovukTextInputField(
|
||||
'Which version of the agreement do you want to accept?'
|
||||
)
|
||||
|
||||
who = RadioField(
|
||||
'Who are you accepting the agreement for?',
|
||||
choices=(
|
||||
(
|
||||
'me',
|
||||
'Yourself',
|
||||
),
|
||||
(
|
||||
'someone-else',
|
||||
'Someone else',
|
||||
),
|
||||
),
|
||||
)
|
||||
|
||||
on_behalf_of_name = GovukTextInputField(
|
||||
'What’s their name?'
|
||||
)
|
||||
|
||||
on_behalf_of_email = email_address(
|
||||
'What’s their email address?',
|
||||
required=False,
|
||||
gov_user=False,
|
||||
)
|
||||
|
||||
def __validate_if_nominating(self, field):
|
||||
if self.who.data == 'someone-else':
|
||||
if not field.data:
|
||||
raise ValidationError('Cannot be empty')
|
||||
else:
|
||||
field.data = ''
|
||||
|
||||
validate_on_behalf_of_name = __validate_if_nominating
|
||||
validate_on_behalf_of_email = __validate_if_nominating
|
||||
|
||||
def validate_version(self, field):
|
||||
try:
|
||||
float(field.data)
|
||||
except (TypeError, ValueError):
|
||||
raise ValidationError("Must be a number")
|
||||
|
||||
|
||||
class ChangeSecurityKeyNameForm(StripWhitespaceForm):
|
||||
security_key_name = GovukTextInputField(
|
||||
'Name of key',
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
from datetime import datetime
|
||||
|
||||
from flask import abort, redirect, render_template, request, send_file, url_for
|
||||
from flask_login import current_user
|
||||
|
||||
from app import current_service
|
||||
from app.main import main
|
||||
from app.main.forms import AcceptAgreementForm
|
||||
from app.models.organisation import Organisation
|
||||
from app.s3_client.s3_mou_client import get_mou
|
||||
from app.utils.user import user_has_permissions
|
||||
|
||||
|
||||
@main.route('/services/<uuid:service_id>/agreement')
|
||||
@user_has_permissions('manage_service')
|
||||
def service_agreement(service_id):
|
||||
if not current_service.organisation:
|
||||
if current_service.organisation_type == Organisation.TYPE_NHS_GP:
|
||||
return redirect(
|
||||
url_for('main.add_organisation_from_gp_service', service_id=current_service.id)
|
||||
)
|
||||
if current_service.organisation_type == Organisation.TYPE_NHS_LOCAL:
|
||||
return redirect(
|
||||
url_for('main.add_organisation_from_nhs_local_service', service_id=current_service.id)
|
||||
)
|
||||
if current_service.organisation.agreement_signed:
|
||||
return render_template('views/agreement/service-agreement-signed.html')
|
||||
return render_template('views/agreement/service-agreement.html')
|
||||
|
||||
|
||||
@main.route('/services/<uuid:service_id>/agreement.pdf')
|
||||
@user_has_permissions('manage_service')
|
||||
def service_download_agreement(service_id):
|
||||
return send_file(**get_mou())
|
||||
|
||||
|
||||
@main.route('/services/<uuid:service_id>/agreement/accept', methods=['GET', 'POST'])
|
||||
@user_has_permissions('manage_service')
|
||||
def service_accept_agreement(service_id):
|
||||
|
||||
if not current_service.organisation:
|
||||
abort(404)
|
||||
|
||||
form = AcceptAgreementForm.from_organisation(current_service.organisation)
|
||||
|
||||
if form.validate_on_submit():
|
||||
current_service.organisation.update(
|
||||
agreement_signed_version=float(form.version.data),
|
||||
agreement_signed_on_behalf_of_name=form.on_behalf_of_name.data,
|
||||
agreement_signed_on_behalf_of_email_address=form.on_behalf_of_email.data,
|
||||
)
|
||||
return redirect(url_for('main.service_confirm_agreement', service_id=current_service.id))
|
||||
|
||||
return render_template(
|
||||
'views/agreement/agreement-accept.html',
|
||||
form=form,
|
||||
)
|
||||
|
||||
|
||||
@main.route('/services/<uuid:service_id>/agreement/confirm', methods=['GET', 'POST'])
|
||||
@user_has_permissions('manage_service')
|
||||
def service_confirm_agreement(service_id):
|
||||
|
||||
if (
|
||||
not current_service.organisation
|
||||
or current_service.organisation.agreement_signed_version is None
|
||||
):
|
||||
abort(403)
|
||||
|
||||
if request.method == 'POST':
|
||||
current_service.organisation.update(
|
||||
agreement_signed=True,
|
||||
agreement_signed_at=str(datetime.utcnow()),
|
||||
agreement_signed_by_id=current_user.id,
|
||||
)
|
||||
return redirect(url_for('main.request_to_go_live', service_id=current_service.id))
|
||||
|
||||
return render_template('views/agreement/agreement-confirm.html')
|
||||
|
||||
|
||||
@main.route('/agreement/<variant>', endpoint='public_agreement')
|
||||
@main.route('/agreement/<variant>.pdf', endpoint='public_download_agreement')
|
||||
def public_agreement(variant):
|
||||
# originally we returned 404 if variant was not in ['crown', 'not_crown']. Will we be using agreement.pdf?
|
||||
# for now this is just to keep tests working as expected.
|
||||
if variant != "agreement":
|
||||
abort(404)
|
||||
|
||||
if request.endpoint == 'main.public_download_agreement':
|
||||
return send_file(**get_mou())
|
||||
|
||||
return render_template(
|
||||
'views/agreement/agreement-public.html',
|
||||
owner=current_user.default_organisation.name,
|
||||
download_link=url_for('.public_download_agreement', variant=variant),
|
||||
)
|
||||
@@ -2,7 +2,7 @@ from collections import OrderedDict
|
||||
from datetime import datetime
|
||||
from functools import partial
|
||||
|
||||
from flask import flash, redirect, render_template, request, send_file, url_for
|
||||
from flask import flash, redirect, render_template, request, url_for
|
||||
from flask_login import current_user
|
||||
from notifications_python_client.errors import HTTPError
|
||||
|
||||
@@ -22,7 +22,6 @@ from app.main.forms import (
|
||||
AdminPreviewBrandingForm,
|
||||
AdminSetEmailBrandingForm,
|
||||
InviteOrgUserForm,
|
||||
OrganisationAgreementSignedForm,
|
||||
OrganisationOrganisationTypeForm,
|
||||
RenameOrganisationForm,
|
||||
SearchByNameForm,
|
||||
@@ -35,7 +34,6 @@ from app.main.views.dashboard import (
|
||||
from app.main.views.service_settings import get_branding_as_value_and_label
|
||||
from app.models.organisation import AllOrganisations, Organisation
|
||||
from app.models.user import InvitedOrgUser, User
|
||||
from app.s3_client.s3_mou_client import get_mou
|
||||
from app.utils.csv import Spreadsheet
|
||||
from app.utils.user import user_has_permissions, user_is_platform_admin
|
||||
|
||||
@@ -277,35 +275,6 @@ def edit_organisation_type(org_id):
|
||||
)
|
||||
|
||||
|
||||
@main.route("/organisations/<uuid:org_id>/settings/edit-agreement", methods=['GET', 'POST'])
|
||||
@user_is_platform_admin
|
||||
def edit_organisation_agreement(org_id):
|
||||
|
||||
form = OrganisationAgreementSignedForm(
|
||||
agreement_signed={
|
||||
True: 'yes',
|
||||
False: 'no',
|
||||
None: 'unknown',
|
||||
}.get(current_organisation.agreement_signed)
|
||||
)
|
||||
|
||||
if form.validate_on_submit():
|
||||
organisations_client.update_organisation(
|
||||
current_organisation.id,
|
||||
agreement_signed={
|
||||
'yes': True,
|
||||
'no': False,
|
||||
'unknown': None,
|
||||
}.get(form.agreement_signed.data),
|
||||
)
|
||||
return redirect(url_for('.organisation_settings', org_id=org_id))
|
||||
|
||||
return render_template(
|
||||
'views/organisations/organisation/settings/edit-agreement.html',
|
||||
form=form,
|
||||
)
|
||||
|
||||
|
||||
@main.route("/organisations/<uuid:org_id>/settings/set-email-branding", methods=['GET', 'POST'])
|
||||
@user_is_platform_admin
|
||||
def edit_organisation_email_branding(org_id):
|
||||
@@ -464,9 +433,3 @@ def organisation_billing(org_id):
|
||||
return render_template(
|
||||
'views/organisations/organisation/billing.html'
|
||||
)
|
||||
|
||||
|
||||
@main.route('/organisations/<uuid:org_id>/agreement.pdf')
|
||||
@user_is_platform_admin
|
||||
def organisation_download_agreement(org_id):
|
||||
return send_file(**get_mou())
|
||||
|
||||
Reference in New Issue
Block a user