Ejemplo n.º 1
0
def email_access(request, token):
    email_access = DatasetEmailAccess.get_email_access_for_token(token)

    person = User.objects.get_or_create(username = email_access.dataset.schema)[0]

    return render_to_response('accept_dataset.html', {
        'dataset_name': email_access.dataset.name,
        'name': person.get_full_name(),
        'login': person.username,
        'accept_url': email_access.get_accept_url(),
    }, RequestContext(request))
    return HttpResponse("")
Ejemplo n.º 2
0
def accept_dataset(request, token):
    email_access = DatasetEmailAccess.get_email_access_for_token(token)

    get_or_create_user(request.user.username)

    accounts = email_access.dataset.get_server_access()

    existing_account = False
    for login in accounts['authorized_viewers']:
        if login == request.user.username:
            existing_account = True

    if not existing_account:
        accounts['authorized_viewers'].append(request.user.username)
        email_access.dataset.set_server_access(accounts)

    return redirect(email_access.dataset.get_url())