Merge branch 'master' of ssh://git@dev.dredd.it/dreddit-auth

This commit is contained in:
Aaron Static
2010-07-01 19:28:40 +10:00
3 changed files with 12 additions and 9 deletions

View File

@@ -6,10 +6,13 @@ class APIKeyAuthentication(object):
def is_authenticated(self, request): def is_authenticated(self, request):
apikey = request.GET.get('apikey', None) params = {}
if apikey: for key,value in request.GET.items():
params[key.lower()] = value
if params['apikey']:
try: try:
keyobj = AuthAPIKey.objects.get(key=apikey) keyobj = AuthAPIKey.objects.get(key=params['apikey'])
except: except:
keyobj = None keyobj = None

View File

@@ -105,10 +105,10 @@ class EveAPIProxyHandler(BaseHandler):
params = {} params = {}
for key,value in request.GET.items(): for key,value in request.GET.items():
params[key] = value params[key.lower()] = value
if request.GET.get('userid', None): if 'userid' in params:
obj = get_object_or_404(EVEAccount, pk=request.GET.get('userid', None)) obj = get_object_or_404(EVEAccount, pk=params['userid'])
params['apikey'] = obj.api_key params['apikey'] = obj.api_key
print params print params
@@ -120,7 +120,7 @@ class OpTimerHandler(BaseHandler):
allowed_methods = ('GET') allowed_methods = ('GET')
def read(self, request, id=None): def read(self, request, id=None):
obj = get_object_or_404(EVEAccount, user=FULL_API_USER_ID) obj = get_object_or_404(EVEAccount, id=FULL_API_USER_ID)
params = {'userID':obj.id,'apiKey':obj.api_key,'characterID':FULL_API_CHARACTER_ID} params = {'userID':obj.id,'apiKey':obj.api_key,'characterID':FULL_API_CHARACTER_ID}

View File

@@ -123,8 +123,8 @@ REDDIT_PASSWD = ''
HR_STAFF_GROUP = 'HR Staff' HR_STAFF_GROUP = 'HR Staff'
FULL_API_USER_ID = 1 FULL_API_USER_ID = 415631
FULL_API_CHARACTER_ID = 217608501 FULL_API_CHARACTER_ID = 246102445
# try and import local settings # try and import local settings
try: try: