Skip to content

Commit

Permalink
Perform database changes review to support integration of #4328
Browse files Browse the repository at this point in the history
Changes:
- replace 'is_pec' variable with 'use_secondary_smtp' to perform international abstraction of 'pec' using just the concept of smtp
- replace 'fiscal_code' variables 'tax_code' convention used in the software as international level
- remove 'sharing_id' addition redundant considering existing subscriber.tid equals tenant.id as unique reference
- add 'smtp2_enabled' to make it possible to enable/disable the smtp2 configuration
- add missing variables recipient_* on signup table planned to host name for a subscriber
- uniform variables for subscriber user (used to instantiate the admin) and the new recipient variables
  • Loading branch information
evilaliv3 committed Nov 23, 2024
1 parent 0fee1ab commit ec934a8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
29 changes: 15 additions & 14 deletions backend/globaleaks/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,10 +728,10 @@ class _Mail(Model):
address = Column(UnicodeText, nullable=False)
subject = Column(UnicodeText, nullable=False)
body = Column(UnicodeText, nullable=False)
is_pec = Column(Boolean, nullable=False, default=False)
secondary_smtp = Column(Boolean, nullable=False, default=False)

unicode_keys = ['address', 'subject', 'body']
bool_keys = ['is_pec']
bool_keys = ['secondary_smtp']

@declared_attr
def __table_args__(self):
Expand Down Expand Up @@ -932,10 +932,12 @@ class _Subscriber(Model):
tid = Column(Integer, primary_key=True)
subdomain = Column(UnicodeText, unique=True, nullable=False)
language = Column(UnicodeText(12), nullable=False)
user_id = Column(UnicodeText, default='', nullable=False)
name = Column(UnicodeText, nullable=False)
surname = Column(UnicodeText, nullable=False)
phone = Column(UnicodeText, default='', nullable=False)
email = Column(UnicodeText, nullable=False)
tax_code = Column(UnicodeText, nullable=True)
organization_name = Column(UnicodeText, default='', nullable=False, unique=True)
organization_tax_code = Column(UnicodeText, unique=True, nullable=True)
organization_vat_code = Column(UnicodeText, unique=True, nullable=True)
Expand All @@ -951,20 +953,19 @@ class _Subscriber(Model):
organization_email = Column(UnicodeText, nullable=True)
organization_institutional_site = Column(UnicodeText, default='', nullable=False)
accreditation_date = Column(DateTime, nullable=True)
admin_name = Column(UnicodeText, nullable=True)
admin_surname = Column(UnicodeText, nullable=True)
admin_email = Column(UnicodeText, nullable=True)
admin_fiscal_code = Column(UnicodeText, nullable=True)
recipient_fiscal_code = Column(UnicodeText, nullable=True)
sharing_id = Column(UnicodeText(36), nullable=False, default=uuid4)

unicode_keys = ['subdomain', 'language', 'name', 'surname', 'phone', 'email',
recipient_user_id = Column(UnicodeText, default='', nullable=False)
recipient_name = Column(UnicodeText, nullable=True)
recipient_surname = Column(UnicodeText, nullable=True)
recipient_email = Column(UnicodeText, nullable=True)
recipient_tax_code = Column(UnicodeText, nullable=True)

unicode_keys = ['subdomain', 'language', 'phone',
'organization_name', 'organization_tax_code',
'organization_vat_code', 'organization_location',
'client_ip_address', 'client_user_agent', 'state', 'organization_email',
'organization_institutional_site', 'admin_name', 'admin_surname', 'admin_email',
'admin_fiscal_code', 'recipient_name', 'recipient_surname', 'recipient_email',
'recipient_fiscal_code', 'sharing_id']
'organization_email', 'organization_site',
'client_ip_address', 'client_user_agent', 'state',
'user_id', 'name', 'surname', 'email', 'tax_code',
'recipient_user_id', 'recipient_name', 'recipient_surname', 'recipient_email', 'recipient_tax_code']

bool_keys = ['tos1', 'tos2']

Expand Down
1 change: 1 addition & 0 deletions backend/globaleaks/models/config_desc.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class Bool(Item):
'smtp_server': Unicode(default='mail.globaleaks.org'),
'smtp_source_email': Unicode(default='[email protected]'),
'smtp_username': Unicode(default='globaleaks'),
'smtp2_enabled': Bool(default=False),
'smtp2_password': Unicode(default=''),
'smtp2_port': Int(default=587),
'smtp2_security': Unicode(default=''),
Expand Down

0 comments on commit ec934a8

Please sign in to comment.