Merge pull request #932 from coreos-inc/grantuser
Fix track_and_log for grant-ed users
This commit is contained in:
commit
984e9b1154
1 changed files with 7 additions and 1 deletions
|
@ -4,7 +4,8 @@ import random
|
|||
from app import analytics, app, userevents
|
||||
from data import model
|
||||
from flask import request
|
||||
from auth.auth_context import get_authenticated_user, get_validated_token, get_validated_oauth_token
|
||||
from auth.auth_context import (get_authenticated_user, get_validated_token,
|
||||
get_validated_oauth_token, get_grant_user_context)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -22,6 +23,11 @@ def track_and_log(event_name, repo, analytics_name=None, analytics_sample=1, **k
|
|||
authenticated_oauth_token = get_validated_oauth_token()
|
||||
authenticated_user = get_authenticated_user()
|
||||
authenticated_token = get_validated_token() if not authenticated_user else None
|
||||
granted_username = get_grant_user_context()
|
||||
|
||||
# TODO: Fix this to support OAuth tokens as well.
|
||||
if granted_username is not None:
|
||||
authenticated_user = model.user.get_user(granted_username)
|
||||
|
||||
logger.debug('Logging the %s to Mixpanel and the log system', event_name)
|
||||
if authenticated_oauth_token:
|
||||
|
|
Reference in a new issue