def register_blueprint(application): from app.service.rest import service_blueprint from app.service.callback_rest import service_callback_blueprint from app.user.rest import user_blueprint from app.template.rest import template_blueprint from app.support.support import support as support_blueprint from app.status.healthcheck import status as status_blueprint from app.job.rest import job_blueprint from app.notifications.rest import notifications as notifications_blueprint from app.invite.rest import invite as invite_blueprint from app.accept_invite.rest import accept_invite from app.template_statistics.rest import template_statistics as template_statistics_blueprint from app.events.rest import events as events_blueprint from app.provider_details.rest import provider_details as provider_details_blueprint from app.email_branding.rest import email_branding_blueprint from app.dvla_organisation.rest import dvla_organisation_blueprint from app.delivery.rest import delivery_blueprint from app.inbound_number.rest import inbound_number_blueprint from app.inbound_sms.rest import inbound_sms as inbound_sms_blueprint from app.notifications.receive_notifications import receive_notifications_blueprint from app.notifications.notifications_ses_callback import ses_callback_blueprint from app.notifications.notifications_sms_callback import sms_callback_blueprint from app.notifications.notifications_letter_callback import letter_callback_blueprint from app.authentication.auth import requires_admin_auth, requires_auth, requires_no_auth from app.letters.rest import letter_job from app.billing.rest import billing_blueprint from app.organisation.rest import organisation_blueprint from app.organisation.invite_rest import organisation_invite_blueprint from app.complaint.complaint_rest import complaint_blueprint from app.platform_stats.rest import platform_stats_blueprint service_blueprint.before_request(requires_admin_auth) application.register_blueprint(service_blueprint, url_prefix='/service') user_blueprint.before_request(requires_admin_auth) application.register_blueprint(user_blueprint, url_prefix='/user') template_blueprint.before_request(requires_admin_auth) application.register_blueprint(template_blueprint) support_blueprint.before_request(requires_no_auth) application.register_blueprint(support_blueprint) status_blueprint.before_request(requires_no_auth) application.register_blueprint(status_blueprint) # delivery receipts ses_callback_blueprint.before_request(requires_no_auth) application.register_blueprint(ses_callback_blueprint) # TODO: make sure research mode can still trigger sms callbacks, then re-enable this sms_callback_blueprint.before_request(requires_no_auth) application.register_blueprint(sms_callback_blueprint) # inbound sms receive_notifications_blueprint.before_request(requires_no_auth) application.register_blueprint(receive_notifications_blueprint) notifications_blueprint.before_request(requires_auth) application.register_blueprint(notifications_blueprint) job_blueprint.before_request(requires_admin_auth) application.register_blueprint(job_blueprint) invite_blueprint.before_request(requires_admin_auth) application.register_blueprint(invite_blueprint) delivery_blueprint.before_request(requires_admin_auth) application.register_blueprint(delivery_blueprint) inbound_number_blueprint.before_request(requires_admin_auth) application.register_blueprint(inbound_number_blueprint) inbound_sms_blueprint.before_request(requires_admin_auth) application.register_blueprint(inbound_sms_blueprint) accept_invite.before_request(requires_admin_auth) application.register_blueprint(accept_invite, url_prefix='/invite') template_statistics_blueprint.before_request(requires_admin_auth) application.register_blueprint(template_statistics_blueprint) events_blueprint.before_request(requires_admin_auth) application.register_blueprint(events_blueprint) provider_details_blueprint.before_request(requires_admin_auth) application.register_blueprint(provider_details_blueprint, url_prefix='/provider-details') email_branding_blueprint.before_request(requires_admin_auth) application.register_blueprint(email_branding_blueprint, url_prefix='/email-branding') dvla_organisation_blueprint.before_request(requires_admin_auth) application.register_blueprint(dvla_organisation_blueprint, url_prefix='/dvla_organisations') letter_job.before_request(requires_admin_auth) application.register_blueprint(letter_job) letter_callback_blueprint.before_request(requires_no_auth) application.register_blueprint(letter_callback_blueprint) billing_blueprint.before_request(requires_admin_auth) application.register_blueprint(billing_blueprint) service_callback_blueprint.before_request(requires_admin_auth) application.register_blueprint(service_callback_blueprint) organisation_blueprint.before_request(requires_admin_auth) application.register_blueprint(organisation_blueprint, url_prefix='/organisations') organisation_invite_blueprint.before_request(requires_admin_auth) application.register_blueprint(organisation_invite_blueprint) complaint_blueprint.before_request(requires_admin_auth) application.register_blueprint(complaint_blueprint) platform_stats_blueprint.before_request(requires_admin_auth) application.register_blueprint(platform_stats_blueprint, url_prefix='/platform-stats')
def register_blueprint(application): from app.authentication.auth import ( requires_admin_auth, requires_auth, requires_no_auth, ) from app.billing.rest import billing_blueprint from app.broadcast_message.rest import broadcast_message_blueprint from app.complaint.complaint_rest import complaint_blueprint from app.email_branding.rest import email_branding_blueprint from app.events.rest import events as events_blueprint from app.inbound_number.rest import inbound_number_blueprint from app.inbound_sms.rest import inbound_sms as inbound_sms_blueprint from app.job.rest import job_blueprint from app.letter_branding.letter_branding_rest import ( letter_branding_blueprint, ) from app.letters.rest import letter_job from app.notifications.notifications_letter_callback import ( letter_callback_blueprint, ) from app.notifications.notifications_sms_callback import ( sms_callback_blueprint, ) from app.notifications.receive_notifications import ( receive_notifications_blueprint, ) from app.notifications.rest import notifications as notifications_blueprint from app.organisation.invite_rest import organisation_invite_blueprint from app.organisation.rest import organisation_blueprint from app.performance_dashboard.rest import performance_dashboard_blueprint from app.platform_stats.rest import platform_stats_blueprint from app.provider_details.rest import ( provider_details as provider_details_blueprint, ) from app.service.callback_rest import service_callback_blueprint from app.service.rest import service_blueprint from app.service_invite.rest import ( service_invite as service_invite_blueprint, ) from app.status.healthcheck import status as status_blueprint from app.template.rest import template_blueprint from app.template_folder.rest import template_folder_blueprint from app.template_statistics.rest import ( template_statistics as template_statistics_blueprint, ) from app.upload.rest import upload_blueprint from app.user.rest import user_blueprint service_blueprint.before_request(requires_admin_auth) application.register_blueprint(service_blueprint, url_prefix='/service') user_blueprint.before_request(requires_admin_auth) application.register_blueprint(user_blueprint, url_prefix='/user') template_blueprint.before_request(requires_admin_auth) application.register_blueprint(template_blueprint) status_blueprint.before_request(requires_no_auth) application.register_blueprint(status_blueprint) # delivery receipts # TODO: make sure research mode can still trigger sms callbacks, then re-enable this sms_callback_blueprint.before_request(requires_no_auth) application.register_blueprint(sms_callback_blueprint) # inbound sms receive_notifications_blueprint.before_request(requires_no_auth) application.register_blueprint(receive_notifications_blueprint) notifications_blueprint.before_request(requires_auth) application.register_blueprint(notifications_blueprint) job_blueprint.before_request(requires_admin_auth) application.register_blueprint(job_blueprint) service_invite_blueprint.before_request(requires_admin_auth) application.register_blueprint(service_invite_blueprint) organisation_invite_blueprint.before_request(requires_admin_auth) application.register_blueprint(organisation_invite_blueprint) inbound_number_blueprint.before_request(requires_admin_auth) application.register_blueprint(inbound_number_blueprint) inbound_sms_blueprint.before_request(requires_admin_auth) application.register_blueprint(inbound_sms_blueprint) template_statistics_blueprint.before_request(requires_admin_auth) application.register_blueprint(template_statistics_blueprint) events_blueprint.before_request(requires_admin_auth) application.register_blueprint(events_blueprint) provider_details_blueprint.before_request(requires_admin_auth) application.register_blueprint(provider_details_blueprint, url_prefix='/provider-details') email_branding_blueprint.before_request(requires_admin_auth) application.register_blueprint(email_branding_blueprint, url_prefix='/email-branding') letter_job.before_request(requires_admin_auth) application.register_blueprint(letter_job) letter_callback_blueprint.before_request(requires_no_auth) application.register_blueprint(letter_callback_blueprint) billing_blueprint.before_request(requires_admin_auth) application.register_blueprint(billing_blueprint) service_callback_blueprint.before_request(requires_admin_auth) application.register_blueprint(service_callback_blueprint) organisation_blueprint.before_request(requires_admin_auth) application.register_blueprint(organisation_blueprint, url_prefix='/organisations') complaint_blueprint.before_request(requires_admin_auth) application.register_blueprint(complaint_blueprint) performance_dashboard_blueprint.before_request(requires_admin_auth) application.register_blueprint(performance_dashboard_blueprint) platform_stats_blueprint.before_request(requires_admin_auth) application.register_blueprint(platform_stats_blueprint, url_prefix='/platform-stats') template_folder_blueprint.before_request(requires_admin_auth) application.register_blueprint(template_folder_blueprint) letter_branding_blueprint.before_request(requires_admin_auth) application.register_blueprint(letter_branding_blueprint) upload_blueprint.before_request(requires_admin_auth) application.register_blueprint(upload_blueprint) broadcast_message_blueprint.before_request(requires_admin_auth) application.register_blueprint(broadcast_message_blueprint)