Skip to content

Commit

Permalink
Remove POST from enrollment/roster API
Browse files Browse the repository at this point in the history
since we're using PUT/DELETE instead.
  • Loading branch information
stvstnfrd committed Aug 30, 2018
1 parent 8a501fb commit 0a6676a
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 0a6676a

Please sign in to comment.