Beispiel #1
0
    def epilogue(self):
        if self.session_new.query(self.model_from['Tenant']).count() > 1:
            self.session_new.add(self.model_to['Config']({
                'tid': 1,
                'var_name': 'multisite',
                'value': True
            }))
            self.entries_count['Config'] += 1

        ids = [
            id[0]
            for id in self.session_old.query(self.model_from['Field'].id).
            filter(self.model_from['Field'].template_id ==
                   'whistleblower_identity')
        ]

        for internaltip in self.session_old.query(
                self.model_from['InternalTip']):
            answers = self.db_serialize_questionnaire_answers(
                self.session_old, internaltip)

            db_set_internaltip_answers(self.session_new, internaltip.id,
                                       internaltip.questionnaire_hash, answers)

            for id in ids:
                if id in answers:
                    db_set_internaltip_data(self.session_new, internaltip.id,
                                            'identity_provided', True)
                    db_set_internaltip_data(self.session_new, internaltip.id,
                                            'whistleblower_identity',
                                            answers[id])
                    break
Beispiel #2
0
    def epilogue(self):
        if self.session_new.query(self.model_from['Tenant']).count() > 1:
            obj = self.model_to['Config']()
            obj.tid = 1
            obj.var_name = 'multisite'
            obj.value = True
            self.session_new.add(obj)
            self.entries_count['Config'] += 1

        for obj in self.session_new.query(self.model_from['WhistleblowerTip']):
            obj.hash_alg = 'SCRYPT'

        ids = [
            id[0]
            for id in self.session_old.query(self.model_from['Field'].id).
            filter(self.model_from['Field'].template_id ==
                   'whistleblower_identity')
        ]

        for internaltip in self.session_old.query(
                self.model_from['InternalTip']):
            answers = self.db_serialize_questionnaire_answers(
                self.session_old, internaltip)

            db_set_internaltip_answers(self.session_new, internaltip.id,
                                       internaltip.questionnaire_hash, answers)

            for id in ids:
                if id in answers:
                    db_set_internaltip_data(self.session_new, internaltip.id,
                                            'identity_provided', True)
                    db_set_internaltip_data(self.session_new, internaltip.id,
                                            'whistleblower_identity',
                                            answers[id])
                    break
Beispiel #3
0
def update_identity_information(session, tid, tip_id, identity_field_id, wbi, language):
    itip = models.db_get(session, models.InternalTip, models.InternalTip.id == tip_id, models.InternalTip.tid == tid)

    if itip.crypto_tip_pub_key:
        wbi = base64.b64encode(GCE.asymmetric_encrypt(itip.crypto_tip_pub_key, json.dumps(wbi).encode())).decode()

    db_set_internaltip_data(session, itip.id, 'identity_provided', True, False)
    db_set_internaltip_data(session, itip.id, 'whistleblower_identity', wbi, True)

    now = datetime_now()
    itip.update_date = now
    itip.wb_last_access = now
Beispiel #4
0
def update_identity_information(session, tid, tip_id, identity_field_id, wbi, language):
    itip = models.db_get(session, models.InternalTip, models.InternalTip.id == tip_id, models.InternalTip.tid == tid)

    if itip.crypto_tip_pub_key:
        wbi = base64.b64encode(GCE.asymmetric_encrypt(itip.crypto_tip_pub_key, json.dumps(wbi).encode())).decode()

    db_set_internaltip_data(session, itip.id, 'identity_provided', True, False)
    db_set_internaltip_data(session, itip.id, 'whistleblower_identity', wbi, True)

    now = datetime_now()
    itip.update_date = now
    itip.wb_last_access = now
Beispiel #5
0
    def epilogue(self):
        if self.session_new.query(self.model_from['Tenant']).count() > 1:
            self.session_new.add(self.model_to['Config']({'tid': 1, 'var_name': u'multisite', 'value': True}))
            self.entries_count['Config'] += 1

        ids = [id[0] for id in self.session_old.query(self.model_from['Field'].id)
                                               .filter(self.model_from['Field'].template_id == u'whistleblower_identity')]

        for internaltip in self.session_old.query(self.model_from['InternalTip']):
            answers = self.db_serialize_questionnaire_answers(self.session_old, internaltip.tid, internaltip)

            db_set_internaltip_answers(self.session_new,
                                       internaltip.id,
                                       internaltip.questionnaire_hash,
                                       answers,
                                       False)

            for id in ids:
                if id in answers:
                    db_set_internaltip_data(self.session_new, internaltip.id, 'identity_provided', True, False)
                    db_set_internaltip_data(self.session_new, internaltip.id, 'whistleblower_identity', answers[id], False)
                    break