@require_POST
@ensure_csrf_cookie
@cache_control(no_cache=True, no_store=True, must_revalidate=True)
@require_level('instructor')
@require_post_params(rolename="'instructor', 'staff', or 'beta'")
def list_course_role_members(request, course_id):
 course_id = SlashSeparatedCourseKey.from_deprecated_string(course_id)
 course = get_course_with_access(request.user, 'instructor', course_id, depth=None)
 rolename = request.POST.get('rolename')
 if (rolename not in ROLES):
  return HttpResponseBadRequest()
 def extract_user_info(user):
  ' convert user into dicts for json view '
  return {'username': user.username, 'email': user.email, 'first_name': user.first_name, 'last_name': user.last_name}
 response_payload = {'course_id': course_id.to_deprecated_string(), rolename: map(extract_user_info, list_with_level(course, rolename))}
 return JsonResponse(response_payload)

@ require_POST @ ensure_csrf_cookie @ cache_control ( no_cache = True , no_store = True , must_revalidate = True ) @ require_level ( 'instructor' ) @ require_post_params ( rolename = "'instructor', 'staff', or 'beta'" ) def list_course_role_members ( request , course_id ) : course_id = SlashSeparatedCourseKey . from_deprecated_string ( course_id ) course = get_course_with_access ( request . user , 'instructor' , course_id , depth = None ) rolename = request . POST . get ( 'rolename' ) if ( rolename not in ROLES ) : return HttpResponseBadRequest ( ) def extract_user_info ( user ) : return { 'username' : user . username , 'email' : user . email , 'first_name' : user . first_name , 'last_name' : user . last_name } response_payload = { 'course_id' : course_id . to_deprecated_string ( ) , rolename : map ( extract_user_info , list_with_level ( course , rolename ) ) } return JsonResponse ( response_payload )
list instructors and staff .