Add scope ordinality and translations. Process oauth tokens and limit scopes accordingly.

This commit is contained in:
jakedt 2014-03-12 16:31:37 -04:00
parent 25ceb90fc6
commit e74eb3ee87
8 changed files with 137 additions and 31 deletions

View file

@ -1,7 +1,8 @@
import logging
import json
from app import mixpanel
from flask import request, abort as flask_abort, jsonify
from flask import request, abort as flask_abort, make_response
from auth.auth_context import get_authenticated_user, get_validated_token
logger = logging.getLogger(__name__)
@ -15,7 +16,7 @@ DEFAULT_MESSAGE[404] = 'Not Found'
DEFAULT_MESSAGE[409] = 'Conflict'
DEFAULT_MESSAGE[501] = 'Not Implemented'
def abort(status_code, message=None, issue=None, **kwargs):
def abort(status_code, message=None, issue=None, headers=None, **kwargs):
message = (str(message) % kwargs if message else
DEFAULT_MESSAGE.get(status_code, ''))
@ -53,8 +54,7 @@ def abort(status_code, message=None, issue=None, **kwargs):
if issue_url:
data['info_url'] = issue_url
resp = jsonify(data)
resp.status_code = status_code
resp = make_response(json.dumps(data), status_code, headers)
# Report the abort to the user.
flask_abort(resp)