From 1f91e0c2de9549f4df91b6c8766f0f5fc23445c9 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Thu, 26 May 2011 15:54:28 +0100 Subject: [PATCH] Populate the audit log --- app/api/auth.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/api/auth.py b/app/api/auth.py index 2355525..af622e6 100644 --- a/app/api/auth.py +++ b/app/api/auth.py @@ -1,6 +1,7 @@ +from datetime import datetime from django.http import HttpResponseForbidden from django.contrib.auth.models import AnonymousUser -from api.models import AuthAPIKey +from api.models import AuthAPIKey, AuthAPILog class APIKeyAuthentication(object): @@ -13,6 +14,7 @@ class APIKeyAuthentication(object): pass else: if keyobj and keyobj.active: + AuthAPILog(key=keyobj, access_datetime=datetime.utcnow(), url=request.get_full_path()).save() request.user = AnonymousUser() return True return False