mirror of
https://github.com/nikdoof/test-auth.git
synced 2025-12-14 06:42:16 +00:00
Add blacklist checks for API UserID
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
Reference in New Issue
Block a user