Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/profiles #4287

Open
wants to merge 15 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/globaleaks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
__version__ = '5.0.20'
__license__ = 'AGPL-3.0'

DATABASE_VERSION = 68
DATABASE_VERSION = 69
FIRST_DATABASE_VERSION_SUPPORTED = 52

# Add new languages as they are supported here! To do this retrieve the name of
Expand Down
106 changes: 84 additions & 22 deletions backend/globaleaks/db/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
import sys
import traceback
import warnings
from collections import defaultdict
from operator import or_

from globaleaks.handlers.admin.user import db_create_user_profile
from sqlalchemy.exc import SAWarning
from globaleaks.rest.cache import Cache

from globaleaks import models, DATABASE_VERSION
from globaleaks.handlers.admin.https import db_load_tls_configs
Expand Down Expand Up @@ -68,8 +72,10 @@ def initialize_db(session):
:param session: An ORM session
"""
from globaleaks.handlers.admin import tenant
tenant.db_create(session, {'active': True, 'mode': 'default', 'name': 'GLOBALEAKS', 'subdomain': ''})

roles = ['admin', 'receiver', 'analyst', 'custodian']
tenant.db_create(session, {'active': False, 'mode': 'default', 'profile_counter': 1000000, 'name': 'GLOBALEAKS', 'subdomain': ''},False)
tenant.db_create(session, {'active': True, 'mode': 'default', 'profile_counter': 1000000, 'name': 'GLOBALEAKS', 'subdomain': ''})
create_default_user_profiles(session, roles)

def update_db():
"""
Expand Down Expand Up @@ -107,6 +113,14 @@ def update_db():

return DATABASE_VERSION

def create_default_user_profiles(session, roles):
for role in roles:
user_desc = {
"name": role.capitalize(),
"role": role,
"language": "en",
}
db_create_user_profile(session, user_desc)

