Example #1
0
def get_user_dataset_access(case_id):
    log.info('Getting dataset access for {}'.format(case_id))
    case = Case.get_case_by_id(case_id)
    if case is None:
        raise ApplicationError(*errors.get('verification_api',
                                           'CASE_NOT_FOUND',
                                           filler=case_id),
                               http_code=404)

    ulapd = UlapdAPI()
    dataset_access_list = ulapd.get_user_dataset_access(case.user_id)

    return dataset_access_list
Example #2
0
def get_dataset_list_details():
    ulapd = UlapdAPI()
    dataset_list = ulapd.get_dataset_list_details()
    return dataset_list
Example #3
0
    email = search_params.get('email', '')
    return _extract_rows(
        Case.search(first_name, last_name, organisation_name, email))


@handle_errors(is_get=False)
def update_user_details(case_id, data):
    case = Case.get_case_by_id(case_id)
    if case is None:
        raise ApplicationError(*errors.get('verification_api',
                                           'CASE_NOT_FOUND',
                                           filler=case_id),
                               http_code=404)

    # update preference in ulapd
    ulapd = UlapdAPI()
    ulapd_data = {'user_id': case.user_id}
    for key, value in data['updated_data'].items():
        ulapd_data[key] = value
    ulapd.update(ulapd_data)

    case.registration_data = _update_registration_data(
        dict(case.registration_data), data['updated_data'])

    if 'contactable' in data['updated_data']:
        _add_update_note(case_id, data)

    db.session.commit()

    return {'updated': True}