Commit e810426f by Waheed Ahmed

Merge pull request #4932 from…

Merge pull request #4932 from edx/waheed/lms11266-modify-request-type-for-change-enroll-and-bulk-beta

Modified request method for change enrollment and bulk beta modify access on instructor dashboard.
parents d00bf940 57bc5c93
...@@ -211,7 +211,7 @@ def require_level(level): ...@@ -211,7 +211,7 @@ def require_level(level):
@ensure_csrf_cookie @ensure_csrf_cookie
@cache_control(no_cache=True, no_store=True, must_revalidate=True) @cache_control(no_cache=True, no_store=True, must_revalidate=True)
@require_level('staff') @require_level('staff')
@require_query_params(action="enroll or unenroll", identifiers="stringified list of emails and/or usernames") @require_post_params(action="enroll or unenroll", identifiers="stringified list of emails and/or usernames")
def students_update_enrollment(request, course_id): def students_update_enrollment(request, course_id):
""" """
Enroll or unenroll students by email. Enroll or unenroll students by email.
...@@ -250,12 +250,11 @@ def students_update_enrollment(request, course_id): ...@@ -250,12 +250,11 @@ def students_update_enrollment(request, course_id):
} }
""" """
course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id) course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
action = request.POST.get('action')
action = request.GET.get('action') identifiers_raw = request.POST.get('identifiers')
identifiers_raw = request.GET.get('identifiers')
identifiers = _split_input_list(identifiers_raw) identifiers = _split_input_list(identifiers_raw)
auto_enroll = request.GET.get('auto_enroll') in ['true', 'True', True] auto_enroll = request.POST.get('auto_enroll') in ['true', 'True', True]
email_students = request.GET.get('email_students') in ['true', 'True', True] email_students = request.POST.get('email_students') in ['true', 'True', True]
email_params = {} email_params = {}
if email_students: if email_students:
...@@ -326,7 +325,7 @@ def students_update_enrollment(request, course_id): ...@@ -326,7 +325,7 @@ def students_update_enrollment(request, course_id):
@cache_control(no_cache=True, no_store=True, must_revalidate=True) @cache_control(no_cache=True, no_store=True, must_revalidate=True)
@require_level('instructor') @require_level('instructor')
@common_exceptions_400 @common_exceptions_400
@require_query_params( @require_post_params(
identifiers="stringified list of emails and/or usernames", identifiers="stringified list of emails and/or usernames",
action="add or remove", action="add or remove",
) )
...@@ -340,11 +339,11 @@ def bulk_beta_modify_access(request, course_id): ...@@ -340,11 +339,11 @@ def bulk_beta_modify_access(request, course_id):
- action is one of ['add', 'remove'] - action is one of ['add', 'remove']
""" """
course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id) course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
action = request.GET.get('action') action = request.POST.get('action')
identifiers_raw = request.GET.get('identifiers') identifiers_raw = request.POST.get('identifiers')
identifiers = _split_input_list(identifiers_raw) identifiers = _split_input_list(identifiers_raw)
email_students = request.GET.get('email_students') in ['true', 'True', True] email_students = request.POST.get('email_students') in ['true', 'True', True]
auto_enroll = request.GET.get('auto_enroll') in ['true', 'True', True] auto_enroll = request.POST.get('auto_enroll') in ['true', 'True', True]
results = [] results = []
rolename = 'beta' rolename = 'beta'
course = get_course_by_id(course_id) course = get_course_by_id(course_id)
......
...@@ -197,6 +197,7 @@ class BetaTesterBulkAddition ...@@ -197,6 +197,7 @@ class BetaTesterBulkAddition
$.ajax $.ajax
dataType: 'json' dataType: 'json'
type: 'POST'
url: @$btn_beta_testers.data 'endpoint' url: @$btn_beta_testers.data 'endpoint'
data: send_data data: send_data
success: (data) => @display_response data success: (data) => @display_response data
...@@ -287,6 +288,7 @@ class BatchEnrollment ...@@ -287,6 +288,7 @@ class BatchEnrollment
$.ajax $.ajax
dataType: 'json' dataType: 'json'
type: 'POST'
url: $(event.target).data 'endpoint' url: $(event.target).data 'endpoint'
data: send_data data: send_data
success: (data) => @display_response data success: (data) => @display_response data
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment