mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-12 22:10:16 +02:00
Complete removal of single tenant aspects.
This commit is contained in:
parent
3cdbff6b36
commit
2f2c2bd0e5
@ -63,15 +63,13 @@ def make_blue(auth):
|
|||||||
|
|
||||||
|
|
||||||
def determine_membership_by_character(char):
|
def determine_membership_by_character(char):
|
||||||
if settings.IS_CORP:
|
if char.corporation_id in settings.STR_CORP_IDS:
|
||||||
if int(char.corporation_id) == int(settings.CORP_ID):
|
logger.debug("Character %s in member corp id %s" % (char, char.corporation_id))
|
||||||
logger.debug("Character %s in owning corp id %s" % (char, char.corporation_id))
|
|
||||||
return MEMBER_STATE
|
return MEMBER_STATE
|
||||||
else:
|
elif char.alliance_id in settings.STR_ALLIANCE_IDS:
|
||||||
if int(char.alliance_id) == int(settings.ALLIANCE_ID):
|
logger.debug("Character %s in member alliance id %s" % (char, char.alliance_id))
|
||||||
logger.debug("Character %s in owning alliance id %s" % (char, char.alliance_id))
|
|
||||||
return MEMBER_STATE
|
return MEMBER_STATE
|
||||||
if EveCorporationInfo.objects.filter(corporation_id=char.corporation_id).exists() is False:
|
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." % (
|
logger.debug("No corp model for character %s corp id %s. Unable to check standings. Non-member." % (
|
||||||
char, char.corporation_id))
|
char, char.corporation_id))
|
||||||
return NONE_STATE
|
return NONE_STATE
|
||||||
|
@ -113,30 +113,25 @@ def update_alliance(id):
|
|||||||
|
|
||||||
@periodic_task(run_every=crontab(minute=0, hour="*/2"))
|
@periodic_task(run_every=crontab(minute=0, hour="*/2"))
|
||||||
def run_corp_update():
|
def run_corp_update():
|
||||||
if EveApiManager.check_if_api_server_online() is False:
|
if not EveApiManager.check_if_api_server_online():
|
||||||
logger.warn("Aborted updating corp and alliance models: API server unreachable")
|
logger.warn("Aborted updating corp and alliance models: API server unreachable")
|
||||||
return
|
return
|
||||||
standing_level = 'alliance'
|
|
||||||
alliance_id = settings.ALLIANCE_ID
|
|
||||||
|
|
||||||
# get corp info for owning corp if required
|
# generate member corps
|
||||||
if settings.IS_CORP:
|
for corp_id in settings.STR_CORP_IDS:
|
||||||
standing_level = 'corp'
|
if EveCorporationInfo.objects.filter(corporation_id=corp_id).exists():
|
||||||
if EveCorporationInfo.objects.filter(corporation_id=settings.CORP_ID).exists():
|
update_corp(corp_id)
|
||||||
update_corp(settings.CORP_ID)
|
|
||||||
else:
|
else:
|
||||||
EveManager.create_corporation(settings.CORP_ID)
|
EveManager.create_corporation(corp_id)
|
||||||
|
|
||||||
alliance_id = eve_adapter_factory().get_corp(settings.CORP_ID).alliance_id
|
# generate member alliances
|
||||||
|
for alliance_id in settings.STR_ALLIANCE_IDS:
|
||||||
# get and create alliance info for owning alliance if required
|
|
||||||
if alliance_id:
|
|
||||||
if EveAllianceInfo.objects.filter(alliance_id=alliance_id).exists():
|
if EveAllianceInfo.objects.filter(alliance_id=alliance_id).exists():
|
||||||
logger.debug("Updating existing owner alliance model with id %s" % alliance_id)
|
logger.debug("Updating existing owner alliance model with id %s" % alliance_id)
|
||||||
update_alliance(alliance_id)
|
update_alliance(alliance_id)
|
||||||
else:
|
else:
|
||||||
EveManager.create_alliance(id)
|
EveManager.create_alliance(alliance_id)
|
||||||
EveManager.populate_alliance(id)
|
EveManager.populate_alliance(alliance_id)
|
||||||
|
|
||||||
# update existing corp models
|
# update existing corp models
|
||||||
for corp in EveCorporationInfo.objects.all():
|
for corp in EveCorporationInfo.objects.all():
|
||||||
@ -150,9 +145,9 @@ def run_corp_update():
|
|||||||
# create standings
|
# create standings
|
||||||
standings = EveApiManager.get_corp_standings()
|
standings = EveApiManager.get_corp_standings()
|
||||||
if standings:
|
if standings:
|
||||||
standings = standings[standing_level]
|
standings = standings[settings.STANDING_LEVEL]
|
||||||
for standing in standings:
|
for standing in standings:
|
||||||
if int(standings[standing]['standing']) >= settings.BLUE_STANDING:
|
if float(standings[standing]['standing']) >= settings.BLUE_STANDING:
|
||||||
logger.debug("Standing %s meets threshold" % standing)
|
logger.debug("Standing %s meets threshold" % standing)
|
||||||
if EveApiManager.check_if_id_is_alliance(standing):
|
if EveApiManager.check_if_id_is_alliance(standing):
|
||||||
logger.debug("Standing %s is an alliance" % standing)
|
logger.debug("Standing %s is an alliance" % standing)
|
||||||
@ -211,37 +206,20 @@ def run_corp_update():
|
|||||||
# delete unnecessary alliance models
|
# delete unnecessary alliance models
|
||||||
for alliance in EveAllianceInfo.objects.filter(is_blue=False):
|
for alliance in EveAllianceInfo.objects.filter(is_blue=False):
|
||||||
logger.debug("Checking to delete alliance %s" % alliance)
|
logger.debug("Checking to delete alliance %s" % alliance)
|
||||||
if not settings.IS_CORP:
|
if not alliance.alliance_id in settings.STR_ALLIANCE_IDS:
|
||||||
if not alliance.alliance_id == settings.ALLIANCE_ID:
|
|
||||||
logger.info("Deleting unnecessary alliance model %s" % alliance)
|
|
||||||
alliance.delete()
|
|
||||||
else:
|
|
||||||
if not alliance.evecorporationinfo_set.filter(corporation_id=settings.CORP_ID).exists():
|
|
||||||
logger.info("Deleting unnecessary alliance model %s" % alliance)
|
logger.info("Deleting unnecessary alliance model %s" % alliance)
|
||||||
alliance.delete()
|
alliance.delete()
|
||||||
|
|
||||||
# delete unnecessary corp models
|
# delete unnecessary corp models
|
||||||
for corp in EveCorporationInfo.objects.filter(is_blue=False):
|
for corp in EveCorporationInfo.objects.filter(is_blue=False):
|
||||||
logger.debug("Checking to delete corp %s" % corp)
|
logger.debug("Checking to delete corp %s" % corp)
|
||||||
if not settings.IS_CORP:
|
if not corp.corporation_id in settings.STR_CORP_IDS:
|
||||||
|
logger.debug("Corp %s is not member corp" % corp)
|
||||||
if corp.alliance:
|
if corp.alliance:
|
||||||
logger.debug("Corp %s has alliance %s" % (corp, corp.alliance))
|
logger.debug("Corp %s has alliance %s" % (corp, corp.alliance))
|
||||||
if not corp.alliance.alliance_id == settings.ALLIANCE_ID:
|
if not corp.alliance.alliance_id in settings.STR_ALLIANCE_IDS:
|
||||||
logger.info("Deleting unnecessary corp model %s" % corp)
|
logger.info("Deleting unnecessary corp model %s" % corp)
|
||||||
corp.delete()
|
corp.delete()
|
||||||
else:
|
else:
|
||||||
logger.info("Deleting unnecessary corp model %s" % corp)
|
logger.info("Deleting unnecessary corp model %s" % corp)
|
||||||
corp.delete()
|
corp.delete()
|
||||||
else:
|
|
||||||
if corp.corporation_id != settings.CORP_ID:
|
|
||||||
logger.debug("Corp %s is not owning corp" % corp)
|
|
||||||
if corp.alliance:
|
|
||||||
logger.debug("Corp %s has alliance %s" % (corp, corp.alliance))
|
|
||||||
if not corp.alliance.evecorporationinfo_set.filter(corporation_id=settings.CORP_ID).exists():
|
|
||||||
logger.info("Deleting unnecessary corp model %s" % corp)
|
|
||||||
corp.delete()
|
|
||||||
else:
|
|
||||||
logger.info("Deleting unnecessary corp model %s" % corp)
|
|
||||||
corp.delete()
|
|
||||||
else:
|
|
||||||
logger.debug("Corp %s is owning corp" % corp)
|
|
||||||
|
@ -98,10 +98,10 @@ def fatlink_statistics_view(request, year=datetime.date.today().year, month=date
|
|||||||
|
|
||||||
|
|
||||||
# get FAT stats for member corps
|
# get FAT stats for member corps
|
||||||
if settings.IS_CORP:
|
for corp_id in settings.STR_CORP_IDS:
|
||||||
fat_stats[settings.CORP_ID] = CorpStat(settings.CORP_ID, start_of_month, start_of_next_month)
|
fat_stats[corp_id] = CorpStat(corp_id, start_of_month, start_of_next_month)
|
||||||
else:
|
for alliance_id in settings.STR_ALLIANCE_IDS:
|
||||||
alliance_corps = EveCorporationInfo.objects.filter(alliance__alliance_id=settings.ALLIANCE_ID)
|
alliance_corps = EveCorporationInfo.objects.filter(alliance__alliance_id=alliance_id)
|
||||||
for corp in alliance_corps:
|
for corp in alliance_corps:
|
||||||
fat_stats[corp.corporation_id] = CorpStat(corp.corporation_id, start_of_month, start_of_next_month)
|
fat_stats[corp.corporation_id] = CorpStat(corp.corporation_id, start_of_month, start_of_next_month)
|
||||||
|
|
||||||
|
@ -23,9 +23,5 @@ def auth_settings(request):
|
|||||||
'MEMBER_API_MASK': settings.MEMBER_API_MASK,
|
'MEMBER_API_MASK': settings.MEMBER_API_MASK,
|
||||||
'MEMBER_API_ACCOUNT': settings.MEMBER_API_ACCOUNT,
|
'MEMBER_API_ACCOUNT': settings.MEMBER_API_ACCOUNT,
|
||||||
'JABBER_URL': settings.JABBER_URL,
|
'JABBER_URL': settings.JABBER_URL,
|
||||||
'ALLIANCE_NAME': settings.ALLIANCE_NAME,
|
'SITE_NAME': settings.SITE_NAME,
|
||||||
'ALLIANCE_ID': settings.ALLIANCE_ID,
|
|
||||||
'CORP_NAME': settings.CORP_NAME,
|
|
||||||
'CORP_ID': settings.CORP_ID,
|
|
||||||
'IS_CORP': settings.IS_CORP,
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user