Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
57bc5c93
Commit
57bc5c93
authored
Aug 22, 2014
by
Waheed Ahmed
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modified request method for change enrollment and bulk beta modify access on instructor dashboard.
LMS-11266
parent
d00bf940
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
40 deletions
+41
-40
lms/djangoapps/instructor/tests/test_api.py
+29
-29
lms/djangoapps/instructor/views/api.py
+10
-11
lms/static/coffee/src/instructor_dashboard/membership.coffee
+2
-0
No files found.
lms/djangoapps/instructor/tests/test_api.py
View file @
57bc5c93
...
...
@@ -166,7 +166,7 @@ class TestInstructorAPIDenyLevels(ModuleStoreTestCase, LoginEnrollmentTestCase):
msg: message to display if assertion fails.
"""
url
=
reverse
(
endpoint
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
if
endpoint
in
[
'send_email'
]:
if
endpoint
in
[
'send_email'
,
'students_update_enrollment'
,
'bulk_beta_modify_access'
]:
response
=
self
.
client
.
post
(
url
,
args
)
else
:
response
=
self
.
client
.
get
(
url
,
args
)
...
...
@@ -310,19 +310,19 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
def
test_missing_params
(
self
):
""" Test missing all query parameters. """
url
=
reverse
(
'students_update_enrollment'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
)
response
=
self
.
client
.
pos
t
(
url
)
self
.
assertEqual
(
response
.
status_code
,
400
)
def
test_bad_action
(
self
):
""" Test with an invalid action. """
action
=
'robot-not-an-action'
url
=
reverse
(
'students_update_enrollment'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
self
.
enrolled_student
.
email
,
'action'
:
action
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
self
.
enrolled_student
.
email
,
'action'
:
action
})
self
.
assertEqual
(
response
.
status_code
,
400
)
def
test_invalid_email
(
self
):
url
=
reverse
(
'students_update_enrollment'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
'percivaloctavius@'
,
'action'
:
'enroll'
,
'email_students'
:
False
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
'percivaloctavius@'
,
'action'
:
'enroll'
,
'email_students'
:
False
})
self
.
assertEqual
(
response
.
status_code
,
200
)
# test the response data
...
...
@@ -342,7 +342,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
def
test_invalid_username
(
self
):
url
=
reverse
(
'students_update_enrollment'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
'percivaloctavius'
,
'action'
:
'enroll'
,
'email_students'
:
False
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
'percivaloctavius'
,
'action'
:
'enroll'
,
'email_students'
:
False
})
self
.
assertEqual
(
response
.
status_code
,
200
)
# test the response data
...
...
@@ -362,7 +362,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
def
test_enroll_with_username
(
self
):
url
=
reverse
(
'students_update_enrollment'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
self
.
notenrolled_student
.
username
,
'action'
:
'enroll'
,
'email_students'
:
False
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
self
.
notenrolled_student
.
username
,
'action'
:
'enroll'
,
'email_students'
:
False
})
self
.
assertEqual
(
response
.
status_code
,
200
)
# test the response data
...
...
@@ -393,7 +393,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
def
test_enroll_without_email
(
self
):
url
=
reverse
(
'students_update_enrollment'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
self
.
notenrolled_student
.
email
,
'action'
:
'enroll'
,
'email_students'
:
False
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
self
.
notenrolled_student
.
email
,
'action'
:
'enroll'
,
'email_students'
:
False
})
print
"type(self.notenrolled_student.email): {}"
.
format
(
type
(
self
.
notenrolled_student
.
email
))
self
.
assertEqual
(
response
.
status_code
,
200
)
...
...
@@ -435,7 +435,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
url
=
reverse
(
'students_update_enrollment'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
params
=
{
'identifiers'
:
self
.
notenrolled_student
.
email
,
'action'
:
'enroll'
,
'email_students'
:
True
}
environ
=
{
'wsgi.url_scheme'
:
protocol
}
response
=
self
.
client
.
ge
t
(
url
,
params
,
**
environ
)
response
=
self
.
client
.
pos
t
(
url
,
params
,
**
environ
)
print
"type(self.notenrolled_student.email): {}"
.
format
(
type
(
self
.
notenrolled_student
.
email
))
self
.
assertEqual
(
response
.
status_code
,
200
)
...
...
@@ -493,7 +493,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
url
=
reverse
(
'students_update_enrollment'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
params
=
{
'identifiers'
:
self
.
notregistered_email
,
'action'
:
'enroll'
,
'email_students'
:
True
}
environ
=
{
'wsgi.url_scheme'
:
protocol
}
response
=
self
.
client
.
ge
t
(
url
,
params
,
**
environ
)
response
=
self
.
client
.
pos
t
(
url
,
params
,
**
environ
)
self
.
assertEqual
(
response
.
status_code
,
200
)
# Check the outbox
...
...
@@ -520,7 +520,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
url
=
reverse
(
'students_update_enrollment'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
params
=
{
'identifiers'
:
self
.
notregistered_email
,
'action'
:
'enroll'
,
'email_students'
:
True
}
environ
=
{
'wsgi.url_scheme'
:
protocol
}
response
=
self
.
client
.
ge
t
(
url
,
params
,
**
environ
)
response
=
self
.
client
.
pos
t
(
url
,
params
,
**
environ
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
...
...
@@ -539,7 +539,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
url
=
reverse
(
'students_update_enrollment'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
params
=
{
'identifiers'
:
self
.
notregistered_email
,
'action'
:
'enroll'
,
'email_students'
:
True
,
'auto_enroll'
:
True
}
environ
=
{
'wsgi.url_scheme'
:
protocol
}
response
=
self
.
client
.
ge
t
(
url
,
params
,
**
environ
)
response
=
self
.
client
.
pos
t
(
url
,
params
,
**
environ
)
print
"type(self.notregistered_email): {}"
.
format
(
type
(
self
.
notregistered_email
))
self
.
assertEqual
(
response
.
status_code
,
200
)
...
...
@@ -562,7 +562,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
def
test_unenroll_without_email
(
self
):
url
=
reverse
(
'students_update_enrollment'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
self
.
enrolled_student
.
email
,
'action'
:
'unenroll'
,
'email_students'
:
False
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
self
.
enrolled_student
.
email
,
'action'
:
'unenroll'
,
'email_students'
:
False
})
print
"type(self.enrolled_student.email): {}"
.
format
(
type
(
self
.
enrolled_student
.
email
))
self
.
assertEqual
(
response
.
status_code
,
200
)
...
...
@@ -601,7 +601,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
def
test_unenroll_with_email
(
self
):
url
=
reverse
(
'students_update_enrollment'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
self
.
enrolled_student
.
email
,
'action'
:
'unenroll'
,
'email_students'
:
True
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
self
.
enrolled_student
.
email
,
'action'
:
'unenroll'
,
'email_students'
:
True
})
print
"type(self.enrolled_student.email): {}"
.
format
(
type
(
self
.
enrolled_student
.
email
))
self
.
assertEqual
(
response
.
status_code
,
200
)
...
...
@@ -652,7 +652,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
def
test_unenroll_with_email_allowed_student
(
self
):
url
=
reverse
(
'students_update_enrollment'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
self
.
allowed_email
,
'action'
:
'unenroll'
,
'email_students'
:
True
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
self
.
allowed_email
,
'action'
:
'unenroll'
,
'email_students'
:
True
})
print
"type(self.allowed_email): {}"
.
format
(
type
(
self
.
allowed_email
))
self
.
assertEqual
(
response
.
status_code
,
200
)
...
...
@@ -703,7 +703,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
url
=
reverse
(
'students_update_enrollment'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
params
=
{
'identifiers'
:
self
.
notregistered_email
,
'action'
:
'enroll'
,
'email_students'
:
True
}
environ
=
{
'wsgi.url_scheme'
:
protocol
}
response
=
self
.
client
.
ge
t
(
url
,
params
,
**
environ
)
response
=
self
.
client
.
pos
t
(
url
,
params
,
**
environ
)
self
.
assertEqual
(
response
.
status_code
,
200
)
# Check the outbox
...
...
@@ -731,7 +731,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
url
=
reverse
(
'students_update_enrollment'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
# Try with marketing site enabled
with
patch
.
dict
(
'django.conf.settings.FEATURES'
,
{
'ENABLE_MKTG_SITE'
:
True
}):
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
self
.
notregistered_email
,
'action'
:
'enroll'
,
'email_students'
:
True
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
self
.
notregistered_email
,
'action'
:
'enroll'
,
'email_students'
:
True
})
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
...
...
@@ -748,7 +748,7 @@ class TestInstructorAPIEnrollment(ModuleStoreTestCase, LoginEnrollmentTestCase):
url
=
reverse
(
'students_update_enrollment'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
params
=
{
'identifiers'
:
self
.
notregistered_email
,
'action'
:
'enroll'
,
'email_students'
:
True
,
'auto_enroll'
:
True
}
environ
=
{
'wsgi.url_scheme'
:
protocol
}
response
=
self
.
client
.
ge
t
(
url
,
params
,
**
environ
)
response
=
self
.
client
.
pos
t
(
url
,
params
,
**
environ
)
print
"type(self.notregistered_email): {}"
.
format
(
type
(
self
.
notregistered_email
))
self
.
assertEqual
(
response
.
status_code
,
200
)
...
...
@@ -810,14 +810,14 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
def
test_missing_params
(
self
):
""" Test missing all query parameters. """
url
=
reverse
(
'bulk_beta_modify_access'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
)
response
=
self
.
client
.
pos
t
(
url
)
self
.
assertEqual
(
response
.
status_code
,
400
)
def
test_bad_action
(
self
):
""" Test with an invalid action. """
action
=
'robot-not-an-action'
url
=
reverse
(
'bulk_beta_modify_access'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
self
.
beta_tester
.
email
,
'action'
:
action
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
self
.
beta_tester
.
email
,
'action'
:
action
})
self
.
assertEqual
(
response
.
status_code
,
400
)
def
add_notenrolled
(
self
,
response
,
identifier
):
...
...
@@ -853,25 +853,25 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
def
test_add_notenrolled_email
(
self
):
url
=
reverse
(
'bulk_beta_modify_access'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
self
.
notenrolled_student
.
email
,
'action'
:
'add'
,
'email_students'
:
False
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
self
.
notenrolled_student
.
email
,
'action'
:
'add'
,
'email_students'
:
False
})
self
.
add_notenrolled
(
response
,
self
.
notenrolled_student
.
email
)
self
.
assertFalse
(
CourseEnrollment
.
is_enrolled
(
self
.
notenrolled_student
,
self
.
course
.
id
))
def
test_add_notenrolled_email_autoenroll
(
self
):
url
=
reverse
(
'bulk_beta_modify_access'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
self
.
notenrolled_student
.
email
,
'action'
:
'add'
,
'email_students'
:
False
,
'auto_enroll'
:
True
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
self
.
notenrolled_student
.
email
,
'action'
:
'add'
,
'email_students'
:
False
,
'auto_enroll'
:
True
})
self
.
add_notenrolled
(
response
,
self
.
notenrolled_student
.
email
)
self
.
assertTrue
(
CourseEnrollment
.
is_enrolled
(
self
.
notenrolled_student
,
self
.
course
.
id
))
def
test_add_notenrolled_username
(
self
):
url
=
reverse
(
'bulk_beta_modify_access'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
self
.
notenrolled_student
.
username
,
'action'
:
'add'
,
'email_students'
:
False
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
self
.
notenrolled_student
.
username
,
'action'
:
'add'
,
'email_students'
:
False
})
self
.
add_notenrolled
(
response
,
self
.
notenrolled_student
.
username
)
self
.
assertFalse
(
CourseEnrollment
.
is_enrolled
(
self
.
notenrolled_student
,
self
.
course
.
id
))
def
test_add_notenrolled_username_autoenroll
(
self
):
url
=
reverse
(
'bulk_beta_modify_access'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
self
.
notenrolled_student
.
username
,
'action'
:
'add'
,
'email_students'
:
False
,
'auto_enroll'
:
True
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
self
.
notenrolled_student
.
username
,
'action'
:
'add'
,
'email_students'
:
False
,
'auto_enroll'
:
True
})
self
.
add_notenrolled
(
response
,
self
.
notenrolled_student
.
username
)
self
.
assertTrue
(
CourseEnrollment
.
is_enrolled
(
self
.
notenrolled_student
,
self
.
course
.
id
))
...
...
@@ -880,7 +880,7 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
url
=
reverse
(
'bulk_beta_modify_access'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
params
=
{
'identifiers'
:
self
.
notenrolled_student
.
email
,
'action'
:
'add'
,
'email_students'
:
True
}
environ
=
{
'wsgi.url_scheme'
:
protocol
}
response
=
self
.
client
.
ge
t
(
url
,
params
,
**
environ
)
response
=
self
.
client
.
pos
t
(
url
,
params
,
**
environ
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTrue
(
CourseBetaTesterRole
(
self
.
course
.
id
)
.
has_user
(
self
.
notenrolled_student
))
...
...
@@ -925,7 +925,7 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
url
=
reverse
(
'bulk_beta_modify_access'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
params
=
{
'identifiers'
:
self
.
notenrolled_student
.
email
,
'action'
:
'add'
,
'email_students'
:
True
,
'auto_enroll'
:
True
}
environ
=
{
'wsgi.url_scheme'
:
protocol
}
response
=
self
.
client
.
ge
t
(
url
,
params
,
**
environ
)
response
=
self
.
client
.
pos
t
(
url
,
params
,
**
environ
)
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertTrue
(
CourseBetaTesterRole
(
self
.
course
.
id
)
.
has_user
(
self
.
notenrolled_student
))
...
...
@@ -969,7 +969,7 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
def
test_add_notenrolled_email_mktgsite
(
self
):
# Try with marketing site enabled
url
=
reverse
(
'bulk_beta_modify_access'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
self
.
notenrolled_student
.
email
,
'action'
:
'add'
,
'email_students'
:
True
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
self
.
notenrolled_student
.
email
,
'action'
:
'add'
,
'email_students'
:
True
})
self
.
assertEqual
(
response
.
status_code
,
200
)
self
.
assertEqual
(
...
...
@@ -986,7 +986,7 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
def
test_enroll_with_email_not_registered
(
self
):
# User doesn't exist
url
=
reverse
(
'bulk_beta_modify_access'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
self
.
notregistered_email
,
'action'
:
'add'
,
'email_students'
:
True
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
self
.
notregistered_email
,
'action'
:
'add'
,
'email_students'
:
True
})
self
.
assertEqual
(
response
.
status_code
,
200
)
# test the response data
expected
=
{
...
...
@@ -1007,7 +1007,7 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
def
test_remove_without_email
(
self
):
url
=
reverse
(
'bulk_beta_modify_access'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
self
.
beta_tester
.
email
,
'action'
:
'remove'
,
'email_students'
:
False
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
self
.
beta_tester
.
email
,
'action'
:
'remove'
,
'email_students'
:
False
})
self
.
assertEqual
(
response
.
status_code
,
200
)
# Works around a caching bug which supposedly can't happen in prod. The instance here is not ==
...
...
@@ -1035,7 +1035,7 @@ class TestInstructorAPIBulkBetaEnrollment(ModuleStoreTestCase, LoginEnrollmentTe
def
test_remove_with_email
(
self
):
url
=
reverse
(
'bulk_beta_modify_access'
,
kwargs
=
{
'course_id'
:
self
.
course
.
id
.
to_deprecated_string
()})
response
=
self
.
client
.
ge
t
(
url
,
{
'identifiers'
:
self
.
beta_tester
.
email
,
'action'
:
'remove'
,
'email_students'
:
True
})
response
=
self
.
client
.
pos
t
(
url
,
{
'identifiers'
:
self
.
beta_tester
.
email
,
'action'
:
'remove'
,
'email_students'
:
True
})
self
.
assertEqual
(
response
.
status_code
,
200
)
# Works around a caching bug which supposedly can't happen in prod. The instance here is not ==
...
...
lms/djangoapps/instructor/views/api.py
View file @
57bc5c93
...
...
@@ -211,7 +211,7 @@ def require_level(level):
@ensure_csrf_cookie
@cache_control
(
no_cache
=
True
,
no_store
=
True
,
must_revalidate
=
True
)
@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
):
"""
Enroll or unenroll students by email.
...
...
@@ -250,12 +250,11 @@ def students_update_enrollment(request, course_id):
}
"""
course_id
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
course_id
)
action
=
request
.
GET
.
get
(
'action'
)
identifiers_raw
=
request
.
GET
.
get
(
'identifiers'
)
action
=
request
.
POST
.
get
(
'action'
)
identifiers_raw
=
request
.
POST
.
get
(
'identifiers'
)
identifiers
=
_split_input_list
(
identifiers_raw
)
auto_enroll
=
request
.
GE
T
.
get
(
'auto_enroll'
)
in
[
'true'
,
'True'
,
True
]
email_students
=
request
.
GE
T
.
get
(
'email_students'
)
in
[
'true'
,
'True'
,
True
]
auto_enroll
=
request
.
POS
T
.
get
(
'auto_enroll'
)
in
[
'true'
,
'True'
,
True
]
email_students
=
request
.
POS
T
.
get
(
'email_students'
)
in
[
'true'
,
'True'
,
True
]
email_params
=
{}
if
email_students
:
...
...
@@ -326,7 +325,7 @@ def students_update_enrollment(request, course_id):
@cache_control
(
no_cache
=
True
,
no_store
=
True
,
must_revalidate
=
True
)
@require_level
(
'instructor'
)
@common_exceptions_400
@require_
query
_params
(
@require_
post
_params
(
identifiers
=
"stringified list of emails and/or usernames"
,
action
=
"add or remove"
,
)
...
...
@@ -340,11 +339,11 @@ def bulk_beta_modify_access(request, course_id):
- action is one of ['add', 'remove']
"""
course_id
=
SlashSeparatedCourseKey
.
from_deprecated_string
(
course_id
)
action
=
request
.
GE
T
.
get
(
'action'
)
identifiers_raw
=
request
.
GE
T
.
get
(
'identifiers'
)
action
=
request
.
POS
T
.
get
(
'action'
)
identifiers_raw
=
request
.
POS
T
.
get
(
'identifiers'
)
identifiers
=
_split_input_list
(
identifiers_raw
)
email_students
=
request
.
GE
T
.
get
(
'email_students'
)
in
[
'true'
,
'True'
,
True
]
auto_enroll
=
request
.
GE
T
.
get
(
'auto_enroll'
)
in
[
'true'
,
'True'
,
True
]
email_students
=
request
.
POS
T
.
get
(
'email_students'
)
in
[
'true'
,
'True'
,
True
]
auto_enroll
=
request
.
POS
T
.
get
(
'auto_enroll'
)
in
[
'true'
,
'True'
,
True
]
results
=
[]
rolename
=
'beta'
course
=
get_course_by_id
(
course_id
)
...
...
lms/static/coffee/src/instructor_dashboard/membership.coffee
View file @
57bc5c93
...
...
@@ -197,6 +197,7 @@ class BetaTesterBulkAddition
$
.
ajax
dataType
:
'json'
type
:
'POST'
url
:
@
$btn_beta_testers
.
data
'endpoint'
data
:
send_data
success
:
(
data
)
=>
@
display_response
data
...
...
@@ -287,6 +288,7 @@ class BatchEnrollment
$
.
ajax
dataType
:
'json'
type
:
'POST'
url
:
$
(
event
.
target
).
data
'endpoint'
data
:
send_data
success
:
(
data
)
=>
@
display_response
data
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment