From b48b81ed7ab9f0428da0a9d6740283308ece6db2 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Thu, 28 Oct 2010 09:57:06 +0100 Subject: [PATCH] Add blacklist checks for API UserID --- hr/app_defines.py | 2 ++ hr/models.py | 6 +++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hr/app_defines.py b/hr/app_defines.py index 186bb38..041cb93 100644 --- a/hr/app_defines.py +++ b/hr/app_defines.py @@ -42,6 +42,7 @@ BLACKLIST_TYPE_CORPORATION = 2 BLACKLIST_TYPE_ALLIANCE = 3 BLACKLIST_TYPE_EMAIL = 4 BLACKLIST_TYPE_AUTH = 5 +BLACKLIST_TYPE_APIUSERID = 6 BLACKLIST_TYPE_CHOICES = ( (BLACKLIST_TYPE_REDDIT, 'Reddit Account'), @@ -50,6 +51,7 @@ BLACKLIST_TYPE_CHOICES = ( (BLACKLIST_TYPE_ALLIANCE, 'Alliance'), (BLACKLIST_TYPE_EMAIL, 'Email Address'), (BLACKLIST_TYPE_AUTH, 'Auth Account'), + (BLACKLIST_TYPE_APIUSERID, 'EVE API User ID'), ) BLACKLIST_SOURCE_INTERNAL = 0 diff --git a/hr/models.py b/hr/models.py index 2f59547..0ae07d6 100644 --- a/hr/models.py +++ b/hr/models.py @@ -59,10 +59,14 @@ class Application(models.Model): # Check Alliance blacklists alliances = [a[0].lower() for a in evechars.values_list('corporation__alliance__name') if a and a[0]] - objs = bl_items.filter(type=BLACKLIST_TYPE_ALLIANCE, value__in=alliances) blacklist.extend(objs) + # Check API Key blacklists + keys = self.user.eveaccount_set.all().values_list('api_user_id', flat=True) + objs = bl_items.filter(type=BLACKLIST_TYPE_APIUSERID, value__in=keys) + blacklist.extend(objs) + return blacklist def save(self, *args, **kwargs):