Re-add the removed pull_username code.

This commit is contained in:
yackob03 2013-12-02 14:08:10 -05:00
parent 64c9081587
commit 03198210c3

View file

@ -173,8 +173,6 @@ def create_repository(namespace, repository):
'namespace': namespace 'namespace': namespace
} }
description = ''
if get_authenticated_user(): if get_authenticated_user():
mixpanel.track(get_authenticated_user().username, 'push_repo', mixpanel.track(get_authenticated_user().username, 'push_repo',
extra_params) extra_params)
@ -184,9 +182,8 @@ def create_repository(namespace, repository):
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
model.log_action('push_repo', namespace, performer = get_authenticated_user(), ip = request.remote_addr, model.log_action('push_repo', namespace, performer=get_authenticated_user(),
metadata = metadata, ip=request.remote_addr, metadata=metadata, repository=repo)
repository = repo)
return response return response
@ -268,20 +265,26 @@ def get_repository_images(namespace, repository):
'namespace': namespace, 'namespace': namespace,
} }
if get_authenticated_user(): if 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
metadata['token_code'] = get_validated_token().code metadata['token_code'] = get_validated_token().code
else: else:
metadata['public'] = True metadata['public'] = True
pull_username = 'anonymous'
if get_authenticated_user():
pull_username = get_authenticated_user().username
extra_params = { extra_params = {
'repository': '%s/%s' % (namespace, repository), 'repository': '%s/%s' % (namespace, repository),
} }
mixpanel.track(pull_username, 'pull_repo', extra_params) mixpanel.track(pull_username, 'pull_repo', extra_params)
model.log_action('pull_repo', namespace, performer = get_authenticated_user(), ip = request.remote_addr, model.log_action('pull_repo', namespace,
metadata = metadata, repository = repo) performer=get_authenticated_user(),
ip=request.remote_addr, metadata=metadata,
repository=repo)
return resp return resp
abort(403) abort(403)