create group categories api methods

move group categories methods from groups_controller to group_categories_controller

fixes PS-79
fixes PS-80
fixes PS-108
fixes PS-109

test plan:

*check that group categories still works in ui for accounts, and courses via api

*you should be able to list/show group categories for a course as a teacher or ta via api

*you should not be able to list/show group categores for a course as a student via api

*you should be able to list/show group categories for an account as an admin via api

*you should be not be able to list/show group categories for an account as a non-admin via api

*you should be able to create a new group in a course using the api

*you should be able to create a new group in a account using the api

*you should be able to create a course group category in the api and have it automatically create groups

*you should be able to create a course group category  in the api and have it split students between groups

*you should not be able to use "split_group_count", "create_group_count", or "enable_self_signup" on a non course group category

Change-Id: Ied696a2c5571dad39eae6f0fe9e45692e6f8494c
Reviewed-on: https://gerrit.instructure.com/16820
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Dave Jungst <dave@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
remove trailing comma in cassandra create table

This worked in 1.1 but throws a syntax error in 1.2 (which we don't
support yet, but will soon enough)

Change-Id: Ide2d3a39dd1700d04cb7a00620d77af273bf282b
Reviewed-on: https://gerrit.instructure.com/16991
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
fix roles api doc for add_role

Change-Id: Ia8fd49e2004fde95679f945daa908dd07375d976
Reviewed-on: https://gerrit.instructure.com/17211
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
drop context_messages

left over cruft from a very long time ago, in case we needed to
revert stuff

test plan:
 * smoke test conversations

Change-Id: Ie222afc37dd17539e8e993857ed535c1bee4bade
Reviewed-on: https://gerrit.instructure.com/17197
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Return to previous Calender2 view after editing event.

Fixes #CNVS-2576, Fixes #CNVS-2515

Testing Notes:
===========
* In Cal2, change to "week" view and preferably select a
  week other than the default (to ensure it returns to the correct one)
* Click a "Calendar Event" and hit "more options".
* On the Calendar Event edit page, hitting "Cancel" or changing
   the event and hitting "Update" should redirect the user back
   to the calendar and return them to the week view previously used.
* Click the "popup" title to view the Calendar Event's show page.
  * Verify that the URL has a "return_to" component.
  * Clicking the "Back to Calendar" button will return to the
    previous calendar view.
  * Clicking the "Edit Calendar Event" button will respect
    the previous calendar view when hitting cancel or update.

NOTE: Using the "Calendar Event" read-only display link does not
return to the correct calendar week view. The nature of this page
will be changing making a fix invalid.

Change-Id: Iacd4a6e9b1de752fc3463c16ab8631ce4a941703
Reviewed-on: https://gerrit.instructure.com/17001
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
adding optional user arg to #default_frequency for use in a plugin

refs #CNVS-2648

Change-Id: Ie51025406679a1af314fc9438c3f56d124b6faec
Reviewed-on: https://gerrit.instructure.com/17039
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
spec: removing pending from kaltura specs

Change-Id: I1bbe702148a7054e3631634e012ed8433cbfce57
Reviewed-on: https://gerrit.instructure.com/17077
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jake Sorce <jake@instructure.com>
QA-Review: Jake Sorce <jake@instructure.com>
course batch update api

also adds a new Progress class and API endpoint for
managing new background jobs.

fixes #CNVS-561

test plan:
 * refer to the API documentation for Courses
   and Progress
 * use the Update Courses endpoint to offer, conclude,
   and delete multiple courses in a batch
 * use the Query Progress endpoint to check the
   status of a batch
 * make sure offering already published courses
   succeeds, and also concluding already concluded
   courses

Change-Id: I49d89c1f373f4999b6201574b43a20c53ef28b70
Reviewed-on: https://gerrit.instructure.com/16844
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
triple-stash support for handlebars i18n, fixes CNVS-3402

support interpolation of known safe variables (e.g. an input) using
{{{placeholder}}} in handlebars

some extra stuff:
* support flagging a placeholder as safe in i18n.js via %h{placeholder}.
  this is equivalent to raw'ing the value
* remove support for {{placeholder}} in i18n.js since we never use it.
  previously it would just issue a warning, now it will fail i18n:check
* remove support for %{placeholder} in handlebars since it's inconsistent
  with handlebars. using it will fail i18n:check

test plan:
* run specs and/or use the new triple-stash

Change-Id: Iade349ce90ec695590ae53328226d12dd935ac5b
Reviewed-on: https://gerrit.instructure.com/17209
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
fix inconsistent mini calendar ids and classes

fixes #CNVS-3330

Change-Id: I2544badad340b9ec582a39f7b7cb2b44267499a3
Reviewed-on: https://gerrit.instructure.com/17132
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Sterling Cobb <sterling@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
jenkins build summary

Change-Id: I783b53b9d3245d1361316d67964433f2e9ecef2d
Reviewed-on: https://gerrit.instructure.com/17171
Reviewed-by: Jake Sorce <jake@instructure.com>
QA-Review: Jake Sorce <jake@instructure.com>
Tested-by: Jake Sorce <jake@instructure.com>
update_all/delete_all with join support

refs CNVS-1171

test plan:
 * run specs; will be used by more code shortly

