コード例 #1
0
ファイル: rtip.py プロジェクト: gianlucagilardi/GlobaLeaks
def serialize_rtip(session, rtip, itip, language):
    """
    Transaction returning a serialized descriptor of a tip

    :param session: An ORM session
    :param rtip: A model to be serialized
    :param itip: A itip object referenced by the model to be serialized
    :param language: A language of the serialization
    :return: A serialized description of the model specified
    """
    user_id = rtip.receiver_id

    ret = serialize_usertip(session, rtip, itip, language)

    if 'whistleblower_identity' in ret[
            'data'] and not rtip.can_access_whistleblower_identity:
        del ret['data']['whistleblower_identity']

    ret['id'] = rtip.id
    ret['receiver_id'] = user_id

    if State.tenant_cache[itip.tid].enable_private_labels:
        ret['label'] = rtip.label
    else:
        ret['label'] = itip.label

    ret['comments'] = db_get_itip_comment_list(session, itip.id)
    ret['messages'] = db_get_itip_message_list(session, rtip.id)
    ret['rfiles'] = db_receiver_get_rfile_list(session, rtip.id)
    ret['wbfiles'] = db_receiver_get_wbfile_list(session, itip.id)
    ret['iars'] = db_get_rtip_identityaccessrequest_list(session, rtip.id)
    ret['enable_notifications'] = bool(rtip.enable_notifications)

    return ret
コード例 #2
0
ファイル: helpers.py プロジェクト: br1n0/GlobaLeaks
    def get_rtips(self, store):
        rtips_desc = []
        rtips = store.find(models.ReceiverTip)
        for r in rtips:
            itip = serialize_usertip(store, r, 'en')
            rtips_desc.append({'rtip_id': r.id, 'receiver_id': r.receiver_id, 'itip': itip})

        return rtips_desc
コード例 #3
0
ファイル: helpers.py プロジェクト: br1n0/GlobaLeaks
    def get_wbtips(self, store):
        wbtips_desc = []
        wbtips = store.find(models.WhistleblowerTip)
        for wbtip in wbtips:
            rcvrs_ids = [rcvr.id for rcvr in wbtip.internaltip.receivers]
            itip = serialize_usertip(store, wbtip, 'en')
            wbtips_desc.append({'wbtip_id': wbtip.id, 'wbtip_receivers': rcvrs_ids, 'itip': itip})

        return wbtips_desc
コード例 #4
0
ファイル: wbtip.py プロジェクト: chojar/GlobaLeaks
def serialize_wbtip(session, wbtip, itip, language):
    ret = serialize_usertip(session, itip, itip, language)

    ret['comments'] = db_get_itip_comment_list(session, itip.id)
    ret['messages'] = db_get_itip_message_list(session, itip.id)
    ret['rfiles'] = db_get_rfile_list(session, itip.id)
    ret['wbfiles'] = db_get_wbfile_list(session, itip.id)

    return ret
コード例 #5
0
ファイル: collection.py プロジェクト: corvolino/GlobaLeaks
def get_rtip_info(store, rtip_id, language):
    """
    This function return a receiver tip
    """
    rtip = store.find(ReceiverTip, ReceiverTip.id == rtip_id).one()
    if not rtip:
        raise errors.TipIdNotFound

    rtip_dict = serialize_usertip(store, rtip, language)

    return rtip_dict
コード例 #6
0
ファイル: rtip.py プロジェクト: flipchan/GlobaLeaks
def serialize_rtip(store, rtip, language):
    user_id = rtip.receiver.user.id

    ret = serialize_usertip(store, rtip, language)

    ret['id'] = rtip.id
    ret['receiver_id'] = user_id
    ret['label'] = rtip.label
    ret['export'] = '/rtip/' + rtip.id + '/export'
    ret['files'] = db_get_files_receiver(store, user_id, rtip.id)

    return ret
コード例 #7
0
ファイル: rtip.py プロジェクト: corvolino/GlobaLeaks
def serialize_rtip(store, rtip, language):
    user_id = rtip.receiver.user.id

    ret = serialize_usertip(store, rtip, language)

    ret["id"] = rtip.id
    ret["receiver_id"] = user_id
    ret["label"] = rtip.label
    ret["collection"] = "/rtip/" + rtip.id + "/collection"
    ret["files"] = db_get_files_receiver(store, user_id, rtip.id)

    return ret
コード例 #8
0
ファイル: wbtip.py プロジェクト: flipchan/GlobaLeaks
def serialize_wbtip(store, wbtip, language):
    ret = serialize_usertip(store, wbtip, language)

    # filter submission progressive
    # to prevent a fake whistleblower to assess every day how many
    # submissions are received by the platform.
    del ret["progressive"]

    ret["id"] = wbtip.id
    ret["files"] = db_get_file_list(store, wbtip.id)

    return ret
コード例 #9
0
ファイル: rtip.py プロジェクト: sshyran/GlobaLeaks
def serialize_rtip(store, rtip, language):
    user_id = rtip.receiver.user.id

    ret = serialize_usertip(store, rtip, language)

    ret['id'] = rtip.id
    ret['receiver_id'] = user_id
    ret['label'] = rtip.label
    ret['files'] = db_get_files_receiver(store, user_id, rtip.id)
    ret['enable_notifications'] = bool(rtip.enable_notifications)

    return ret
