redirect to login on submission show page

fixes CNVS-3982

test plan
- log in as someone who can view a submission
- ensure that you can view the submission
- log out
- navigate to the submission's url
- ensure that you are directed to the login page and that
  no page error occurs

Change-Id: If52a572b0323f1adc5ec3e15338df437d3f28fb4
Reviewed-on: https://gerrit.instructure.com/18048
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
do not allow GB1 when course enrollments are > 250

closes #CNVS-4173

test plan:
- in rails console run:
  Setting.set('gb1_max', '0')
- start your rails server
- go to the gradebook for any course
- it should redirect to courses/*/gradebook2
  and the button to go back to gb1 should not be present

Change-Id: I5e08490f173898927f80496239d176ca0c92168b
Reviewed-on: https://gerrit.instructure.com/18068
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
add undelete option to course batch update api

fixes CNVS-4056

test plan:
 - delete some courses via the UI or API
 - use the course batch update API with event=undelete to bring
   them back

note: while you can undelete a course via its sis id, this only
works if the course was _deleted_ via sis.  if you delete a course
via the UI or API, its sis ID is cleared.  this is by design:
https://gerrit.instructure.com/#/c/3520/

Change-Id: I402dd1e0bdfc6ae639e1781f16ae5e629ca9f87a
Reviewed-on: https://gerrit.instructure.com/18062
Reviewed-by: Mark Severson <markse@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
update boot.rb for the newest brightbox 1.9 packages and ruby 2.0

This doesn't add full ruby 2.0 compatibility, just fixes one bootup
issue. Brightbox backported a similar gem/require change to their latest
1.9 package, this fixes the same error with that package as well.

Change-Id: If2905f1f9fa0eb145efa1caefcf005b5f991f785
Reviewed-on: https://gerrit.instructure.com/18085
Reviewed-by: Stanley Stuart <stanley@instructure.com>
QA-Review: Stanley Stuart <stanley@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
fix having modules as course home page

Test Plan:
 * Set the course home page to be the modules page
 * It should load

closes CNVS-4201

Change-Id: Iead1fd3102cebd81d020fd3021c8059c0f68da1a
Reviewed-on: https://gerrit.instructure.com/18104
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
allow Setting.from_config files to be ERBs for test only

refs CNVS-2932

Change-Id: Ic6b025c8f78bdecdc9f1e2c31477fbe642afe278
Reviewed-on: https://gerrit.instructure.com/18101
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
strip invalid utf-8 from AR yaml columns serialized as binary by ruby 1.8

fixes CNVS-4174

Ruby 1.8 somtimes inserted invalid utf-8 into these columns using a
!binary tag, which 1.9 syck deserializes as ASCII-8BIT encoded. But then
it later blows up trying to append to a UTF-8 erb view or json output.

This adds a whitelisted set of columns for which we want to not only
strip invalid utf-8, but convert ascii encoded strings to utf-8 strings
and strip those too. These columns don't contain any binary data, so
that's an OK conversion to make.

Once Canvas only supports ruby 1.9, we shouldn't get any invalid utf-8
inserted even into serialized columns (YAML in 1.9 raises an exception
on serialization), so we won't need to keep this list up to date with
newly added columns, and we'll avoid accidentally converting a
serialized column that does contain binary data to utf-8.

test plan: rather than switching to ruby 1.8 and inserting bad data,
it'll be easier to just munge the database directly. create a
quiz_questions row with question_data that contains something like:

   question_name: !binary |
     oHRleHSg

then load the quiz in the UI using ruby 1.9. verify that you see a
question name "test" rather than a page error.

Change-Id: I8054026a06f28b1b61e05ba187bca8403a07fbb5
Reviewed-on: https://gerrit.instructure.com/18059
Reviewed-by: Paul Hinze <paulh@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
fix bad sql in refactored named scope

Change-Id: I6860fcb44c55e63cb84283061dd6c66582b72c8a
Reviewed-on: https://gerrit.instructure.com/18115
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
use mysql2 gem for mysql

closes CNVS-4199

Change-Id: I81a14efca365a61ff9e5d29892ec95ace64aabb3
Reviewed-on: https://gerrit.instructure.com/18089
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>