Skip to content

Commit

Permalink
Merge pull request #826
Browse files Browse the repository at this point in the history
* stv/enrollment-api/remove-post:
  Remove POST from enrollment/roster API
  • Loading branch information
stvstnfrd committed Sep 13, 2018
2 parents 5ab87dc + 0a6676a commit 14c26a1
Showing 1 changed file with 0 additions and 26 deletions.
26 changes: 0 additions & 26 deletions openedx/stanford/common/djangoapps/enrollment/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,32 +77,6 @@ def get(self, request, course_id=None):
roster = get_roster(course_id)
return Response(data=json.dumps({'roster': roster}))

@method_decorator(ensure_csrf_cookie_cross_domain)
def post(self, request, course_id):
"""
Enroll/unenroll a user in a course; requires staff access
**Example Request**
POST /api/enrollment/v1/roster/course-v1:foo+bar+foobar
{
'email': '[email protected]',
'action': 'enroll',
'email_students': false,
'auto_enroll': true
}
"""
action = request.data.get('action')
if action == 'enroll':
return self.put(request, course_id)
if action == 'unenroll':
return self.delete(request, course_id)
return Response(
status=status.HTTP_400_BAD_REQUEST,
data={
'message': u'Unrecognized action',
},
)

def put(self, request, course_id):
"""
Enroll a user in a course; requires staff access
Expand Down

0 comments on commit 14c26a1

Please sign in to comment.