Skip to content

Commit 3c91249

Browse files
msmannan00evilaliv3
authored andcommitted
Implement database support for Redaction features (#3420, #3429)
1 parent 34c1a79 commit 3c91249

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

backend/globaleaks/models/__init__.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,23 @@ def __table_args__(self):
780780
return (ForeignKeyConstraint(['receiver_id'], ['user.id'], ondelete='CASCADE', deferrable=True, initially='DEFERRED'),
781781
ForeignKeyConstraint(['internaltip_id'], ['internaltip.id'], ondelete='CASCADE', deferrable=True, initially='DEFERRED'))
782782

783+
class _Redaction(Model):
784+
"""
785+
This models keep track of data redactions applied on internaltips and related objects
786+
"""
787+
__tablename__ = 'redaction'
788+
789+
id = Column(UnicodeText(36), primary_key=True, default=uuid4)
790+
update_date_date = Column(DateTime, default=datetime_now, nullable=False)
791+
reference_id = Column(UnicodeText(36), nullable=False, index=True)
792+
internaltip_id = Column(UnicodeText(36), nullable=False, index=True)
793+
temporary_redaction = Column(JSON, default=dict, nullable=False)
794+
permanent_redaction = Column(JSON, default=dict, nullable=False)
795+
796+
@declared_attr
797+
def __table_args__(self):
798+
return ForeignKeyConstraint(['internaltip_id'], ['internaltip.id'], ondelete='CASCADE', deferrable=True, initially='DEFERRED'),
799+
783800

784801
class _Subscriber(Model):
785802
__tablename__ = 'subscriber'
@@ -950,6 +967,8 @@ class _User(Model):
950967
can_postpone_expiration = Column(Boolean, default=True, nullable=False)
951968
can_grant_access_to_reports = Column(Boolean, default=False, nullable=False)
952969
can_transfer_access_to_reports = Column(Boolean, default=False, nullable=False)
970+
can_mask_information = Column(Boolean, default=False, nullable=False)
971+
can_redact_information = Column(Boolean, default=False, nullable=False)
953972
can_edit_general_settings = Column(Boolean, default=False, nullable=False)
954973
readonly = Column(Boolean, default=False, nullable=False)
955974
two_factor_secret = Column(UnicodeText(32), default='', nullable=False)
@@ -1124,6 +1143,10 @@ class ReceiverTip(_ReceiverTip, Base):
11241143
pass
11251144

11261145

1146+
class Redaction(_Redaction, Base):
1147+
pass
1148+
1149+
11271150
class Redirect(_Redirect, Base):
11281151
pass
11291152

0 commit comments

Comments
 (0)