From 9c72f4dec0d62b45672231e1a9ef3452075ba527 Mon Sep 17 00:00:00 2001 From: Son NK <> Date: Wed, 26 Aug 2020 14:39:03 +0200 Subject: [PATCH] Add Alias.disable_email_spoofing_check column --- .gitignore | 3 +- app/models.py | 7 +++++ .../versions/2020_082614_b82bcad9accf_.py | 29 +++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 migrations/versions/2020_082614_b82bcad9accf_.py diff --git a/.gitignore b/.gitignore index 8f5ee1e3..06cac594 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,5 @@ db.sqlite-journal static/upload adhoc_* adhoc.py -venv/ \ No newline at end of file +venv/ +.venv \ No newline at end of file diff --git a/app/models.py b/app/models.py index 48759460..7cabf2a7 100644 --- a/app/models.py +++ b/app/models.py @@ -808,6 +808,13 @@ class Alias(db.Model, ModelMixin): db.Boolean, nullable=False, default=False, server_default="0" ) + # when a mailbox wants to send an email on behalf of the alias via the reverse-alias + # several checks are performed to avoid email spoofing + # this option allow disabling these checks + disable_email_spoofing_check = db.Column( + db.Boolean, nullable=False, default=False, server_default="0" + ) + user = db.relationship(User) mailbox = db.relationship("Mailbox", lazy="joined") diff --git a/migrations/versions/2020_082614_b82bcad9accf_.py b/migrations/versions/2020_082614_b82bcad9accf_.py new file mode 100644 index 00000000..8ef66eac --- /dev/null +++ b/migrations/versions/2020_082614_b82bcad9accf_.py @@ -0,0 +1,29 @@ +"""empty message + +Revision ID: b82bcad9accf +Revises: 95938a93ea14 +Create Date: 2020-08-26 14:38:22.496570 + +""" +import sqlalchemy_utils +from alembic import op +import sqlalchemy as sa + + +# revision identifiers, used by Alembic. +revision = 'b82bcad9accf' +down_revision = '95938a93ea14' +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column('alias', sa.Column('disable_email_spoofing_check', sa.Boolean(), server_default='0', nullable=False)) + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column('alias', 'disable_email_spoofing_check') + # ### end Alembic commands ###