EVE Swagger Interface (#591)

FAT uses ESI tokens to get character location/ship
 - closes #564

 Pull corp memebrship data from ESI

Additional permissions for non-api viewing.
 - migration to convert permissions from old users.

Standardize EVE datasource responses.
 - allow different sources for EVE data types.

Allow empty values for character alliance id and name

Allow multiple corps and alliances to be considered 'members'
This commit is contained in:
Adarnof
2017-01-02 20:50:21 -05:00
committed by GitHub
parent 2816a5fa46
commit 56082848a7
42 changed files with 1408 additions and 1358 deletions

View File

@@ -19,5 +19,5 @@ def states(request):
def sso(request):
return {
'EVE_SSO_CALLBACK_URL': settings.EVE_SSO_CALLBACK_URL,
'EVE_SSO_CALLBACK_URL': settings.ESI_SSO_CALLBACK_URL,
}

View File

@@ -63,15 +63,13 @@ def make_blue(auth):
def determine_membership_by_character(char):
if settings.IS_CORP:
if int(char.corporation_id) == int(settings.CORP_ID):
logger.debug("Character %s in owning corp id %s" % (char, char.corporation_id))
return MEMBER_STATE
else:
if int(char.alliance_id) == int(settings.ALLIANCE_ID):
logger.debug("Character %s in owning alliance id %s" % (char, char.alliance_id))
return MEMBER_STATE
if EveCorporationInfo.objects.filter(corporation_id=char.corporation_id).exists() is False:
if char.corporation_id in settings.STR_CORP_IDS:
logger.debug("Character %s in member corp id %s" % (char, char.corporation_id))
return MEMBER_STATE
elif char.alliance_id in settings.STR_ALLIANCE_IDS:
logger.debug("Character %s in member alliance id %s" % (char, char.alliance_id))
return MEMBER_STATE
elif not EveCorporationInfo.objects.filter(corporation_id=char.corporation_id).exists():
logger.debug("No corp model for character %s corp id %s. Unable to check standings. Non-member." % (
char, char.corporation_id))
return NONE_STATE

View File

@@ -10,7 +10,7 @@ from authentication.models import AuthServicesInfo
from authentication.forms import LoginForm, RegistrationForm
from django.contrib.auth.models import User
from django.contrib import messages
from eve_sso.decorators import token_required
from esi.decorators import token_required
import logging
logger = logging.getLogger(__name__)
@@ -95,13 +95,14 @@ def help_view(request):
@token_required(new=True)
def sso_login(request, tokens=[]):
token = tokens[0]
def sso_login(request, token):
try:
char = EveCharacter.objects.get(character_id=token.character_id)
if char.user:
if char.user.is_active:
login(request, char.user)
token.user = char.user
token.save()
return redirect('auth_dashboard')
else:
messages.error(request, 'Your account has been disabled.')