hide events for appointments that a student hasn't signed up for

fixes #CNVS-1881

for calendar2
event still shows up on the calendar for students who are signed
up for the appointment and on the calendar for anyone who can
manage the appointment group

test plan
-as a teacher, create an appointment group
-as a student, sign up for a slot in the appoinment group
-as that same student, ensure that an event appears on the calendar
 for the appointment
-as a different student who is not signed up for the appointment
 group, ensure that an event does not appear on the calendar for
 the appointment
-as a teacher, ensure that an event appears on the calendar for
 the appointment

Change-Id: I458c849cd675dadf3384b545c1162f00905f6018
Reviewed-on: https://gerrit.instructure.com/16452
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
spec: clear attachment domain_namespace before each spec

This fixes some failures that happen depending on spec ordering

Also fix a selenium spec bug that was trying to turn an Announcement
into an assignment discussion.

Change-Id: Ic252844ae348642ea66f02cfedbd735d1eeb1d53
Reviewed-on: https://gerrit.instructure.com/16582
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
spec: fix ruby 1.9 only spec helper

Change-Id: I8183b8690583736674424359dcc6924785d50ad3
Reviewed-on: https://gerrit.instructure.com/16587
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Shawn Meredith <shawn@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
Display "Multiple Due Dates" on speedgrader when applicable. Fixes #CNVS-740

On SpeedGrader, when an assignment has multiple due dates, in the header,
display something to let the grader know that.

Testing Notes:
==========
* Using an assignment with no due date, visit SpeedGrader and verify
   that it says, "due: No Due Date"
* Using an assignment with a single (no override) due date, visit
   SpeedGrader and verify that it says "due: <the date>"
* Using an assignment with multiple override due dates, visit
   SpeedGrader and verify that is says "due: Multiple Due Dates"

NOTE: This also changes the previous behavior of not showing anything for a
due date when the assignment didn't have one to now showing
"due: No Due Date" when there is no due date. This is because the assignment
might have no due date but an override might specify one.

Change-Id: I1337015eef623f9579be3af990c8651cacd957af
Reviewed-on: https://gerrit.instructure.com/16391
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
spec: gradebook_spec.rb syntax issue`

Change-Id: Ib4d8861be2ee0730866fd91025479186e2596cf8
Reviewed-on: https://gerrit.instructure.com/16609
Reviewed-by: Jake Sorce <jake@instructure.com>
Tested-by: Jake Sorce <jake@instructure.com>
QA-Review: Jake Sorce <jake@instructure.com>
don't store the page view if it has no user

These page views won't ever be queried anyway, so storing them is
pointless.

Change-Id: I8242c50be32f626d64caa528e7a5fd3a921af461
Reviewed-on: https://gerrit.instructure.com/16572
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
respect assignment overrides in gradebook1.

fixes #CNVS-470

when calculating assignment lateness in gradebook,
consider assignment overrides by looking @ the cached
"late" value on the submission and not comparing the
assignment due date against the submission date.

test plan:
  * create an assignment due in the past with an override
    due in the future;
  * submit the assignment both as a student the override
    applies to and a student the override does not apply
    to;
  * as a teacher or admin, visit gradebook1 and verify that
    the late submission appears late and the on-time
    submission is not marked as late;
  * click the typewriter icon on both submissions to view
    the submission details popup and verify that it also
    respects each submissions timeliness/lateness.

Change-Id: Ib80e6c83d6075e05fa674ac3c0160977179e01d2
Reviewed-on: https://gerrit.instructure.com/16351
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
add support for applying role overrides to just self or just descendants

 * wrap RoleOverride#permission_for with enabled_for? that also takes a
   context of where the permission is being applied, and recalculates its
   enabled-ness relative to that context; use that for checking account
   admin and enrollment permissions
 * refactor User#can_masquerade to properly check for descendant
   permissions

test plan:
 * create a custom role in site admin. give it permission to
   manage permissions
 * in script/console, find that override and set apply_to_self=false
 * add a user to that role, and login as that user
 * the user should not be able to change permissions in site admin
 * the user should be able to change permissions in the default
   account
 * add another role in site admin. give it permission to manage
   permissions
 * in script/console, find the override and set apply_to_self=true,
   apply_to_descendants=false
 * add another user to that role, and login as that user
 * the user should be able to change permissions in site admin
 * the user should not be able to change permissions in the default
   account
 * the first user should not be able to masquerade as the second user
   and vice versa
 * an Account Admin should be able to masquerade as either user
 * create a custom role in the default account, give it permission
   to manage permissions, and add a user to that role
 * the first user should be able to masquerade as the new user;
   the second user should not be able to masquerade as the new user

 * general regression tests on permissions and masquerading

Change-Id: I20a1183b7dfec419634a92cda498f245187060ef
Reviewed-on: https://gerrit.instructure.com/15896
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
parallelized gem update to handle rspec thread failures

Change-Id: I37ad7bcdc788182e5d9f3889c4eb33e561c37b57
Reviewed-on: https://gerrit.instructure.com/16602
Reviewed-by: Jake Sorce <jake@instructure.com>
QA-Review: Jake Sorce <jake@instructure.com>
Tested-by: Jake Sorce <jake@instructure.com>
Support "Switch Views" when editing a calendar event's description. Fixes #CNVS-458

When creating a new CalendarEvent or editing an existing one, the description
uses the TinyMCE editor but there was no way to toggle between HTML and
source versions. This adds that ability.

Testing Notes:
=============
* As a user, create Calendar event on either
  Calendar1 or 2. Click the "more options" link
  which takes you to a dedicated edit page.
* Between the title and description, there should now
   be a "Switch Views" link that toggles the editor
   between HTML and source view.
* It should work for any user (teachers or students).
   There is nothing user-specific about it.

Change-Id: Icfd5b58dc7708bf9b2d75312983629af5e505ea9
Reviewed-on: https://gerrit.instructure.com/16475
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
respect assignment overrides in gradebook2

fixes #CNVS-472

When determining lateness of an assignment, use the cached late
value of the submission instead of doing manual comparisons.

test plan:
 * create an assignment due in the past with an override
   due in the future
 * submit the assignment both as a student the override
   applies to and a student the override does not apply
   to
 * as a teacher or admin, visit gradebook2 and verify that
   the late submission appears late and the on-time
   submission is not marked as late
 * check the mouse-over text on both submissions to make sure
   they display the lateness of the submissions correctly.

Change-Id: I4a77d2f065402babd737f887c08dfb844c342cbf
Reviewed-on: https://gerrit.instructure.com/16356
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Jon Willesen <jonw@instructure.com>
don't show time for all day calendar events

fixes #CNVS-2582

test plan
- create an all day event
- ensure that the details popup shows only the date, not the time
- create a not all day event
- ensure that the details popup shows the time as well as date
- ensure that other event types like assignments and quizzes are
  unchanged

Change-Id: I4bd1cedcd33d098caf40a9d63fd62324b3e92183
Reviewed-on: https://gerrit.instructure.com/16599
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
disable XML params parser

Change-Id: I68b9fd05f6f33f4af5377b1fe9df5e7d3f68db08
Reviewed-on: https://gerrit.instructure.com/16632
Reviewed-by: Zach Wily <zach@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>