Merge branch 'master' of ssh://bitbucket.org/yackob03/quay
This commit is contained in:
commit
0a80f67355
1 changed files with 21 additions and 5 deletions
|
@ -11,7 +11,7 @@ from data.model import oauth
|
||||||
from data.queue import webhook_queue
|
from data.queue import webhook_queue
|
||||||
from app import mixpanel, app
|
from app import mixpanel, app
|
||||||
from auth.auth import process_auth
|
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.names import parse_repository_name
|
||||||
from util.email import send_confirmation_email
|
from util.email import send_confirmation_email
|
||||||
from auth.permissions import (ModifyRepositoryPermission, UserAdminPermission,
|
from auth.permissions import (ModifyRepositoryPermission, UserAdminPermission,
|
||||||
|
@ -122,7 +122,12 @@ def create_user():
|
||||||
@index.route('/users/', methods=['GET'])
|
@index.route('/users/', methods=['GET'])
|
||||||
@process_auth
|
@process_auth
|
||||||
def get_user():
|
def get_user():
|
||||||
if get_authenticated_user():
|
if get_validated_oauth_token():
|
||||||
|
return jsonify({
|
||||||
|
'username': '$oauthtoken',
|
||||||
|
'email': None,
|
||||||
|
})
|
||||||
|
elif get_authenticated_user():
|
||||||
return jsonify({
|
return jsonify({
|
||||||
'username': get_authenticated_user().username,
|
'username': get_authenticated_user().username,
|
||||||
'email': get_authenticated_user().email,
|
'email': get_authenticated_user().email,
|
||||||
|
@ -221,7 +226,13 @@ def create_repository(namespace, repository):
|
||||||
'namespace': namespace
|
'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
|
username = get_authenticated_user().username
|
||||||
|
|
||||||
mixpanel.track(username, 'push_repo', extra_params)
|
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 = app.config['USER_EVENTS'].get_event(username)
|
||||||
event.publish_event_data('docker-cli', user_data)
|
event.publish_event_data('docker-cli', user_data)
|
||||||
|
|
||||||
else:
|
elif get_validated_token():
|
||||||
mixpanel.track(get_validated_token().code, 'push_repo', extra_params)
|
mixpanel.track(get_validated_token().code, 'push_repo', extra_params)
|
||||||
metadata['token'] = get_validated_token().friendly_name
|
metadata['token'] = get_validated_token().friendly_name
|
||||||
metadata['token_code'] = get_validated_token().code
|
metadata['token_code'] = get_validated_token().code
|
||||||
|
@ -340,7 +351,12 @@ def get_repository_images(namespace, repository):
|
||||||
'repo': repository,
|
'repo': repository,
|
||||||
'namespace': namespace,
|
'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
|
metadata['username'] = get_authenticated_user().username
|
||||||
elif get_validated_token():
|
elif get_validated_token():
|
||||||
metadata['token'] = get_validated_token().friendly_name
|
metadata['token'] = get_validated_token().friendly_name
|
||||||
|
|
Reference in a new issue