Change-Id: Ib58e664f6f6437a0a328944aa54cdc5871d94f2a
Reviewed-on: https://gerrit.instructure.com/17108
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
fix user detail view errors

fixes #CNVS-3432

stack traces were coming up in production with
the error "must be a root account".  
granting the manage_logins permission on the
user model involved checking all user accounts
for subset permissions by loading up and then
examining all account users in every one of 
a user's accounts, something that raises
an error in the account.rb model unless the accout
being examined is a root account.  This
fix changes that permission check to only
examine root accounts, and also provides a
backup edge-case handler in 
#has_subset_of_Account_permissions? which
just returns false if the account being examined
is not a root account.

TEST PLAN:

1) login as a local admin

2) go to the detail page for a user
within the context of an account, in particular
one where the user being examined is affiliated
with at least one non-root account:
example (https://wharton.instructure.com/accounts/81471/users/1189725)

3) you should not get any internal server errors,
and should be able to view the user's details.

Change-Id: I3a3995581bcc9bc7eb4074ea3f1ddeb66c598344
Reviewed-on: https://gerrit.instructure.com/17249
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
fix some calendar events api spec failures

specs should stop making assumptions about the order events
appear in when they occur at the same time. fixes #CNVS-3455

Change-Id: Ibd3406496c3ff0ec175dc252b86ee1591d4cdeb5
Reviewed-on: https://gerrit.instructure.com/17254
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
don't mutate the cached permissions hash

permission_json was changing permission[:enabled] to true, which could
then mess up the in-process cache. RoleOverride.enabled_for? doesn't
handle true values, and subsequent page loads start erroring out.

also freeze cached hashes so we don't introduce issues like this in the
future

test plan:
1. go to /accounts/<id>/permissions as an account admin not enrolled in
   any courses (this was one way i could repro it consistently)
2. confirm canvas doesn't start blowing up when you navigate elsewhere

Change-Id: Ide611124df9a7cebc2e18385c6b7a1e1fa114625
Reviewed-on: https://gerrit.instructure.com/16681
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
indicate overridden due dates on quizzes index

show an overridden due date, or
"Multiple Dates" if there are multiple unique dates

(also some changes for consistency's sake to
context modules vdd)

test plan:
* override section due dates for a quiz
* confirm that a single due date is reflected on the quiz index
* confirm that multiple due dates are reflected

closes #CNVS-749

Change-Id: Ib59a4af4a52134514bb296906109346eeeb027d3
Reviewed-on: https://gerrit.instructure.com/17118
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Submission API: Return comment author avatar URL

Closes CNVS-2833

Test Plan:
- Make an assigment with a comment.
- Use the Submission API to GET that submission, including
  submission_comments in the response.
- Verify that the commenter's avatar URL is included in the response.

Change-Id: Ic344f1c66987f61e70d1db854ebd7378ede3814f
Reviewed-on: https://gerrit.instructure.com/17231
QA-Review: Adam Phillipps <adam@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
stop google docs endless authorization loop.

fixes CNVS-3413

when submitting an assignment with a google doc, user
was previously presented with an endless authorization
loop; google docs list was never displayed. this commit
restores proper behavior.

test plan:
  * create an assignment that allows online submissions;
  * as a student, attempt to submit the assignment as a
    google doc (if you have not already authorized google
    docs access, you will need to do that first);
  * verify that the student is presented with a list of
    their available google docs and not asked to
    re-authorize their google docs access.

Change-Id: Iba9ffda7e35a88aa67b856689680c894a44c4532
Reviewed-on: https://gerrit.instructure.com/17265
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
better display of short events in calendar2 week view

fixes #CNVS-2571

Test Plan:
 - Go to the calendar2 week view.
 - Create a short event (say 15 minutes or less).
 - The event should be tall enough to display one line of text,
   as if it were a 30 minute event.
 - Check the tooltip for the event and make sure it displays
   the correct start and end time for the event.
 - Click on the event a check the popup dialog displays the
   correct times.
 - Click the edit in the popup to bring up the edit dialog box
   and check the edit box shows the correct times.
 - Change the event's times in the edit dialog, but keep it a
   short event.
 - After clicking save, the event should still appear as tall
   as a 30 minute event while it is semi-transparent during the
   ajax request. When the ajex request completes and the event
   turns opaque again, it should still appear as tall as a 30
   minute event.
 - Create another short event starting at the same time the
   first event ends.
 - The two events should be displayed staggered, as if they
   were overlapping events.
 - Drag-and-drop a short event to a new time. It should start
   at the new time, but its duration should not have changed.
 - Resize an event using the bottom resize handle. The event's
   start time should not change, but the duration of the event
   should change.
 - Check for similar behavior in the scheduler view and
   scheduled appointments.
 - Check for regressions in assignments, assignment overrides,
   and scheduler.

Change-Id: I325f79c12c43fe789fb328014a3a3de8d7499121
Reviewed-on: https://gerrit.instructure.com/17045
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
fix cross-shard role override lookups

fixes CNVS-3360

test plan:
 * add a user as a site admin, in a role other than AccountAdmin,
   with all permissions in that role
 * attempt to masquerade as an AccountAdmin in an account on a
   different shard
 * it should work

Change-Id: Icf06e98b6487d1d74c09326ebf2be2e5f0e24008
Reviewed-on: https://gerrit.instructure.com/17260
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>