From 04a643a777067b339b6945598f520529022c4737 Mon Sep 17 00:00:00 2001 From: Alexey Bezhan Date: Fri, 23 Mar 2018 16:43:40 +0000 Subject: [PATCH] Add a service permission for uploading documents to Document Download Service permission allows attaching a file to a notification API request that gets uploaded to Document Download API. --- app/models.py | 2 ++ .../versions/0182_add_upload_document_perm.py | 24 +++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 migrations/versions/0182_add_upload_document_perm.py diff --git a/app/models.py b/app/models.py index 81c654b5c..f64bad1b0 100644 --- a/app/models.py +++ b/app/models.py @@ -238,6 +238,7 @@ SCHEDULE_NOTIFICATIONS = 'schedule_notifications' EMAIL_AUTH = 'email_auth' LETTERS_AS_PDF = 'letters_as_pdf' PRECOMPILED_LETTER = 'precompiled_letter' +UPLOAD_DOCUMENT = 'upload_document' SERVICE_PERMISSION_TYPES = [ EMAIL_TYPE, @@ -249,6 +250,7 @@ SERVICE_PERMISSION_TYPES = [ EMAIL_AUTH, LETTERS_AS_PDF, PRECOMPILED_LETTER, + UPLOAD_DOCUMENT, ] diff --git a/migrations/versions/0182_add_upload_document_perm.py b/migrations/versions/0182_add_upload_document_perm.py new file mode 100644 index 000000000..a9b64377e --- /dev/null +++ b/migrations/versions/0182_add_upload_document_perm.py @@ -0,0 +1,24 @@ +"""empty message + +Revision ID: 0182_add_upload_document_perm +Revises: 0181_billing_primary_key +Create Date: 2018-03-23 16:20:00 + +""" + +# revision identifiers, used by Alembic. +revision = '0182_add_upload_document_perm' +down_revision = '0181_billing_primary_key' + +from alembic import op + + +def upgrade(): + op.get_bind() + op.execute("insert into service_permission_types values('upload_document')") + + +def downgrade(): + op.get_bind() + op.execute("delete from service_permissions where permission = 'upload_document'") + op.execute("delete from service_permission_types where name = 'upload_document'")