mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-06 23:26:19 +01:00
Enforce unique AuthServicesInfo (#618)
Alter user field to OneToOneField Migration to enforce uniqueness pre-change Migration to ensure all users have an AuthServicesInfo Receiver to automatically create one upon user creation Replace AuthServicesInfo.get_or_create with get Prevent deletion of AuthServicesInfo from admin site Remove add and delete permissions from model. Get character names in chunks on corpstats update to prevent HTTP400 when requesting >350(ish) names Include corpstats docs. Update settings docs.
This commit is contained in:
@@ -20,7 +20,7 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def timer_util_test(user):
|
||||
return AuthServicesInfo.objects.get_or_create(user=user)[0].state in [BLUE_STATE, MEMBER_STATE]
|
||||
return AuthServicesInfo.objects.get(user=user).state in [BLUE_STATE, MEMBER_STATE]
|
||||
|
||||
|
||||
@login_required
|
||||
@@ -28,7 +28,7 @@ def timer_util_test(user):
|
||||
@permission_required('auth.timer_view')
|
||||
def timer_view(request):
|
||||
logger.debug("timer_view called by user %s" % request.user)
|
||||
auth_info = AuthServicesInfo.objects.get_or_create(user=request.user)[0]
|
||||
auth_info = AuthServicesInfo.objects.get(user=request.user)
|
||||
char = EveManager.get_character_by_id(auth_info.main_char_id)
|
||||
if char:
|
||||
corp = EveManager.get_corporation_info_by_id(char.corporation_id)
|
||||
@@ -64,7 +64,7 @@ def add_timer_view(request):
|
||||
logger.debug("Request type POST contains form valid: %s" % form.is_valid())
|
||||
if form.is_valid():
|
||||
# Get character
|
||||
auth_info = AuthServicesInfo.objects.get_or_create(user=request.user)[0]
|
||||
auth_info = AuthServicesInfo.objects.get(user=request.user)
|
||||
character = EveManager.get_character_by_id(auth_info.main_char_id)
|
||||
corporation = EveManager.get_corporation_info_by_id(character.corporation_id)
|
||||
logger.debug(
|
||||
@@ -127,7 +127,7 @@ def edit_timer(request, timer_id):
|
||||
form = TimerForm(request.POST)
|
||||
logger.debug("Received POST request containing updated timer form, is valid: %s" % form.is_valid())
|
||||
if form.is_valid():
|
||||
auth_info = AuthServicesInfo.objects.get_or_create(user=request.user)[0]
|
||||
auth_info = AuthServicesInfo.objects.get(user=request.user)
|
||||
character = EveManager.get_character_by_id(auth_info.main_char_id)
|
||||
corporation = EveManager.get_corporation_info_by_id(character.corporation_id)
|
||||
logger.debug(
|
||||
|
||||
Reference in New Issue
Block a user