コード例 #10
0
ファイル: wbtip.py プロジェクト: Taipo/GlobaLeaks
def serialize_wbtip(store, wbtip, language):
    ret = serialize_usertip(store, wbtip, language)

    # filter submission progressive
    # to prevent a fake whistleblower to assess every day how many
    # submissions are received by the platform.
    del ret['progressive']

    ret['id'] = wbtip.id
    ret['comments'] = db_get_itip_comment_list(store, wbtip.internaltip)
    ret['files'] = db_get_file_list(store, wbtip.id)

    return ret
コード例 #11
0
def serialize_wbtip(session, wbtip, itip, language):
    ret = serialize_usertip(session, itip, itip, language)

    ret['comments'] = db_get_itip_comment_list(session, itip.id)
    ret['messages'] = db_get_itip_message_list(session, itip.id)
    ret['rfiles'] = db_get_rfile_list(session, itip.id)
    ret['wbfiles'] = db_get_wbfile_list(session, itip.id)

    if not State.tenant_cache[itip.tid].do_not_expose_users_names:
        for x in ret['comments'] + ret['messages']:
            if x['author'] != 'Whistleblower':
                x['author'] = State.tenant_cache[itip.tid].name

    return ret
コード例 #12
0
ファイル: rtip.py プロジェクト: pawmsf/GlobaLeaks
def serialize_rtip(store, rtip, language):
    user_id = rtip.receiver.id

    ret = serialize_usertip(store, rtip, language)

    ret['id'] = rtip.id
    ret['receiver_id'] = user_id
    ret['label'] = rtip.label
    ret['comments'] = db_get_itip_comment_list(store, rtip.internaltip)
    ret['messages'] = db_get_itip_message_list(rtip)
    ret['files'] = db_get_files_receiver(store, user_id, rtip.id)
    ret['iars'] = db_get_identityaccessrequest_list(store, rtip.id, language)
    ret['enable_notifications'] = bool(rtip.enable_notifications)

    return ret
コード例 #13
0
ファイル: rtip.py プロジェクト: Taipo/GlobaLeaks
def serialize_rtip(store, rtip, language):
    user_id = rtip.receiver.id

    ret = serialize_usertip(store, rtip, language)

    ret['id'] = rtip.id
    ret['receiver_id'] = user_id
    ret['label'] = rtip.label
    ret['comments'] = db_get_itip_comment_list(store, rtip.internaltip)
    ret['messages'] = db_get_itip_message_list(rtip)
    ret['files'] = db_get_files_receiver(store, user_id, rtip.id)
    ret['iars'] = db_get_identityaccessrequest_list(store, rtip.id, language)
    ret['enable_notifications'] = bool(rtip.enable_notifications)

    return ret
コード例 #14
0
ファイル: rtip.py プロジェクト: chojar/GlobaLeaks
def serialize_rtip(session, rtip, itip, language):
    user_id = rtip.receiver_id

    ret = serialize_usertip(session, rtip, itip, language)

    if(not rtip.can_access_whistleblower_identity and 'whistleblower_identity' in ret['data']):
        del ret['data']['whistleblower_identity']

    ret['id'] = rtip.id
    ret['receiver_id'] = user_id
    ret['label'] = rtip.label
    ret['comments'] = db_get_itip_comment_list(session, itip.id)
    ret['messages'] = db_get_itip_message_list(session, rtip.id)
    ret['rfiles'] = db_receiver_get_rfile_list(session, rtip.id)
    ret['wbfiles'] = db_receiver_get_wbfile_list(session, itip.id)
    ret['iars'] = db_get_rtip_identityaccessrequest_list(session, rtip.id)
    ret['enable_notifications'] = bool(rtip.enable_notifications)

    return ret
コード例 #15
0
def serialize_rtip(session, rtip, itip, language):
    user_id = rtip.receiver_id

    ret = serialize_usertip(session, rtip, itip, language)

    if(not rtip.can_access_whistleblower_identity and 'whistleblower_identity' in ret['data']):
        del ret['data']['whistleblower_identity']

    ret['id'] = rtip.id
    ret['receiver_id'] = user_id
    ret['label'] = rtip.label
    ret['comments'] = db_get_itip_comment_list(session, itip.id)
    ret['messages'] = db_get_itip_message_list(session, rtip.id)
    ret['rfiles'] = db_receiver_get_rfile_list(session, rtip.id)
    ret['wbfiles'] = db_receiver_get_wbfile_list(session, itip.id)
    ret['iars'] = db_get_rtip_identityaccessrequest_list(session, rtip.id)
    ret['enable_notifications'] = bool(rtip.enable_notifications)

    return ret
コード例 #16
0
def serialize_rtip(session, rtip, itip, language, is_sensitive_data_visible=False):
    user_id = rtip.receiver_id

    #ottengo record da tabella Receiver
    receiver = session.query(models.Receiver).filter(models.Receiver.id == user_id).one()

    ret = serialize_usertip(session, rtip, itip, language, is_sensitive_data_visible)

    ret['id'] = rtip.id
    ret['receiver_id'] = user_id
    ret['label'] = rtip.label
    ret['comments'] = db_get_itip_comment_list(session, itip.tid, itip)
    ret['messages'] = db_get_itip_message_list(session, itip.tid, rtip)
    ret['rfiles'] = db_receiver_get_rfile_list(session, itip.tid, rtip.id)
    ret['wbfiles'] = db_receiver_get_wbfile_list(session, itip.tid, itip.id)
    ret['iars'] = db_get_identityaccessrequest_list(session, itip.tid, rtip.id)
    ret['enable_notifications'] = bool(rtip.enable_notifications)

    if receiver.two_step_login_enabled:
        ret['control_mail_list'] = receiver.control_mail_1+";"+receiver.control_mail_2+";"+receiver.control_mail_3
	else:
		ret['control_mail_list'] = None