canvas-lms/app
Jon Jensen e95b14f196 API tweaks to support querying upcoming enrollments/courses
fixes CAT-147

add support for a user_id param when querying course/section enrollments

ensure course and enrollment endpoints allow users to see their own
*active* enrollments in unpublished course (i.e. self-enrollments), even
if they are not admins.

slightly tighten up User#current_and_future_enrollments (only return non-
admin enrollments in unpublished courses if they are active). this method
is only used currently around self-enrollment functionality, and that sets
the enrollment state to :active, so there should be no changes in
functionality

test plan:
1. set up self-enrollment in an unpublished course
2. self-enroll as a student (via link from course settings page)
3. it should work (though you can't get into the course yet)
4. as the student, hit /api/v1/courses
   1. with no params, you shouldn't see the course
   2. with state[]=unpublished you should see the course
5. as the student, hit /api/v1/courses/:id/enrollments?user_id=self&state[]=current_and_future
   1. you should get back your enrollment
6. as a teacher, publish the course
7. as the student, hit /api/v1/courses
   1. you should get back the course
8. as the student, hit /api/v1/courses/:id/enrollments?user_id=self
   1. you should get back your enrollment

Change-Id: I75a4f77b0298729088c7f8e3dbc46d551f36f241
Reviewed-on: https://gerrit.instructure.com/35085
Reviewed-by: Jeff Belser <jbelser@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Marc LeGendre <marc@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2014-05-23 18:50:25 +00:00
..
coffeescripts never drop accessibility 2014-05-23 18:23:23 +00:00
controllers API tweaks to support querying upcoming enrollments/courses 2014-05-23 18:50:25 +00:00
helpers A feature flag to toggle html5/flash first video playback 2014-05-21 19:48:23 +00:00
messages extract lib/text_helper to gems/canvas_text_helper 2014-04-30 15:18:40 +00:00
middleware extract canvas statsd gem 2014-03-14 15:03:23 +00:00
models API tweaks to support querying upcoming enrollments/courses 2014-05-23 18:50:25 +00:00
observers don't include submissions in recent_stream_items 2013-01-03 15:42:39 -07:00
presenters update student grade listing icons for submissions 2014-05-20 21:26:02 +00:00
serializers fix quiz moderate refresh with no submissions 2014-05-22 22:47:53 +00:00
stylesheets never drop accessibility 2014-05-23 18:23:23 +00:00
views never drop accessibility 2014-05-23 18:23:23 +00:00