Ejemplo n.º 1
0
def get_legit_report(intake_user, api_type="api"):
    pii = aggregate_pii([intake_user])
    query_dict = {}
    for k, v in pii.items():
        if v:
            query_dict[k] = v.pop()

    return generate_legit_report(query_dict, api_type, pre_hashed=True)
Ejemplo n.º 2
0
def get_legit_report(intake_user, api_type="api"):
    pii = aggregate_pii([intake_user])
    query_dict = {}
    for k,v in pii.items():
        if v:
            query_dict[k] = v.pop()
                
    return generate_legit_report(query_dict, api_type, pre_hashed=True)
Ejemplo n.º 3
0
def query():
    matching_users = None
    if request.method == "POST":
        form = QueryForm(request.form)
        if form.validate():
            #logging.info("Request Data: %s" % request.form)
            #logging.info("Form Data: %s" % form.data)

            query_data = form.data
            is_prehashed = query_data.pop("prehashed")

            # for k,v in query_data.items():
            #                 if v:
            #                     query_data[k] = hash_value(v)
            #                 else:
            #                     del query_data[k]

            user_sets = find_users(query_data, "api", pre_hashed=is_prehashed)

            lrg_summaries = []
            for user_set in user_sets:
                lrg_summaries.append(generate_lrg_summary([user_set]))

            user_sets = zip(user_sets, lrg_summaries)

            legit_report, intake_users = generate_legit_report(
                query_data, "api", pre_hashed=is_prehashed)
            legit_report_pretty = json.dumps(legit_report,
                                             sort_keys=True,
                                             indent=4)
    else:
        user_sets = None
        legit_report = None
        legit_report_pretty = None
        form = QueryForm()

    return render_template("admin/query.html",
                           form=form,
                           PII_FIELDS=PII_FIELDS,
                           DEVELOPMENT=DEVELOPMENT,
                           user_sets=user_sets,
                           legit_report=legit_report,
                           legit_report_pretty=legit_report_pretty)
Ejemplo n.º 4
0
def query():
    matching_users = None
    if request.method == "POST":
        form = QueryForm(request.form)
        if form.validate():
            #logging.info("Request Data: %s" % request.form)
            #logging.info("Form Data: %s" % form.data)

            query_data = form.data
            is_prehashed = query_data.pop("prehashed")

            # for k,v in query_data.items():
            #                 if v:
            #                     query_data[k] = hash_value(v)
            #                 else:
            #                     del query_data[k]

            user_sets = find_users(query_data, "api", pre_hashed=is_prehashed)

            lrg_summaries = []
            for user_set in user_sets:
                lrg_summaries.append(generate_lrg_summary([user_set]))

            user_sets = zip(user_sets,lrg_summaries)

            legit_report, intake_users = generate_legit_report(
                                                    query_data, 
                                                    "api", 
                                                    pre_hashed=is_prehashed)    
            legit_report_pretty = json.dumps(legit_report, sort_keys=True, indent=4)        
    else:
        user_sets = None
        legit_report = None
        legit_report_pretty = None
        form = QueryForm()

    return render_template("admin/query.html", 
                            form=form, 
                            PII_FIELDS=PII_FIELDS,
                            DEVELOPMENT=DEVELOPMENT,
                            user_sets=user_sets,
                            legit_report=legit_report,
                            legit_report_pretty=legit_report_pretty)