super user environment variables over hardcode
This commit is contained in:
parent
9ae39702b8
commit
2478e35f8d
@ -2,6 +2,7 @@
|
||||
|
||||
import logging
|
||||
|
||||
from django.conf import settings
|
||||
from django.http import HttpResponse
|
||||
from django.contrib.auth.backends import BaseBackend
|
||||
|
||||
@ -56,8 +57,8 @@ class DiscordAuthenticationBackend(BaseBackend):
|
||||
existing_user.save()
|
||||
return existing_user
|
||||
|
||||
# hardcode admin for myself
|
||||
if discord_user_id == "377453890523627522":
|
||||
# Provide superuser permissions for specified users
|
||||
if discord_user_id in settings.SUPERUSER_IDS:
|
||||
return DiscordUser.objects.create_superuser(discord_user_data)
|
||||
|
||||
return DiscordUser.objects.create_user(discord_user_data)
|
||||
|
@ -150,6 +150,7 @@ DISCORD_REFRESH_TOKEN_REQUEST = {
|
||||
}
|
||||
DISCORD_API_URL = env("DISCORD_API_URL")
|
||||
DISCORD_OAUTH2_URL = env("DISCORD_OAUTH2_URL")
|
||||
SUPERUSER_IDS = env("SUPERUSER_IDS").split(",")
|
||||
|
||||
# Logging
|
||||
# https://docs.djangoproject.com/en/5.0/topics/logging/
|
||||
|
Loading…
x
Reference in New Issue
Block a user