Skip to content

Commit

Permalink
Fixes tl-its-umich-edu#1094 - STUDENT_DASHBOARD_LTI should be renamed (
Browse files Browse the repository at this point in the history
  • Loading branch information
jonespm committed Sep 20, 2022
1 parent 4664132 commit 590ba02
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config/env_sample.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"GOOGLE_APPLICATION_CREDENTIALS": "/secrets/bq_cred.json",
# LTI Configuration
# LTI is disabled by default
"STUDENT_DASHBOARD_LTI": false,
"ENABLE_LTI": false,
# LTI 1.3 configuration
# The first key of LTI_CONFIG is the Canvas URL (production, beta, or test)
"LTI_CONFIG": {
Expand Down
2 changes: 1 addition & 1 deletion dashboard/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def search_key_for_resource_value(my_dict, search_for):

def get_course_id_from_request_url(path: str) -> Union[None, int]:
course_id = None
if settings.STUDENT_DASHBOARD_LTI:
if settings.ENABLE_LTI:
# Looking for an matching pattern like this /courses/123455
course_id_from_path = re.findall('/courses/(\d+)\/?', path)
if len(course_id_from_path) == 1:
Expand Down
9 changes: 5 additions & 4 deletions dashboard/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@

# courses_enabled api
COURSES_ENABLED = ENV.get('COURSES_ENABLED', False)
STUDENT_DASHBOARD_LTI = ENV.get('STUDENT_DASHBOARD_LTI', False)
# Fall back to the old config name
ENABLE_LTI = ENV.get('ENABLE_LTI', ENV.get('STUDENT_DASHBOARD_LTI', False))

# Defaults for DEBUGPY
DEBUGPY_ENABLE = ENV.get("DEBUGPY_ENABLE", False)
Expand Down Expand Up @@ -343,7 +344,7 @@
'django_su.backends.SuBackend',
)

if STUDENT_DASHBOARD_LTI:
if ENABLE_LTI:
LTI_CONFIG = ENV.get('LTI_CONFIG', {})
LTI_CONFIG_TEMPLATE_PATH = ENV.get('LTI_CONFIG_TEMPLATE_PATH')
LTI_CONFIG_DISABLE_DEPLOYMENT_ID_VALIDATION = ENV.get('LTI_CONFIG_DISABLE_DEPLOYMENT_ID_VALIDATION', False)
Expand Down Expand Up @@ -399,15 +400,15 @@
SESSION_COOKIE_SAMESITE = ENV.get("SESSION_COOKIE_SAMESITE", 'None')
CSRF_COOKIE_SAMESITE = ENV.get("CSRF_COOKIE_SAMESITE", 'None')

CHECK_ENABLE_BACKEND_LOGIN = False if STUDENT_DASHBOARD_LTI else True
CHECK_ENABLE_BACKEND_LOGIN = False if ENABLE_LTI else True

# Allow for ENABLE_BACKEND_LOGIN override
ENABLE_BACKEND_LOGIN = ENV.get("ENABLE_BACKEND_LOGIN", CHECK_ENABLE_BACKEND_LOGIN)
# only show logout URL with backend enabled
SHOW_LOGOUT_LINK = True if ENABLE_BACKEND_LOGIN else False

# If backend login is still enabled or LTI is used (since it uses this), enable the ModelBackend
if ENABLE_BACKEND_LOGIN or STUDENT_DASHBOARD_LTI:
if ENABLE_BACKEND_LOGIN or ENABLE_LTI:
AUTHENTICATION_BACKENDS += (
'django.contrib.auth.backends.ModelBackend',
)
Expand Down
2 changes: 1 addition & 1 deletion dashboard/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)


if settings.STUDENT_DASHBOARD_LTI:
if settings.ENABLE_LTI:
from . import lti_new
urlpatterns += (
path('lti/login/', lti_new.login, name='lti_login'),
Expand Down

0 comments on commit 590ba02

Please sign in to comment.