Merge branch 'master' of ssh://bitbucket.org/yackob03/quay

This commit is contained in:
jakedt 2014-03-26 16:28:42 -04:00
commit 0a80f67355

View file

@ -11,7 +11,7 @@ from data.model import oauth
from data.queue import webhook_queue
from app import mixpanel, app
from auth.auth import process_auth
from auth.auth_context import get_authenticated_user, get_validated_token
from auth.auth_context import get_authenticated_user, get_validated_token, get_validated_oauth_token
from util.names import parse_repository_name
from util.email import send_confirmation_email
from auth.permissions import (ModifyRepositoryPermission, UserAdminPermission,
@ -122,7 +122,12 @@ def create_user():
@index.route('/users/', methods=['GET'])
@process_auth
def get_user():
if get_authenticated_user():
if get_validated_oauth_token():
return jsonify({
'username': '$oauthtoken',
'email': None,
})
elif get_authenticated_user():
return jsonify({
'username': get_authenticated_user().username,
'email': get_authenticated_user().email,
@ -221,7 +226,13 @@ def create_repository(namespace, repository):
'namespace': namespace
}
if get_authenticated_user():
if get_validated_oauth_token():
mixpanel.track(username, 'push_repo', extra_params)
metadata['oauth_token_id'] = oauth_token.id
metadata['oauth_token_application_id'] = oauth_token.application.client_id
metadata['oauth_token_application'] = oauth_token.application.name
elif get_authenticated_user():
username = get_authenticated_user().username
mixpanel.track(username, 'push_repo', extra_params)
@ -237,7 +248,7 @@ def create_repository(namespace, repository):
event = app.config['USER_EVENTS'].get_event(username)
event.publish_event_data('docker-cli', user_data)
else:
elif get_validated_token():
mixpanel.track(get_validated_token().code, 'push_repo', extra_params)
metadata['token'] = get_validated_token().friendly_name
metadata['token_code'] = get_validated_token().code
@ -340,7 +351,12 @@ def get_repository_images(namespace, repository):
'repo': repository,
'namespace': namespace,
}
if get_authenticated_user():
if get_validated_oauth_token():
metadata['oauth_token_id'] = oauth_token.id
metadata['oauth_token_application_id'] = oauth_token.application.client_id
metadata['oauth_token_application'] = oauth_token.application.name
elif get_authenticated_user():
metadata['username'] = get_authenticated_user().username
elif get_validated_token():
metadata['token'] = get_validated_token().friendly_name