コード例 #1
0
ファイル: models.py プロジェクト: NeCTAR-RC/karaage-auth
def keystone_authenticate(person):
    """Authenticate a user as their default tenant.
    """
    details = datastores.get_person_details(person)
    keystone_user_details = details['keystone'][0]

    kwargs = {'username': keystone_user_details['name'],
              'password': KEYSTONE_CONF['authenticate_password'],
              'auth_url': KEYSTONE_CONF['admin_url']}

    client = keystoneclient.Client(**kwargs)
    token = client.auth_ref
    return token, keystone_user_details.get('default_project_id')
コード例 #2
0
def user_verbose(request, username):
    person = get_object_or_404(Person, username=username)

    from karaage.datastores import get_person_details
    person_details = get_person_details(person)

    from karaage.datastores import get_account_details
    account_details = []
    for ua in person.account_set.filter(date_deleted__isnull=True):
        details = get_account_details(ua)
        account_details.append(details)

    return render_to_response('people/person_verbose.html', locals(), context_instance=RequestContext(request))