Esempio n. 1
0
def bulk_journals_delete():
    if not current_user.has_role("ultra_bulk_delete"):
        abort(403)
    payload = get_web_json_payload()
    validate_json(payload,
                  fields_must_be_present=['selection_query'],
                  error_to_raise=BulkAdminEndpointException)

    q = get_query_from_request(payload)
    summary = journal_bulk_delete.journal_bulk_delete_manage(
        selection_query=q, dry_run=payload.get('dry_run', True))
    return make_json_resp(summary.as_dict(), status_code=200)
Esempio n. 2
0
def journals_bulk_reinstate():
    payload = get_web_json_payload()
    validate_json(payload,
                  fields_must_be_present=['selection_query'],
                  error_to_raise=BulkAdminEndpointException)

    q = get_query_from_request(payload)
    summary = journal_in_out_doaj.change_by_query(q,
                                                  True,
                                                  dry_run=payload.get(
                                                      "dry_run", True))
    return make_json_resp(summary.as_dict(), status_code=200)
Esempio n. 3
0
def bulk_add_note(doaj_type):
    task = get_bulk_edit_background_task_manager(doaj_type)

    payload = get_web_json_payload()
    validate_json(payload,
                  fields_must_be_present=['selection_query', 'note'],
                  error_to_raise=BulkAdminEndpointException)

    summary = task(selection_query=get_query_from_request(payload),
                   note=payload['note'],
                   dry_run=payload.get('dry_run', True))

    return make_json_resp(summary.as_dict(), status_code=200)
Esempio n. 4
0
def applications_bulk_change_status():
    payload = get_web_json_payload()
    validate_json(
        payload,
        fields_must_be_present=['selection_query', 'application_status'],
        error_to_raise=BulkAdminEndpointException)

    q = get_query_from_request(payload)
    summary = get_bulk_edit_background_task_manager('applications')(
        selection_query=q,
        application_status=payload['application_status'],
        dry_run=payload.get('dry_run', True))

    return make_json_resp(summary.as_dict(), status_code=200)