def db_get_tracked_files(session):
"""
Expand Down Expand Up @@ -156,8 +170,17 @@ def sync_initialize_snimap(session):
for cfg in db_load_tls_configs(session):
State.snimap.load(cfg['tid'], cfg)

def update_cache(cfg, tid):
tenant_cache = State.tenants[tid].cache
if cfg.var_name in ['https_cert', 'tor_onion_key'] or cfg.var_name in ConfigFilters['node']:
tenant_cache[cfg.var_name] = cfg.value
elif cfg.var_name in ConfigFilters['notification']:
tenant_cache.setdefault('notification', {})[cfg.var_name] = cfg.value
elif cfg.var_name in ConfigFilters['node']:
tenant_cache[cfg.var_name] = cfg.value

def db_refresh_tenant_cache(session, to_refresh=None):

active_tids = set([tid[0] for tid in session.query(models.Tenant.id).filter(models.Tenant.active.is_(True))])

cached_tids = set(State.tenants.keys())
Expand Down Expand Up @@ -187,7 +210,21 @@ def db_refresh_tenant_cache(session, to_refresh=None):
if to_refresh is None or to_refresh == 1:
tids = active_tids
else:
tids = [to_refresh] if to_refresh in active_tids else []
if to_refresh in active_tids:
tids = [to_refresh]
if to_refresh < 1000001:
default_profile_exists = session.query(Config).filter_by(tid=to_refresh, var_name='default_profile').first()
if default_profile_exists:
tids.append(default_profile_exists.tid)

elif to_refresh > 1000001:
matching_tids = [tid[0] for tid in session.query(Config.tid).filter_by(var_name='default_profile', value=str(to_refresh)).all()]
tids.extend(matching_tids)

for tid in matching_tids:
Cache.invalidate(tid)
else:
tids = []

if not tids:
return
Expand All @@ -214,27 +251,52 @@ def db_refresh_tenant_cache(session, to_refresh=None):
.filter(models.EnabledLanguage.tid.in_(tids)):
State.tenants[tid].cache['languages_enabled'].append(lang)

for cfg in session.query(Config).filter(Config.tid.in_(tids)):
tenant_cache = State.tenants[cfg.tid].cache

if cfg.var_name in ['https_cert', 'tor_onion_key']:
tenant_cache[cfg.var_name] = cfg.value
elif cfg.var_name in ConfigFilters['node']:
tenant_cache[cfg.var_name] = cfg.value
elif cfg.var_name in ConfigFilters['notification']:
tenant_cache['notification'][cfg.var_name] = cfg.value

for tid, mail, pub_key in session.query(models.User.tid, models.User.mail_address, models.User.pgp_key_public) \
.filter(models.User.role == 'admin',
models.User.enabled.is_(True),
models.User.notification.is_(True),
models.User.tid.in_(tids)):
configs = defaultdict(dict)
default_configs = {}

for cfg in session.query(Config).filter(or_(Config.tid.in_(tids), Config.tid == 1000001)):
if cfg.tid == 1000001:
default_configs[cfg.var_name] = cfg
else:
configs[cfg.tid][cfg.var_name] = cfg

for var_name, default_cfg in default_configs.items():
for tid, tenant in list(configs.items()):
if "default_profile" in tenant:
profile_id = int(tenant["default_profile"].value)
profile = configs[profile_id]
else:
profile_id = None
profile = None

if to_refresh == 1 or to_refresh is None or (to_refresh < 1000001 and to_refresh == tid) or (1000001 < to_refresh == profile_id) or (1000001 < to_refresh == tid):
if var_name in tenant:
update_cache(tenant[var_name], tid)
elif profile and var_name in profile:
update_cache(profile[var_name], tid)
elif tid:
update_cache(default_cfg, tid)
query = (session.query(models.User.tid,models.User.mail_address,models.User.pgp_key_public)
.join(models.UserProfile, models.User.profile_id == models.UserProfile.id)
.filter(
models.User.role == 'admin',
models.UserProfile.enabled.is_(True),
models.UserProfile.notification.is_(True),
models.User.tid.in_(tids)
))
results = query.all()

for tid, mail, pub_key in results:
State.tenants[tid].cache.notification.admin_list.extend([(mail, pub_key)])

for custodian in session.query(models.User) \
.filter(models.User.role == 'custodian',
models.User.enabled.is_(True),
models.User.tid.in_(tids)):
custodians = (session.query(models.User).join(models.UserProfile, models.User.profile_id == models.UserProfile.id)
.filter(
models.User.role == 'custodian',
models.UserProfile.enabled.is_(True),
models.User.tid.in_(tids)
))

for custodian in custodians:
State.tenants[custodian.tid].cache['custodian'] = True

for redirect in session.query(models.Redirect).filter(models.Redirect.tid.in_(tids)):
Expand Down
79 changes: 40 additions & 39 deletions backend/globaleaks/db/migration.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
from globaleaks.db.migrations.update_66 import SubmissionSubStatus_v_65
from globaleaks.db.migrations.update_67 import \
InternalTip_v_66, ReceiverFile_v_66, Redaction_v_66, User_v_66, WhistleblowerFile_v_66
from globaleaks.db.migrations.update_68 import Subscriber_v_67
from globaleaks.db.migrations.update_68 import Subscriber_v_67, User_v_67
from globaleaks.db.migrations.update_69 import Tenant_v_68


from globaleaks.orm import get_engine, get_session, make_db_uri
Expand All @@ -47,44 +48,44 @@


migration_mapping = OrderedDict([
('ArchivedSchema', [models._ArchivedSchema, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('AuditLog', [-1, -1, AuditLog_v_61, 0, 0, 0, 0, 0, 0, 0, models._AuditLog, 0, 0, 0, 0, 0, 0]),
('Comment', [Comment_v_64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, models._Comment, 0, 0, 0]),
('Config', [models._Config, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('ConfigL10N', [models._ConfigL10N, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('Context', [Context_v_61, 0, 0, 0, 0, 0, 0, 0, 0, 0, Context_v_63, 0, models._Context, 0, 0, 0, 0]),
('CustomTexts', [models._CustomTexts, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('EnabledLanguage', [models._EnabledLanguage, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('Field', [models._Field, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('FieldAttr', [FieldAttr_v_52, models._FieldAttr, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('FieldOption', [models._FieldOption, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('FieldOptionTriggerField', [models._FieldOptionTriggerField, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('FieldOptionTriggerStep', [models._FieldOptionTriggerStep, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('File', [File_v_53, 0, models._File, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('IdentityAccessRequest', [IdentityAccessRequest_v_64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, models._IdentityAccessRequest, 0, 0, 0]),
('IdentityAccessRequestCustodian', [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, models._IdentityAccessRequestCustodian, 0, 0, 0]),
('InternalFile', [InternalFile_v_64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, models._InternalFile, 0, 0, 0]),
('InternalTip', [InternalTip_v_52, InternalTip_v_57, 0, 0, 0, 0, InternalTip_v_59, 0, InternalTip_v_63, 0, 0, 0, InternalTip_v_64, InternalTip_v_66, 0, models._InternalTip, 0]),
('InternalTipAnswers', [models._InternalTipAnswers, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('InternalTipData', [models._InternalTipData, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('Mail', [models._Mail, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('Message', [Message_v_64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1]),
('Questionnaire', [models._Questionnaire, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('ReceiverContext', [models._ReceiverContext, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('ReceiverFile', [ReceiverFile_v_57, 0, 0, 0, 0, 0, ReceiverFile_v_64, 0, 0, 0, 0, 0, 0, ReceiverFile_v_66, 0, models._ReceiverFile, 0]),
('ReceiverTip', [ReceiverTip_v_52, ReceiverTip_v_57, 0, 0, 0, 0, ReceiverTip_v_58, ReceiverTip_v_59, ReceiverTip_v_61, 0, ReceiverTip_v_64, 0, 0, models._ReceiverTip, 0, 0, 0]),
('Redaction', [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, Redaction_v_66, 0, models._Redaction, 0]),
('Redirect', [models._Redirect, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('SubmissionStatus', [SubmissionStatus_v_64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, models._SubmissionStatus, 0, 0]),
('SubmissionSubStatus', [SubmissionSubStatus_v_64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, SubmissionSubStatus_v_65, 0, models._SubmissionSubStatus, 0]),
('SubmissionStatusChange', [SubmissionStatusChange_v_54, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]),
('Step', [models._Step, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('Subscriber', [Subscriber_v_52, Subscriber_v_62, 0, 0, 0, 0, 0, 0, 0, 0, 0, Subscriber_v_67, 0, 0, 0, 0, models._Subscriber]),
('Tenant', [Tenant_v_52, models._Tenant, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('User', [User_v_52, User_v_54, 0, User_v_56, 0, User_v_61, 0, 0, 0, 0, User_v_64, 0, 0, User_v_66, 0, models._User, 0]),
('WhistleblowerFile', [WhistleblowerFile_v_57, 0, 0, 0, 0, 0, WhistleblowerFile_v_64, 0, 0, 0, 0, 0, 0, WhistleblowerFile_v_66, 0, models._WhistleblowerFile, 0]),

('WhistleblowerTip', [WhistleblowerTip_v_59, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1])
('ArchivedSchema', [models._ArchivedSchema, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('AuditLog', [-1, -1, AuditLog_v_61, 0, 0, 0, 0, 0, 0, 0, models._AuditLog, 0, 0, 0, 0, 0, 0, 0]),
('Comment', [Comment_v_64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, models._Comment, 0, 0, 0, 0]),
('Config', [models._Config, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('ConfigL10N', [models._ConfigL10N, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('Context', [Context_v_61, 0, 0, 0, 0, 0, 0, 0, 0, 0, Context_v_63, 0, models._Context, 0, 0, 0, 0, 0]),
('CustomTexts', [models._CustomTexts, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('EnabledLanguage', [models._EnabledLanguage, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('Field', [models._Field, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('FieldAttr', [FieldAttr_v_52, models._FieldAttr, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('FieldOption', [models._FieldOption, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('FieldOptionTriggerField', [models._FieldOptionTriggerField, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('FieldOptionTriggerStep', [models._FieldOptionTriggerStep, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('File', [File_v_53, 0, models._File, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('IdentityAccessRequest', [IdentityAccessRequest_v_64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, models._IdentityAccessRequest, 0, 0, 0, 0]),
('IdentityAccessRequestCustodian', [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, models._IdentityAccessRequestCustodian, 0, 0, 0, 0]),
('InternalFile', [InternalFile_v_64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, models._InternalFile, 0, 0, 0, 0]),
('InternalTip', [InternalTip_v_52, InternalTip_v_57, 0, 0, 0, 0, InternalTip_v_59, 0, InternalTip_v_63, 0, 0, 0, InternalTip_v_64, InternalTip_v_66, 0, models._InternalTip, 0, 0]),
('InternalTipAnswers', [models._InternalTipAnswers, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('InternalTipData', [models._InternalTipData, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('Mail', [models._Mail, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('Message', [Message_v_64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1]),
('Questionnaire', [models._Questionnaire, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('ReceiverContext', [models._ReceiverContext, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('ReceiverFile', [ReceiverFile_v_57, 0, 0, 0, 0, 0, ReceiverFile_v_64, 0, 0, 0, 0, 0, 0, ReceiverFile_v_66, 0, models._ReceiverFile, 0, 0]),
('ReceiverTip', [ReceiverTip_v_52, ReceiverTip_v_57, 0, 0, 0, 0, ReceiverTip_v_58, ReceiverTip_v_59, ReceiverTip_v_61, 0, ReceiverTip_v_64, 0, 0, models._ReceiverTip, 0, 0, 0, 0]),
('Redaction', [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, Redaction_v_66, 0, models._Redaction, 0, 0]),
('Redirect', [models._Redirect, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('SubmissionStatus', [SubmissionStatus_v_64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, models._SubmissionStatus, 0, 0, 0]),
('SubmissionSubStatus', [SubmissionSubStatus_v_64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, SubmissionSubStatus_v_65, 0, models._SubmissionSubStatus, 0, 0]),
('SubmissionStatusChange', [SubmissionStatusChange_v_54, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]),
('Step', [models._Step, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
('Subscriber', [Subscriber_v_52, Subscriber_v_62, 0, 0, 0, 0, 0, 0, 0, 0, 0, Subscriber_v_67, 0, 0, 0, 0, models._Subscriber, 0]),
('Tenant', [Tenant_v_52, models._Tenant, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, Tenant_v_68]),
('User', [User_v_52, User_v_54, 0, User_v_56, 0, User_v_61, 0, 0, 0, 0, User_v_64, 0, 0, User_v_66, 0, User_v_67, 0, models._User]),
('WhistleblowerFile', [WhistleblowerFile_v_57, 0, 0, 0, 0, 0, WhistleblowerFile_v_64, 0, 0, 0, 0, 0, 0, WhistleblowerFile_v_66, 0, models._WhistleblowerFile, 0, 0]),

('WhistleblowerTip', [WhistleblowerTip_v_59, 0, 0, 0, 0, 0, 0, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1])
])


Expand Down
45 changes: 44 additions & 1 deletion backend/globaleaks/db/migrations/update_68/__init__.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# -*- coding: UTF-8
from globaleaks.models.enums import EnumUserRole
from globaleaks.db.migrations.update import MigrationBase
from globaleaks.models import Model
from globaleaks.models.properties import *
from globaleaks.utils.utility import datetime_now
from globaleaks.utils.utility import datetime_now, datetime_null

class Subscriber_v_67(Model):
__tablename__ = 'subscriber'
Expand All @@ -25,6 +26,48 @@
tos1 = Column(UnicodeText, default='', nullable=False)
tos2 = Column(UnicodeText, default='', nullable=False)

class User_v_67(Model):
__tablename__ = 'user'

id = Column(UnicodeText(36), primary_key=True, default=uuid4)

Check notice on line 32 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L32

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
tid = Column(Integer, default=1, nullable=False)
creation_date = Column(DateTime, default=datetime_now, nullable=False)
username = Column(UnicodeText, default='', nullable=False)

Check notice on line 35 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L35

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
salt = Column(UnicodeText(24), default='', nullable=False)

Check notice on line 36 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L36

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
hash = Column(UnicodeText(44), default='', nullable=False)

Check notice on line 37 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L37

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
name = Column(UnicodeText, default='', nullable=False)

Check notice on line 38 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L38

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
description = Column(JSON, default=dict, nullable=False)
public_name = Column(UnicodeText, default='', nullable=False)

Check notice on line 40 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L40

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
role = Column(Enum(EnumUserRole), default='receiver', nullable=False)

Check notice on line 41 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L41

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
enabled = Column(Boolean, default=True, nullable=False)
last_login = Column(DateTime, default=datetime_null, nullable=False)

Check notice on line 43 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L43

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
mail_address = Column(UnicodeText, default='', nullable=False)
language = Column(UnicodeText(12), nullable=False)
password_change_needed = Column(Boolean, default=True, nullable=False)

Check notice on line 46 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L46

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
password_change_date = Column(DateTime, default=datetime_null, nullable=False)

Check notice on line 47 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L47

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
crypto_prv_key = Column(UnicodeText(84), default='', nullable=False)

Check notice on line 48 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L48

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
crypto_pub_key = Column(UnicodeText(56), default='', nullable=False)

Check notice on line 49 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L49

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
crypto_rec_key = Column(UnicodeText(80), default='', nullable=False)

Check notice on line 50 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L50

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
crypto_bkp_key = Column(UnicodeText(84), default='', nullable=False)

Check notice on line 51 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L51

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
crypto_escrow_prv_key = Column(UnicodeText(84), default='', nullable=False)
crypto_escrow_bkp1_key = Column(UnicodeText(84), default='', nullable=False)
crypto_escrow_bkp2_key = Column(UnicodeText(84), default='', nullable=False)

Check notice on line 54 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L54

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
change_email_address = Column(UnicodeText, default='', nullable=False)
change_email_token = Column(UnicodeText, unique=True)

Check notice on line 56 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L56

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
change_email_date = Column(DateTime, default=datetime_null, nullable=False)
notification = Column(Boolean, default=True, nullable=False)

Check notice on line 58 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L58

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
forcefully_selected = Column(Boolean, default=False, nullable=False)
can_delete_submission = Column(Boolean, default=False, nullable=False)
can_postpone_expiration = Column(Boolean, default=True, nullable=False)
can_grant_access_to_reports = Column(Boolean, default=False, nullable=False)

Check notice on line 62 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L62

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
can_transfer_access_to_reports = Column(Boolean, default=False, nullable=False)
can_redact_information = Column(Boolean, default=False, nullable=False)

Check notice on line 64 in backend/globaleaks/db/migrations/update_68/__init__.py

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

backend/globaleaks/db/migrations/update_68/__init__.py#L64

'Column' may be undefined, or defined from star imports: globaleaks.models.properties (F405)
can_mask_information = Column(Boolean, default=True, nullable=False)
can_reopen_reports = Column(Boolean, default=True, nullable=False)
can_edit_general_settings = Column(Boolean, default=False, nullable=False)
readonly = Column(Boolean, default=False, nullable=False)
two_factor_secret = Column(UnicodeText(32), default='', nullable=False)
reminder_date = Column(DateTime, default=datetime_null, nullable=False)

class MigrationScript(MigrationBase):
def migrate_Subscriber(self):
Expand Down
Loading
Loading