From caea65165c5443252763b1efaf60210b6f59f1cd Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Tue, 29 Aug 2017 15:14:18 +0100 Subject: [PATCH] Allow Notify service to send international sms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Right now Notify restricts you to registering with a UK mobile number. This is because when we built the user registration stuff we couldn’t send to international mobiles. However we can send to international mobile numbers, and it’s totally reasonable to expect employees of the UK government to be working abroad, and have a foreign mobile phone – we’ve heard from one such user. In order for users of Notify to register with an international phone number, the Notify service needs to have the `international_sms` permission set. Which this service does, as a data migration. --- .../versions/0117_international_sms_notify.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 migrations/versions/0117_international_sms_notify.py diff --git a/migrations/versions/0117_international_sms_notify.py b/migrations/versions/0117_international_sms_notify.py new file mode 100644 index 000000000..5168e1f9c --- /dev/null +++ b/migrations/versions/0117_international_sms_notify.py @@ -0,0 +1,33 @@ +"""empty message + +Revision ID: 0117_international_sms_notify +Revises: 0116_another_letter_org +Create Date: 2017-08-29 14:09:41.042061 + +""" + +# revision identifiers, used by Alembic. +revision = '0117_international_sms_notify' +down_revision = '0116_another_letter_org' + +from alembic import op +from datetime import datetime + + +NOTIFY_SERVICE_ID = 'd6aa2c68-a2d9-4437-ab19-3ae8eb202553' + + +def upgrade(): + op.execute(""" + INSERT INTO service_permissions VALUES + ('{}', 'international_sms', '{}') + """.format(NOTIFY_SERVICE_ID, datetime.utcnow())) + + +def downgrade(): + op.execute(""" + DELETE FROM service_permissions + WHERE + service_id = '{}' AND + permission = 'international_sms' + """.format(NOTIFY_SERVICE_ID))