Exemple #1
0
def handshake():
    global stored_person
    incoming_json = request.get_json()
    print incoming_json
    target_id = incoming_json['target_system_id']
    user_id = incoming_json['username']

    # find our  user data and put it in the bucket
    try:
        u = User.objects(pk=user_id)[0]
        p = Person.objects(pk=user_id)[0]
        print u
        print p
        stored_person = p
        bucket.put(target_id, user_id, p)
    except ValidationError:
        return jsonify({
            'acknowledgement': False,
            'message': 'Could not find user with ID %s' % user_id
        })

    return jsonify({
        'acknowledgement': True,
        'messsage': 'Sending data to target %s' % target_id
    })
Exemple #2
0
def handshake():
    global stored_person
    incoming_json = request.get_json()
    print incoming_json
    target_id = incoming_json['target_system_id']
    user_id = incoming_json['username']

    # find our  user data and put it in the bucket
    try:
        u = User.objects(pk=user_id)[0]
        p = Person.objects(pk=user_id)[0]
        print u
        print p
        stored_person = p
        bucket.put(target_id, user_id, p)
    except ValidationError:
        return jsonify({'acknowledgement': False, 'message': 'Could not find user with ID %s' % user_id})

    return jsonify({'acknowledgement': True, 'messsage': 'Sending data to target %s' % target_id})
Exemple #3
0
    return o


if __name__ == '__main__':
    print 'Simplixity Data Insertion'

    client = MongoClient()
    db = client['simplixity']

    people = make_fake_people(10)
    person = db.person
    user = db.user
    organization = db.organization
    person.remove(None)
    user.remove(None)

    for p in people:

        policy = make_fake_policy()
        policy.save()

        o = make_fake_org()
        o.save()
        u = User(organ_donor=True)
        u.employer = o
        u.person = p
        u.conditions = [make_fake_condition()]
        u.policies = [policy]
        p.save()
        u.save(cascade=True)
Exemple #4
0
def get_single_user(user_id):
    return User.objects(pk=user_id).to_json()
Exemple #5
0
def get_single_user(user_id):
    return User.objects(pk=user_id).to_json()
Exemple #6
0
    client = MongoClient()
    db = client['simplixity']

    people = make_fake_people(10)
    person = db.person
    user = db.user
    organization = db.organization
    person.remove(None)
    user.remove(None)

    for p in people:

        policy = make_fake_policy()
        policy.save()

        o = make_fake_org()
        o.save()
        u = User(organ_donor = True)
        u.employer = o
        u.person = p
        u.conditions = [make_fake_condition()]
        u.policies = [policy]
        p.save()
        u.save(cascade=True)