From 2da93d4410b7a99be7d3a86d06ea583010197e68 Mon Sep 17 00:00:00 2001 From: Adarnof Date: Mon, 30 Nov 2015 22:30:18 +0000 Subject: [PATCH] Added required settings and context to render services page. Added URLs for enabling and disabling Discord. Added Discord section to services page. --- alliance_auth/settings.py.example | 12 ++++-- alliance_auth/urls.py | 4 ++ stock/templates/registered/services.html | 52 ++++++++++++++++++++++++ util/context_processors.py | 2 + 4 files changed, 66 insertions(+), 4 deletions(-) diff --git a/alliance_auth/settings.py.example b/alliance_auth/settings.py.example index 15ee3829..5719ba82 100755 --- a/alliance_auth/settings.py.example +++ b/alliance_auth/settings.py.example @@ -202,12 +202,14 @@ DEFAULT_BLUE_GROUP = os.environ.get('AA_DEFAULT_BLUE_GROUP', 'Blue') # ENABLE_AUTH_JABBER - Enable jabber support in the auth for auth'd members # ENABLE_AUTH_MUMBLE - Enable mumble support in the auth for auth'd members # ENABLE_AUTH_IPBOARD - Enable IPBoard forum support in the auth for auth'd members +# ENABLE_AUTH_DISCORD - Enable Discord support in the auth for auth'd members ######################### -ENABLE_AUTH_FORUM = 'True' == os.environ.get('AA_ENABLE_AUTH_FORUM', 'True') -ENABLE_AUTH_JABBER = 'True' == os.environ.get('AA_ENABLE_AUTH_JABBER', 'True') -ENABLE_AUTH_MUMBLE = 'True' == os.environ.get('AA_ENABLE_AUTH_MUMBLE', 'True') +ENABLE_AUTH_FORUM = 'True' == os.environ.get('AA_ENABLE_AUTH_FORUM', 'False') +ENABLE_AUTH_JABBER = 'True' == os.environ.get('AA_ENABLE_AUTH_JABBER', 'False') +ENABLE_AUTH_MUMBLE = 'True' == os.environ.get('AA_ENABLE_AUTH_MUMBLE', 'False') ENABLE_AUTH_IPBOARD = 'True' == os.environ.get('AA_ENABLE_AUTH_IPBOARD', 'False') ENABLE_AUTH_TEAMSPEAK3 = 'True' == os.environ.get('AA_ENABLE_AUTH_TEAMSPEAK3', 'False') +ENABLE_AUTH_DISCORD = 'True' == os.environ.get('AA_ENABLE_AUTH_DISCORD', 'False') ##################### # Blue service Setup @@ -217,13 +219,15 @@ ENABLE_AUTH_TEAMSPEAK3 = 'True' == os.environ.get('AA_ENABLE_AUTH_TEAMSPEAK3', ' # ENABLE_BLUE_JABBER - Enable jabber support in the auth for blues # ENABLE_BLUE_MUMBLE - Enable mumble support in the auth for blues # ENABLE_BLUE_IPBOARD - Enable IPBoard forum support in the auth for blues +# ENABLE_BLUE_DISCORD - Enable Discord support in the auth for blues ##################### BLUE_STANDING = float(os.environ.get('AA_BLUE_STANDING', '5.0')) ENABLE_BLUE_FORUM = 'True' == os.environ.get('AA_ENABLE_BLUE_FORUM', 'False') ENABLE_BLUE_JABBER = 'True' == os.environ.get('AA_ENABLE_BLUE_JABBER', 'False') -ENABLE_BLUE_MUMBLE = 'True' == os.environ.get('AA_ENABLE_BLUE_MUMBLE', 'True') +ENABLE_BLUE_MUMBLE = 'True' == os.environ.get('AA_ENABLE_BLUE_MUMBLE', 'False') ENABLE_BLUE_IPBOARD = 'True' == os.environ.get('AA_ENABLE_BLUE_IPBOARD', 'False') ENABLE_BLUE_TEAMSPEAK3 = 'True' == os.environ.get('AA_ENABLE_BLUE_TEAMSPEAK3', 'False') +ENABLE_BLUE_DISCORD = 'True' == os.environ.get('AA_ENABLE_BLUE_DISCORD', 'False') ######################### # Corp Configuration diff --git a/alliance_auth/urls.py b/alliance_auth/urls.py index 21758bf9..dbdbb767 100755 --- a/alliance_auth/urls.py +++ b/alliance_auth/urls.py @@ -125,6 +125,10 @@ urlpatterns = patterns('', url(r'reset_teamspeak3_perm/$', 'services.views.reset_teamspeak3_perm', name='auth_reset_teamspeak3_perm'), + # Discord Service Control + url(r'^activate_discord/$', 'services.views.activate_discord', name='auth_activate_discord'), + url(r'^deactivate_discord/$', 'services.views.deactivate_discord', name='auth_deactivate_discord'), + # Tools url(r'^tool/fleet_formatter_tool/$', 'services.views.fleet_formatter_view', name='auth_fleet_format_tool_view'), diff --git a/stock/templates/registered/services.html b/stock/templates/registered/services.html index 81935390..5de97501 100755 --- a/stock/templates/registered/services.html +++ b/stock/templates/registered/services.html @@ -152,6 +152,32 @@ {% endif %} + {% if ENABLE_BLUE_DISCORD %} + + Service + Username + User ID + Action + + + Discord + {{ authinfo.discord_username }} + {{ authinfo.discord_uid }} + + {% ifequal authinfo.discord_username "" %} + + + + {% else %} + + + + {% endifequal %} + + + {% endif %} {% elif perms.auth.member %} @@ -298,6 +324,32 @@ {% endif %} + {% if ENABLE_AUTH_DISCORD %} + + + + + + + + + + + + + {% endif %}
ServiceUsernameUser IDAction
Discord{{ authinfo.discord_username }}{{ authinfo.discord_uid }} + {% ifequal authinfo.discord_username "" %} + + + + {% else %} + + + + {% endifequal %} +
{% else %} {% if IS_CORP %} diff --git a/util/context_processors.py b/util/context_processors.py index 245c023e..b055737b 100755 --- a/util/context_processors.py +++ b/util/context_processors.py @@ -34,11 +34,13 @@ def domain_url(request): 'ENABLE_AUTH_MUMBLE': settings.ENABLE_AUTH_MUMBLE, 'ENABLE_AUTH_IPBOARD': settings.ENABLE_AUTH_IPBOARD, 'ENABLE_AUTH_TEAMSPEAK3': settings.ENABLE_AUTH_TEAMSPEAK3, + 'ENABLE_AUTH_DISCORD': settings.ENABLE_AUTH_DISCORD, 'ENABLE_BLUE_JABBER': settings.ENABLE_BLUE_JABBER, 'ENABLE_BLUE_FORUM': settings.ENABLE_BLUE_FORUM, 'ENABLE_BLUE_MUMBLE': settings.ENABLE_BLUE_MUMBLE, 'ENABLE_BLUE_IPBOARD': settings.ENABLE_BLUE_IPBOARD, 'ENABLE_BLUE_TEAMSPEAK3': settings.ENABLE_BLUE_TEAMSPEAK3, + 'ENABLE_BLUE_DISCORD': settings.ENABLE_BLUE_DISCORD, 'TEAMSPEAK3_PUBLIC_URL': settings.TEAMSPEAK3_PUBLIC_URL, 'JACK_KNIFE_URL': settings.JACK_KNIFE_URL, 'CURRENT_UTC_TIME': timezone.now()}