mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 14:52:15 +00:00
Blacklist API endpoint, allows lookup for blacklisted items
This commit is contained in:
@@ -15,6 +15,7 @@ from api.models import AuthAPIKey, AuthAPILog
|
|||||||
from eve_proxy.models import CachedDocument
|
from eve_proxy.models import CachedDocument
|
||||||
from eve_api.models import EVEAccount
|
from eve_api.models import EVEAccount
|
||||||
from sso.models import ServiceAccount, Service
|
from sso.models import ServiceAccount, Service
|
||||||
|
from hr.models import Blacklist
|
||||||
|
|
||||||
from settings import FULL_API_USER_ID
|
from settings import FULL_API_USER_ID
|
||||||
from settings import FULL_API_CHARACTER_ID
|
from settings import FULL_API_CHARACTER_ID
|
||||||
@@ -195,3 +196,17 @@ class OpTimerHandler(BaseHandler):
|
|||||||
'forumLink': ''}]}
|
'forumLink': ''}]}
|
||||||
else:
|
else:
|
||||||
return {'ops':events}
|
return {'ops':events}
|
||||||
|
|
||||||
|
|
||||||
|
class BlacklistHandler(BaseHandler):
|
||||||
|
allowed_methods = ('GET')
|
||||||
|
|
||||||
|
def read(self, request):
|
||||||
|
if request.GET.get('value'):
|
||||||
|
obj = Blacklist.objects.filter(value=request.GET.get('value'))
|
||||||
|
if obj.count() and request.GET.get('type'):
|
||||||
|
obj = obj.filter(type=request.GET.get('type'))
|
||||||
|
else:
|
||||||
|
obj = []
|
||||||
|
|
||||||
|
return obj
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ login_resource = Resource(handler=LoginHandler, **noauth)
|
|||||||
eveapi_resource = Resource(handler=EveAPIHandler, **apikeyauth)
|
eveapi_resource = Resource(handler=EveAPIHandler, **apikeyauth)
|
||||||
eveapiproxy_resource = Resource(handler=EveAPIProxyHandler, **apikeyauth)
|
eveapiproxy_resource = Resource(handler=EveAPIProxyHandler, **apikeyauth)
|
||||||
optimer_resource = Resource(handler=OpTimerHandler, **apikeyauth)
|
optimer_resource = Resource(handler=OpTimerHandler, **apikeyauth)
|
||||||
|
blacklist_resource = Resource(handler=BlacklistHandler, **apikeyauth)
|
||||||
|
|
||||||
urlpatterns = patterns('',
|
urlpatterns = patterns('',
|
||||||
url(r'^user/$', user_resource),
|
url(r'^user/$', user_resource),
|
||||||
@@ -21,6 +22,7 @@ urlpatterns = patterns('',
|
|||||||
url(r'^eveapi/$', eveapi_resource),
|
url(r'^eveapi/$', eveapi_resource),
|
||||||
url(r'^eveapi/', eveapiproxy_resource, name='api-eveapiproxy'),
|
url(r'^eveapi/', eveapiproxy_resource, name='api-eveapiproxy'),
|
||||||
url(r'^optimer/$', optimer_resource),
|
url(r'^optimer/$', optimer_resource),
|
||||||
|
url(r'^blacklist/$', blacklist_resource),
|
||||||
)
|
)
|
||||||
|
|
||||||
urlpatterns += patterns('piston.authentication',
|
urlpatterns += patterns('piston.authentication',
|
||||||
|
|||||||
Reference in New Issue
Block a user