From 0bd19efe79d83ecbf31d6f3208362fa15950c9cd Mon Sep 17 00:00:00 2001 From: Giovanni Pellerano Date: Sat, 23 Nov 2024 14:15:16 +0100 Subject: [PATCH] Perform database changes review to support integration of #4330 Changes: - Add 'forwarding' enabler variable to enable/disable forwarding module at site level (default false) - Renamed 'eo_internaltip_id' to 'forwarding_internaltip_id' considering future possible exention of the the functionality to enable to forward reports both to other sites regardless they are external or affiliated --- backend/globaleaks/models/__init__.py | 6 +++--- backend/globaleaks/models/config_desc.py | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/globaleaks/models/__init__.py b/backend/globaleaks/models/__init__.py index d0864af079..66d89f93dd 100644 --- a/backend/globaleaks/models/__init__.py +++ b/backend/globaleaks/models/__init__.py @@ -601,7 +601,7 @@ class _ContentForwarding(Model): id = Column(UnicodeText(36), primary_key=True, default=uuid4) internaltip_forwarding_id = Column(UnicodeText(36), nullable=False, index=True) content_id = Column(UnicodeText(36), nullable=False, index=True) - eo_content_id = Column(UnicodeText(36), nullable=False, index=True) + forwarding_content_id = Column(UnicodeText(36), nullable=False, index=True) content_origin = Column(Enum(EnumContentForwarding), default='receiver_file', nullable=False) author_type = Column(Enum(EnumAuthorType), default='main', nullable=False) @@ -999,7 +999,7 @@ class _InternalTipForwarding(Model): __tablename__ = 'internaltip_forwarding' id = Column(UnicodeText(36), primary_key=True, default=uuid4) internaltip_id = Column(UnicodeText(36), nullable=False, index=True) - eo_internaltip_id = Column(UnicodeText(36), nullable=False, index=True) + forwarding_internaltip_id = Column(UnicodeText(36), nullable=False, index=True) tid = Column(Integer, default=1, nullable=False) creation_date = Column(DateTime, default=datetime_now, nullable=False) update_date = Column(DateTime, default=datetime_now, nullable=False) @@ -1020,7 +1020,7 @@ def __table_args__(self): initially='DEFERRED' ), ForeignKeyConstraint( - ['eo_internaltip_id'], + ['forwarding_internaltip_id'], ['internaltip.id'], ondelete='CASCADE', deferrable=True, diff --git a/backend/globaleaks/models/config_desc.py b/backend/globaleaks/models/config_desc.py index 9466257042..74f585f322 100644 --- a/backend/globaleaks/models/config_desc.py +++ b/backend/globaleaks/models/config_desc.py @@ -57,6 +57,7 @@ class Bool(Item): 'enable_signup': Bool(default=False), 'encryption': Bool(default=True), 'escrow': Bool(default=False), + 'forwarding': Bool(default=False), 'hostname': Unicode(default=''), 'https_admin': Bool(default=True), 'https_accreditor': Bool(default=True),