mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 07:46:23 -04:00
Rename other "Admin" forms consistently
I've also tweaked some of the names to make them clearer e.g. that the form is used to apply a change to a service. I've constrained the scope of this change to avoid forms that may be accessible by non-admins in the future.
This commit is contained in:
@@ -5,7 +5,7 @@ from notifications_python_client.errors import HTTPError
|
||||
from app import user_api_client
|
||||
from app.event_handlers import create_archive_user_event
|
||||
from app.main import main
|
||||
from app.main.forms import AuthTypeForm, SearchUsersByEmailForm
|
||||
from app.main.forms import AdminSearchUsersByEmailForm, AuthTypeForm
|
||||
from app.models.user import User
|
||||
from app.utils.user import user_is_platform_admin
|
||||
|
||||
@@ -13,7 +13,7 @@ from app.utils.user import user_is_platform_admin
|
||||
@main.route("/find-users-by-email", methods=['GET', 'POST'])
|
||||
@user_is_platform_admin
|
||||
def find_users_by_email():
|
||||
form = SearchUsersByEmailForm()
|
||||
form = AdminSearchUsersByEmailForm()
|
||||
users_found = None
|
||||
if form.validate_on_submit():
|
||||
users_found = user_api_client.find_users_by_full_or_partial_email(form.search.data)['data']
|
||||
|
||||
@@ -19,17 +19,17 @@ from app.main import main
|
||||
from app.main.forms import (
|
||||
AddGPOrganisationForm,
|
||||
AddNHSLocalOrganisationForm,
|
||||
AdminBillingDetailsForm,
|
||||
AdminNewOrganisationForm,
|
||||
AdminNotesForm,
|
||||
AdminOrganisationDomainsForm,
|
||||
AdminOrganisationGoLiveNotesForm,
|
||||
AdminPreviewBrandingForm,
|
||||
AdminSetEmailBrandingForm,
|
||||
AdminSetLetterBrandingForm,
|
||||
BillingDetailsForm,
|
||||
EditNotesForm,
|
||||
GoLiveNotesForm,
|
||||
InviteOrgUserForm,
|
||||
NewOrganisationForm,
|
||||
OrganisationAgreementSignedForm,
|
||||
OrganisationCrownStatusForm,
|
||||
OrganisationDomainsForm,
|
||||
OrganisationOrganisationTypeForm,
|
||||
RenameOrganisationForm,
|
||||
SearchByNameForm,
|
||||
@@ -60,7 +60,7 @@ def organisations():
|
||||
@main.route("/organisations/add", methods=['GET', 'POST'])
|
||||
@user_is_platform_admin
|
||||
def add_organisation():
|
||||
form = NewOrganisationForm()
|
||||
form = AdminNewOrganisationForm()
|
||||
|
||||
if form.validate_on_submit():
|
||||
try:
|
||||
@@ -495,7 +495,7 @@ def organisation_preview_letter_branding(org_id):
|
||||
@user_is_platform_admin
|
||||
def edit_organisation_domains(org_id):
|
||||
|
||||
form = OrganisationDomainsForm()
|
||||
form = AdminOrganisationDomainsForm()
|
||||
|
||||
if form.validate_on_submit():
|
||||
try:
|
||||
@@ -530,7 +530,7 @@ def edit_organisation_domains(org_id):
|
||||
@user_is_platform_admin
|
||||
def edit_organisation_go_live_notes(org_id):
|
||||
|
||||
form = GoLiveNotesForm()
|
||||
form = AdminOrganisationGoLiveNotesForm()
|
||||
|
||||
if form.validate_on_submit():
|
||||
organisations_client.update_organisation(
|
||||
@@ -551,7 +551,7 @@ def edit_organisation_go_live_notes(org_id):
|
||||
@main.route("/organisations/<uuid:org_id>/settings/notes", methods=['GET', 'POST'])
|
||||
@user_is_platform_admin
|
||||
def edit_organisation_notes(org_id):
|
||||
form = EditNotesForm(notes=current_organisation.notes)
|
||||
form = AdminNotesForm(notes=current_organisation.notes)
|
||||
|
||||
if form.validate_on_submit():
|
||||
|
||||
@@ -572,7 +572,7 @@ def edit_organisation_notes(org_id):
|
||||
@main.route("/organisations/<uuid:org_id>/settings/edit-billing-details", methods=['GET', 'POST'])
|
||||
@user_is_platform_admin
|
||||
def edit_organisation_billing_details(org_id):
|
||||
form = BillingDetailsForm(
|
||||
form = AdminBillingDetailsForm(
|
||||
billing_contact_email_addresses=current_organisation.billing_contact_email_addresses,
|
||||
billing_contact_names=current_organisation.billing_contact_names,
|
||||
billing_reference=current_organisation.billing_reference,
|
||||
|
||||
@@ -18,11 +18,11 @@ from app import (
|
||||
from app.extensions import redis_client
|
||||
from app.main import main
|
||||
from app.main.forms import (
|
||||
AdminClearCacheForm,
|
||||
AdminReturnedLettersForm,
|
||||
BillingReportDateFilterForm,
|
||||
ClearCacheForm,
|
||||
DateFilterForm,
|
||||
RequiredDateFilterForm,
|
||||
ReturnedLettersForm,
|
||||
)
|
||||
from app.statistics_utils import (
|
||||
get_formatted_percentage,
|
||||
@@ -341,7 +341,7 @@ def platform_admin_list_complaints():
|
||||
@main.route("/platform-admin/returned-letters", methods=["GET", "POST"])
|
||||
@user_is_platform_admin
|
||||
def platform_admin_returned_letters():
|
||||
form = ReturnedLettersForm()
|
||||
form = AdminReturnedLettersForm()
|
||||
|
||||
if form.validate_on_submit():
|
||||
references = [
|
||||
@@ -419,7 +419,7 @@ def clear_cache():
|
||||
]),
|
||||
])
|
||||
|
||||
form = ClearCacheForm()
|
||||
form = AdminClearCacheForm()
|
||||
|
||||
form.model_type.choices = [
|
||||
(key, key.replace('_', ' ').title()) for key in CACHE_KEYS
|
||||
|
||||
@@ -7,7 +7,7 @@ from werkzeug.utils import redirect
|
||||
|
||||
from app import format_date_numeric, provider_client
|
||||
from app.main import main
|
||||
from app.main.forms import ProviderForm, ProviderRatioForm
|
||||
from app.main.forms import AdminProviderForm, AdminProviderRatioForm
|
||||
from app.utils.user import user_is_platform_admin
|
||||
|
||||
PROVIDER_PRIORITY_MEANING_SWITCHOVER = datetime(2019, 11, 29, 11, 0).isoformat()
|
||||
@@ -48,7 +48,7 @@ def add_monthly_traffic(domestic_sms_providers):
|
||||
@user_is_platform_admin
|
||||
def edit_provider(provider_id):
|
||||
provider = provider_client.get_provider_by_id(provider_id)['provider_details']
|
||||
form = ProviderForm(active=provider['active'], priority=provider['priority'])
|
||||
form = AdminProviderForm(active=provider['active'], priority=provider['priority'])
|
||||
|
||||
if form.validate_on_submit():
|
||||
provider_client.update_provider(provider_id, form.priority.data)
|
||||
@@ -67,7 +67,7 @@ def edit_sms_provider_ratio():
|
||||
if provider['notification_type'] == 'sms'
|
||||
], key=itemgetter('identifier'), reverse=True)
|
||||
|
||||
form = ProviderRatioForm(ratio=providers[0]['priority'])
|
||||
form = AdminProviderRatioForm(ratio=providers[0]['priority'])
|
||||
|
||||
if len(providers) < 2:
|
||||
abort(400)
|
||||
|
||||
@@ -38,29 +38,29 @@ from app.extensions import zendesk_client
|
||||
from app.formatters import email_safe
|
||||
from app.main import main
|
||||
from app.main.forms import (
|
||||
AdminBillingDetailsForm,
|
||||
AdminNotesForm,
|
||||
AdminPreviewBrandingForm,
|
||||
AdminServiceAddDataRetentionForm,
|
||||
AdminServiceEditDataRetentionForm,
|
||||
AdminServiceInboundNumberForm,
|
||||
AdminServiceMessageLimitForm,
|
||||
AdminServiceRateLimitForm,
|
||||
AdminServiceSMSAllowanceForm,
|
||||
AdminSetEmailBrandingForm,
|
||||
AdminSetLetterBrandingForm,
|
||||
BillingDetailsForm,
|
||||
AdminSetOrganisationForm,
|
||||
ChooseBrandingForm,
|
||||
ChooseEmailBrandingForm,
|
||||
ChooseLetterBrandingForm,
|
||||
EditNotesForm,
|
||||
EstimateUsageForm,
|
||||
FreeSMSAllowance,
|
||||
LinkOrganisationsForm,
|
||||
MessageLimit,
|
||||
RateLimit,
|
||||
RenameServiceForm,
|
||||
SearchByNameForm,
|
||||
ServiceBroadcastAccountTypeForm,
|
||||
ServiceBroadcastChannelForm,
|
||||
ServiceBroadcastNetworkForm,
|
||||
ServiceContactDetailsForm,
|
||||
ServiceDataRetentionEditForm,
|
||||
ServiceDataRetentionForm,
|
||||
ServiceEditInboundNumberForm,
|
||||
ServiceInboundNumberForm,
|
||||
ServiceLetterContactBlockForm,
|
||||
ServiceOnOffSettingForm,
|
||||
ServiceReplyToEmailForm,
|
||||
@@ -650,7 +650,7 @@ def service_set_inbound_number(service_id):
|
||||
(number['id'], number['number']) for number in available_inbound_numbers['data']
|
||||
]
|
||||
no_available_numbers = available_inbound_numbers['data'] == []
|
||||
form = ServiceInboundNumberForm(
|
||||
form = AdminServiceInboundNumberForm(
|
||||
inbound_number_choices=inbound_numbers_value_and_label
|
||||
)
|
||||
|
||||
@@ -972,7 +972,7 @@ def service_delete_sms_sender(service_id, sms_sender_id):
|
||||
@user_is_platform_admin
|
||||
def set_free_sms_allowance(service_id):
|
||||
|
||||
form = FreeSMSAllowance(free_sms_allowance=current_service.free_sms_fragment_limit)
|
||||
form = AdminServiceSMSAllowanceForm(free_sms_allowance=current_service.free_sms_fragment_limit)
|
||||
|
||||
if form.validate_on_submit():
|
||||
billing_api_client.create_or_update_free_sms_fragment_limit(service_id, form.free_sms_allowance.data)
|
||||
@@ -989,7 +989,7 @@ def set_free_sms_allowance(service_id):
|
||||
@user_is_platform_admin
|
||||
def set_message_limit(service_id):
|
||||
|
||||
form = MessageLimit(message_limit=current_service.message_limit)
|
||||
form = AdminServiceMessageLimitForm(message_limit=current_service.message_limit)
|
||||
|
||||
if form.validate_on_submit():
|
||||
current_service.update(message_limit=form.message_limit.data)
|
||||
@@ -1006,7 +1006,7 @@ def set_message_limit(service_id):
|
||||
@user_is_platform_admin
|
||||
def set_rate_limit(service_id):
|
||||
|
||||
form = RateLimit(rate_limit=current_service.rate_limit)
|
||||
form = AdminServiceRateLimitForm(rate_limit=current_service.rate_limit)
|
||||
|
||||
if form.validate_on_submit():
|
||||
current_service.update(rate_limit=form.rate_limit.data)
|
||||
@@ -1115,7 +1115,7 @@ def link_service_to_organisation(service_id):
|
||||
|
||||
all_organisations = organisations_client.get_organisations()
|
||||
|
||||
form = LinkOrganisationsForm(
|
||||
form = AdminSetOrganisationForm(
|
||||
choices=convert_dictionary_to_wtforms_choices_format(all_organisations, 'id', 'name'),
|
||||
organisations=current_service.organisation_id
|
||||
)
|
||||
@@ -1313,7 +1313,7 @@ def data_retention(service_id):
|
||||
@main.route("/services/<uuid:service_id>/data-retention/add", methods=['GET', 'POST'])
|
||||
@user_is_platform_admin
|
||||
def add_data_retention(service_id):
|
||||
form = ServiceDataRetentionForm()
|
||||
form = AdminServiceAddDataRetentionForm()
|
||||
if form.validate_on_submit():
|
||||
service_api_client.create_service_data_retention(service_id,
|
||||
form.notification_type.data,
|
||||
@@ -1329,7 +1329,7 @@ def add_data_retention(service_id):
|
||||
@user_is_platform_admin
|
||||
def edit_data_retention(service_id, data_retention_id):
|
||||
data_retention_item = current_service.get_data_retention_item(data_retention_id)
|
||||
form = ServiceDataRetentionEditForm(days_of_retention=data_retention_item['days_of_retention'])
|
||||
form = AdminServiceEditDataRetentionForm(days_of_retention=data_retention_item['days_of_retention'])
|
||||
if form.validate_on_submit():
|
||||
service_api_client.update_service_data_retention(service_id, data_retention_id, form.days_of_retention.data)
|
||||
return redirect(url_for('.data_retention', service_id=service_id))
|
||||
@@ -1344,7 +1344,7 @@ def edit_data_retention(service_id, data_retention_id):
|
||||
@main.route("/services/<uuid:service_id>/notes", methods=['GET', 'POST'])
|
||||
@user_is_platform_admin
|
||||
def edit_service_notes(service_id):
|
||||
form = EditNotesForm(notes=current_service.notes)
|
||||
form = AdminNotesForm(notes=current_service.notes)
|
||||
|
||||
if form.validate_on_submit():
|
||||
|
||||
@@ -1365,7 +1365,7 @@ def edit_service_notes(service_id):
|
||||
@main.route("/services/<uuid:service_id>/edit-billing-details", methods=['GET', 'POST'])
|
||||
@user_is_platform_admin
|
||||
def edit_service_billing_details(service_id):
|
||||
form = BillingDetailsForm(
|
||||
form = AdminBillingDetailsForm(
|
||||
billing_contact_email_addresses=current_service.billing_contact_email_addresses,
|
||||
billing_contact_names=current_service.billing_contact_names,
|
||||
billing_reference=current_service.billing_reference,
|
||||
|
||||
Reference in New Issue
Block a user