Commit Graph

411 Commits

Author SHA1 Message Date
Brad Humphrey aade19a079 allow 3rd parties to use oauth for authentication
adds scopes to access token and a new scope, 'userinfo'. when this scope is
used, a user may choose to remember authorization for a 3rd party. when this
option is selected, subsequent requests for an access token scoped to userinfo
will skip the the step where the user authorizes the app and will return userinfo
but no access token.

test plan:
* follow the oauth token flow adding a param for scopes=%2Fauth%2Fuserinfo to the initial request
- check the box for to remember authorization
- click login
* repeat the above request
* you should not see the request access page

* delete the tokens that were generated above
* run the test above, this time not remembering access
* you should see the request access page on the second request

Change-Id: I303a55d3c71de517ce6aa5fd8acd74d89aa4c974
Reviewed-on: https://gerrit.instructure.com/17604
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-03-18 14:53:29 -06:00
Bracken Mosbacker b03b6645fb create migration issues and start content migration api
this will allow migrations to have flexible todo items
and allow us to make a super awesome UI for helping
teachers fix any migration problems

Test Plan:
 * Run a migration that has issues. :)
 * exercise the issue api

closes CNVS-4230

Change-Id: I4577f811dd3b16aa200d381f039632b7cc2cd184
Reviewed-on: https://gerrit.instructure.com/18639
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2013-03-18 12:21:58 -06:00
Brian Palmer 5347ef0fad remove the has_custom_fields plugin from vendor/
This was written 2 years ago and never used, I've verified the DB tables
are empty.

Change-Id: I405e009be2eb657c4ebfb63da21dbcfee92efc0d
Reviewed-on: https://gerrit.instructure.com/18564
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2013-03-13 13:33:38 -06:00
Simon Williams 83793ecbbb fix incorrect media_recording submission types
fixes CNVS-4588

test plan:
- enable the kaltura plugin
- find an old assignment that is set up to accept media recordings
- make sure that 'online media recording' is checked in the assignment view
- create a new assignment that accepts media recordings
- make sure the show page says "a media recording" under 'submitting'

Change-Id: Ia166c532f5ede0390afb2226d3cf4fb335814cf2
Reviewed-on: https://gerrit.instructure.com/18525
Reviewed-by: Stanley Stuart <stanley@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
2013-03-12 13:58:01 -06:00
Brian Palmer 77ca8ac013 remove deprecated rails constant usage
basically convert RAILS_ROOT -> Rails.root , RAILS_ENV -> Rails.env ,
RAILS_DEFAULT_LOGGER -> Rails.logger

This is necessary for rails 3

Change-Id: I138e1aa217fa8fb186d23ac09b04031c1e2b665e
Reviewed-on: https://gerrit.instructure.com/18412
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Eric Berry <ericb@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-03-11 12:14:08 -06:00
Bracken Mosbacker a97298c99b create attribute for lti_guid on accounts
This allows us to make changes with how we generate that
id without breaking tool providers who depend on the old
way

This also sets the lti_quid to the value it was before the
1c6ae6979e change

Test Plan:
 * Exiting root accounts lti_guid attribute should have the domain name in it
 * New accounts will use the accounts UUID and thus have no domain name

refs CNVS-3829

Change-Id: Ib5b10cb097d3f0e5c562d1af70f5770217418e63
Reviewed-on: https://gerrit.instructure.com/18481
Reviewed-by: Zach Wily <zach@instructure.com>
QA-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
Reviewed-by: Stanley Stuart <stanley@instructure.com>
2013-03-10 22:03:10 -06:00
Brian Palmer 77e22c3aba add index for content_tags learning_outcome_id
This is a common query in learning outcomes code, and was totally unindexed

Change-Id: I37b96cbaf62235a08a51ba6abce3ee1d7c17a271
Reviewed-on: https://gerrit.instructure.com/18401
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2013-03-07 17:01:40 -07:00
Duane Johnson 5d6215c3a6 add last_activity_at to enrollments
caches the last page view on a course on the enrollment in an
after_filter

Test Plan:
  - visit any page in a course
  - in the console, the student's enrollment should have a
    'last_activity_at' value that is recent

fixes CNVS-3825

Change-Id: I0ea38eb6399f4ea65617bb6a3e5f79dc8db9415c
Reviewed-on: https://gerrit.instructure.com/18154
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Paul Hinze <paulh@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-03-04 12:43:56 -07:00
Cody Cutrer 33d1a8f7fe fix migrations so they can run transactionally
refs CNVS-3902

even if the preference is that they don't

test plan:
 * bring up a fresh database
 * it should not fail

Change-Id: I5e7b2cf8479de4b3f1564ee65cd1cb456ae4674e
Reviewed-on: https://gerrit.instructure.com/17873
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-02-28 07:56:37 -07:00
Cody Cutrer 56e317e4ab 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>
2013-02-27 14:10:37 -07:00
Mark Ericksen 91f957bba0 clean up Notification creation in 'rake db:initial_setup'
identify "Reminder" category notifications as deprecated

fixes CNVS-3918, CNVS-3824

Explicitly run through 'rake db:load_notifications'

Testing Notes:
===========
* Run 'rake db:load_notifications'
* verify that it runs without error
* verify the 3 "Reminder" category entries
   have their category changed to "DEPRECATED - Reminder"
   Those are the following entries:
   * Assignment Publishing Reminder
   * Assignment Grading Reminder
   * Assignment Due Date Reminder
* If desired, define a new notification type in
   /app/messages/notification_types.yml
   and verify that after rake task is run,
   the new entry appears.
* Test setup of new database

Change-Id: Ib5dc69c7adc7a643f08ada94d9048274d8cd4e12
Reviewed-on: https://gerrit.instructure.com/17948
QA-Review: Marc LeGendre <marc@instructure.com>
Reviewed-by: Joel Hough <joel@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-02-22 17:15:05 -07:00
Zach Pendleton 46e5b9027d remove body, sms_body columns from notifications.
fixes CNVS-3917

the notifications table had vestigial `body` and `sms_body`
columns that canvas no longer uses. this commit drops those
columns.

test plan:
  * back up your database (unless you want to keep this
    commit on your master branch forever);
  * run migrations;
  * verify that notifications still send as expected;
  * for extra credit, configure canvas with a new database
    and verify that db:initial_setup still works without
    any errors.

Change-Id: Icc7d8c4e926b5ea0ecb8c3814fdc95481037a0c9
Reviewed-on: https://gerrit.instructure.com/17892
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
2013-02-22 16:07:21 -07:00
Zach Pendleton dbb259e62d support html emails.
fixes CNVS-65, CNVS-3921

test plan:
  * copy app/messages/new_discussion_entry.email.erb to
    /app/messages/new_discussion_entry.email.html.erb;
  * create a new discussion in a class with at least two
    users (who have their discussion entry notifications
    set to "immediately");
  * as user 1, post a reply to the discussion;
  * verify that user 2 receives a multipart email with
    an html part and a plaintext part.

Change-Id: I30e3e15fa53817767c770491ab8c19286281e0aa
Reviewed-on: https://gerrit.instructure.com/17964
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-02-22 12:37:36 -07:00
Cody Cutrer bf4ce2fadb this migration needs to be sync now
since a later migration will drop the table it works on

Change-Id: I37bd431b980a2e27622414fdbdc2c403efb086f8
Reviewed-on: https://gerrit.instructure.com/17818
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2013-02-18 12:14:59 -07:00
Cody Cutrer ae5d165fdb concurrently, not concurrent, to be nice to the db
Change-Id: I0f0a20440725a97e732f764eaf1d8856333ee371
Reviewed-on: https://gerrit.instructure.com/17795
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
2013-02-16 00:39:54 -07:00
Brian Palmer bf3f2dbb7c create gist indexes concurrently
Change-Id: If4f1d6cfee765843d7cb83d0e5132f4a415933c5
Reviewed-on: https://gerrit.instructure.com/17794
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
2013-02-15 23:10:06 -07:00
Cody Cutrer db0bf46471 clean up course account associations
closes CNVS-3417

test plan:
 * after the migrations are run, ensure that every section has at
   least one entry in CourseAccountAssociations in the database
 * smoke test SIS imports

Change-Id: I261cad633788efbf4b0c64db34436ef695856fee
Reviewed-on: https://gerrit.instructure.com/17256
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2013-02-08 16:33:25 -07:00
Cody Cutrer c5bd3b122c this migration is non-transactional in dev
Change-Id: I1698e157f1dbcfdc44c5d66bbff6489e6b7c4476
Reviewed-on: https://gerrit.instructure.com/17419
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-02-04 12:33:38 -07:00
Jon Jensen f9e4b4f4ed context profiles, refs CNVS-2650
add Profile model which can be used by context-y things, and a basic
CourseProfile model

test plan: N/A, see https://gerrit.instructure.com/17020

Change-Id: I68f4a5a4f0913167e7e25e7bc231b5bf8394c335
Reviewed-on: https://gerrit.instructure.com/17019
Reviewed-by: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-02-01 17:57:07 -07:00
Cody Cutrer 996a457bdc make assignments_needing_x shard safe
fixes CNVS-2200

normalize ignores out of the users.preferences column into
its own table. makes it more performant, and shard safe

test plan:
 * add a user as a teacher in courses on two different shards
 * set up an assignment needing grading (i.e. have a student
   submit an assignment that requires grading) in both courses
 * the assignment should show up on the teacher's dashboard
   regardless of which shard he's on
 * ignore the assignment on your dashboard on one shard
 * reload - it should stay gone
 * it should also be gone on the other shard
 * have another student submit to that assignment
 * it should come back on both shards for the teacher
 * ignore it, permanently this time
 * have another student submit to that assignment
 * it should still be gone on both shards

Change-Id: I6646410273c6be05d4b21b29b6ab76feb8e65d0f
Reviewed-on: https://gerrit.instructure.com/17295
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-02-01 17:08:41 -07:00
James Williams 67b9f83722 don't allow multiple root folders for courses
change the way we create the default course root folder
("course files") to use a atomic sql statement

this should prevent suspected race conditions from creating
multiple root folders for a course, as this causes the
files page to become unusable

test plan:
* Unfortunately there seems to be no consistent way to
 reproduce the errors, and thus no consistent way to
 test that this fixes the error

Change-Id: I223a2b230921752ef1175c82adfdd854e1331668
Reviewed-on: https://gerrit.instructure.com/17014
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Bracken Mosbacker <bracken@instructure.com>
2013-02-01 16:02:16 -07:00
Bracken Mosbacker 26ec655a8d Allow uploading subtitle tracks to videos
when you upload a video, you will now see a [cc]
box in the player for that video if you are
the uploader of that video and in a modern browser.
it will have a link to upload a caption track in
SRT or WebVTT format in any language you specify.

once you attach a caption track to any of your
videos, other people that view it will be able
to choose that track while playing it.
helpful for people that are deaf or that speak
another language!

this change also adds google analytics tracking to
videos so we know when a given media_id was
played, paused, and ended.

Test Plan:
* record a video, go to play the video
* you should see a [cc] button
* click the "upload subtitles" link, a dialog should appear
  that lets you choose a language and file to upload.  here's
  one you can test with:
  http://mediaelementjs.com/media/NT113_u008_v005_transcript.srt
* refresh, you (and anyone else that can see video)
  should now have the option to select that track
  for subtitles. (if using in HTML5 player)
* you should see a delete 'x' on it to delete
  it, when you click it it should go away. reload
  to make sure it is not there.
* The user who created the video, or any admins of the course
  the video is in should be able to manage these captions

closes CNVS-324

Change-Id: Id6d4abcb581f0daf101d601221dc45edaad6eaa8
Reviewed-on: https://gerrit.instructure.com/16882
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2013-02-01 12:53:16 -07:00
Cody Cutrer 357429ae14 handle private hashes for sharding
refs CNVS-1171

test plan:
 * begin a conversation with a (single) user from a different shard
 * "re"-begin a conversation with the same user from a different
   shard
 * it should re-use the old conversation
 * repeat, but using conversation batch (the async option in the API,
   I think)
 * begin a conversation between a teacher and a student on a different
   shard
 * have that teacher comment on a submission from that student
 * the submission comment should show up in the existing conversation

Change-Id: I8d11de0e7a1d6e9c9ff8cbfc727819aedacd6602
Reviewed-on: https://gerrit.instructure.com/17026
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-01-31 19:23:21 -07:00
Cody Cutrer e8e81deb5b Cross-shard conversations
fixes CNVS-1171

test plan:
 * full conversations regression test
 * initiate a conversation with a user from another shard
 * reply to that conversation from both the sender and the
   receiver
 * repeat for a group conversation involving two or more
   shards
 * repeat for huge batch conversations with hundreds of
   users and two or more shards
 * known NOT working yet:
   * re-using the correct cross-shard private conversation
   * probably the tagging of messages with Course x,
     Group y, etc.

Change-Id: I52549039875941cd518077cea4e28bfd2bc10dbf
Reviewed-on: https://gerrit.instructure.com/16523
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2013-01-31 17:11:48 -07:00
Cody Cutrer e71558bbc3 clean up user account associations
refs CNVS-1338

test plan:
 * run the migration on production-like data
 * it should not fail

Change-Id: Ib8527f2cbee05d5e00941286f16c245091b1a2d9
Reviewed-on: https://gerrit.instructure.com/17117
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2013-01-31 10:41:55 -07:00
Simon Williams 6b2185cf36 remove course.allow_student_assignment_edits
this was a course setting which allowed students to edit assignment
descriptions only.  unfortunately, it didn't work, because the form validation
code assumed a title input field would be present and tried to require that it
was there.

closes CNVS-3267

test plan:
- make sure the setting is not availble in course settings
- make sure students cannot edit assignments
- make sure teachers can still edit assignments

Change-Id: Iebeaa00f357a59bff8462ecde79c57d68c04320f
Reviewed-on: https://gerrit.instructure.com/17056
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Myller de Araujo <myller@instructure.com>
2013-01-31 09:20:58 -07:00
Jeremy Stanley bb005dda58 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>
2013-01-29 14:06:03 -07:00
Cody Cutrer 1adac7579a 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>
2013-01-28 17:55:11 -07:00
Brian Palmer c35b234480 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>
2013-01-28 16:16:53 -07:00
Cody Cutrer 54c502c9f8 add index on conversation_messages(author_id)
so that user merges don't kill the db

test plan:
 * merges of users with lots of conversations should be faster

Change-Id: I4cc8f9cc081f205639999c8486e9604d23bc0ff5
Reviewed-on: https://gerrit.instructure.com/17167
Reviewed-by: Jon Jensen <jon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-01-28 11:01:16 -07:00
Ethan Vizitei b1d8f2ef3b user searching module
refs #CNVS-2326

Added a UserSearch module that provides
and interface for searching across the name,
the email, and the sis id (and the database id),
and added a trigram index on the columns
that will be searched against.

also made a slight refactor to the AR
initializer in order to expose
some of the behavior I wanted more granularly
and added some specs to cover it

fixed a small permissions bug in course.rb
and pulled some scoping out of the courses
controller down into the user search module

TEST PLAN:
  This is currently not accessible from
the site itself, this is just the ground
work for the eventual user search api endpoint.
The code is not called by anything currently in
production either so there is no need for
regression testing.  The one thing to check would
be the creation of new users (and pseudonyms and
communication channels).  There have been new
indexes added to columns on those tables
and there is some documentation indicating
that writing to these indexes can be time
consuming if the data set is quite large.  It
would be worth making sure that there have not
been any unacceptable performance regressions
in the creation of any of those record types in
a database that has a full load of data
(comparable to the production environment)

Change-Id: I8fb13a6ec714f27efc8012c5ed2bed4d963c24e6
Reviewed-on: https://gerrit.instructure.com/16459
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2013-01-21 17:25:32 -07:00
Cody Cutrer 795ac516d6 add a specific setting for self registration refs #2660
test plan:
 * a fresh account should not be able to visit /register
 * enable self_registration in script/console for the account
   (see the migration)
 * you should now be able to visit /register
 * no other changes should be visible

Change-Id: Ibfd6a0d23d3c3e37243ffb762e284b8907cd45cc
Reviewed-on: https://gerrit.instructure.com/16713
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
2013-01-11 10:19:39 -07:00
Cody Cutrer 5db8700b1a this migration is non-transactional
Change-Id: Ia54bd05cc58ee95160b52dd27c918df2bba005eb
Reviewed-on: https://gerrit.instructure.com/16719
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2013-01-11 09:04:06 -07:00
Brian Palmer 41279b9251 fix HashAccessTokens migration
Avoid using the model, since the column may have already been added to
dropped_columns

Change-Id: I6d7eb623875572ebc3efe9c16e8f677d0fc61dc2
Reviewed-on: https://gerrit.instructure.com/16690
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
2013-01-10 10:12:10 -07:00
Cody Cutrer 1e339db4c5 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>
2013-01-08 11:01:13 -07:00
Zach Pendleton a69f77218d add groups to collaborators table, add api endpoint.
refs #CNVS-1160

adds group_id to collaborators table to identify
collaborators associated w/ a group versus collaborators
added as individuals.

also adds a new API endpoint to return collaborators for
a given collaboration.

test plan:
  * run migrations to add the group_id column;
  * create new collaboration and add at least one user
    as a collaborator;
  * in the console, add a group as a collaborator, giving
    it a group_id and no user_id;
  * make a GET to /api/v1/collaborations/:id/members
    and verify that users added as individuals are
    returned as type 'user' and that users added with
    group_ids are returned as type 'group' and not
    displayed as individuals.
  * verify that one record exists for each collaborator
    regardless of type;
  * verify that adding per_page params will paginate
    requests to the endpoint.

Change-Id: Id509fd0e7eebe6a889b2ca86e8d7d8d1a9e93c63
Reviewed-on: https://gerrit.instructure.com/16203
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Mark Ericksen <marke@instructure.com>
QA-Review: Marc LeGendre <marc@instructure.com>
2013-01-04 20:18:04 -07:00
Cameron Matheson f842c4ba4c cache submission lateness
fixes #CNVS-1295

* Adds a new 'late' field to submissions
* Adds compute_lateness method to submissions which
  is called on every save when the 'late' field is nil
  or when the submission time changes
* Adds after_save callbacks to Assignment and
  AssignmentOverride to recompute lateness on submissions
  in a background process
* Includes data migration for initializing the value of the
  new cache field

Change-Id: I68d47fdbcbb167bef8428b6ecd48bf6f66ef8cb7
Reviewed-on: https://gerrit.instructure.com/16086
QA-Review: Amber Taniuchi <amber@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-12-26 15:37:18 -07:00
Jon Jensen 92c4bfdd37 self enrollment caps, refs #CNVS-1120
add support for self enrollment caps to limit the size of a particular
course. there is no UI for setting caps (yet)

test plan:
1. run specs
2. follow test plan for https://gerrit.instructure.com/15819

Change-Id: Ibf0a8f04f0c2efa820d0850cef26dfae20849246
Reviewed-on: https://gerrit.instructure.com/16021
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Joe Tanner <joe@instructure.com>
QA-Review: Cam Theriault <cam@instructure.com>
2012-12-19 12:29:58 -07:00
Dave Donahue 3b3b746cca vdd backend for quizzes
[Fixes #CNVS-1145]

* Adds support for attaching AssignmentOverrides to quizzes
* Links common overrides for Assignments that belong to Quizzes
  so quiz.due_dates_for(user) == quiz.assignment.due_dates_for(user)
* Moves common functionality for VDD out of the Assignment model
  and into the DatesOverridable module, which is now included on
  Quiz for a consistent interface

Test plan:
* Run through a few of the old VDD scenarios and verify things
  still work as expected since a lot of code has shifted around
* No interface changes have been made to quizzes yet, so nothing
  to check there

  https://gist.github.com/f12b3694016f3dcc979e

Change-Id: I32b4a54273f90fac689e05174039b8efc952dd39
Reviewed-on: https://gerrit.instructure.com/16028
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
2012-12-18 14:28:34 -07:00
Cody Cutrer 0560a390dc drop backwards compatible stream item columns
test plan:
 * full regression test on dashboard stream items and activity
   stream in the API

Change-Id: I7739fd7d7ea6350f6f7088b7736fd5d287e9384e
Reviewed-on: https://gerrit.instructure.com/15487
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ethan Vizitei <ethan@12spokes.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2012-12-18 10:25:41 -07:00
Cody Cutrer bd50b1eddd make invitation previews a setting closes #11985
test plan:
 * follow a link to an invitation in the default account
 * you should be able to look around the course before accepting
 * follow a link to an invitation in a non-default account
 * it should immediately accept the invitation or send you through
   the registration process if you are not logged in
 * enable invitation previews in the settings for the non-default
   account
 * follow a link to an invitation in that account again
 * it should now allow you to preview the course before accepting

Change-Id: I92bde85e0cae9dc4167f5ebd2e32cbbc06aa4242
Reviewed-on: https://gerrit.instructure.com/15636
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-12-05 09:45:34 -07:00
Jeremy Stanley 8c609bf92e enforce unique role names within an account
also fix a bug in the spec where we weren't testing what we
thought we were testing

test plan:
 1. try to create two roles with the same name
    in the same account.  this should fail.
 2a. create a role.
 2b. change a permission in the role.
 2c. delete the role.
 2d. create a role with the same name as the one
     deleted in the last step.  this should
     succeed.
 2e. the permission change made in 2b should not
     be present in the newly created role

Change-Id: I3d7eb3a3f14c75eb42d1a1da22603b41c7e25b94
Reviewed-on: https://gerrit.instructure.com/15743
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-12-04 13:52:25 -07:00
Stanley Stuart f4b8c3c8ef add the ability to take quizzes one question at a time
fixes #11781

This commit also adds the ability for quiz creators to restrict students
to only submit their answers for a question once, preventing them from
returning to a question they have already answered.

test plan:
- create a normal quiz, a 1-question at a time quiz, and a quiz that locks
  answered questions
- as a student, take each of these quizzes, making sure they work as expected
- make sure to use the next/previous buttons, the sidebar links, and try
  submitting in the middle of a quiz vs at the end of a quiz
- try to get back to a previous question on a locks answers quiz, make sure
  there is no way to do this.
- normal quizzes should function as you would expect.

Change-Id: Icb7efc646a51549269e3a4ead2c7f34b00e94103
Reviewed-on: https://gerrit.instructure.com/15292
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Stanley Stuart <stanley+gerrit@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Dave Donahue <dave@12spokes.com>
2012-12-01 22:59:31 -07:00
James Williams f06cfbf0f6 migrate account membership types to new role engine
test plan:
* migrate and confirm that the csv in
 account.membership_types is now split into
 Role objects with base_role_type of
 'AccountMembership'
* also, roleoverrides that aren't referenced
 in membership_types are assumed to have been deleted
 so confirm that a Role is still made
 but it is 'inactive'

Change-Id: Ic96c0ecdfd70e5678f74467686a9c9f385e53725
Reviewed-on: https://gerrit.instructure.com/15712
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-11-30 16:42:24 -07:00
Brian Palmer f59e84b664 optimize the page views cassandra migrator
refs #11772

The previous strategy didn't perform as hoped, so we've switched to the
(account_id, created_at) index. This required storing a separate
progress state per account_id so we can migrate one account at a time.

At the same time I decided to switch from newest-first going backwards
to oldest-first going forwards. This will make it easier to do the
entire migration while still on db page views, then switch to cassandra
page views, then do a 2nd migration just to move over the small # of
page views created in the interim.

test plan: generate some db page views in multiple accounts. then switch
configuration to cassandra page views. run rake
db:migrate_pageviews_to_cassandra and the existing db page views should
now be in cassandra, including showing up in the user's page view
history.

Change-Id: Ic748376032a4305a0537f398670fb37ee17b071c
Reviewed-on: https://gerrit.instructure.com/15489
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-11-30 13:30:03 -07:00
Cody Cutrer d10832b605 fix needs grading count trigger for mysql. fixes gh-245
test plan:
 * use mysql
 * accept a course invitation

Change-Id: I8307c2d5925f85dd3be7c4aded6fa822518be3b2
Reviewed-on: https://gerrit.instructure.com/15716
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
2012-11-30 09:22:10 -07:00
Ethan Vizitei c8b1c36d6f refs #8395 expanded page views
force a page_view record when
submitting an assignment
and when updating an assignment
description

force a page_view when
starting a new discussion
or when replying to a discussion

force a page_view when updating
a wiki page and when joining
a conference and when starting
a collaboration

start tracking http methods for
page views

don't link through to urls
for page views if they aren't 'get'
methods

pull some of the page_view logging
down into the asset_user_access
object and simplify it so
that the application controller is
more readable and the scoring incrementing
is easier to understand

TEST PLAN:
  1) login as a student
  2) turn in an assignment submission
  3) take a quiz
  4) update an assignment description
  5) start a discussion and reply to it
  6) login as an admin and confirm through
     analytics and through the detailed
     page view listing that all these
     actions counted as participations
     (and that the ones that are not
      'get' methods can't be clicked through
      from the student accound details page)

Change-Id: I2dfe4df41e8b006e6a0c0d8a1f914ecd7fb62477
Reviewed-on: https://gerrit.instructure.com/15428
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-11-30 08:34:18 -07:00
Cody Cutrer bdbeeb992d cross shard dashboards
two major pieces:
 * use context_type/context_id instead of context_code for
   three relations so that sharding extensions will
   automatically work
 * deserialize stream item data as actual AR objects instead
   of OpenObject (for similar reasons)

test plan:
 * run the predeploy migration, but not the postdeploy one
 * view your dashboard on a shard other than your home shard;
   it should be identical to your home shard
 * view courses that you are enrolled in with the same id but on
   different shards. the activity stream should have the correct
   data for the course in that shard, for both courses (i.e.
   no mixing of data from the two shards)
 * do actions that generate new stream items, and verify the new
   items appear correctly for the above two steps
 * run the postdeploy migration, wait for the job to finish, then
   repeat the test plan

Change-Id: I8d5fcadb8d971acf7388a12e9151a3e927751f44
Reviewed-on: https://gerrit.instructure.com/15462
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-11-29 17:36:24 -07:00
Brian Palmer 7bda6283ff drop the unencrypted token column on access_tokens
closes #8943

now that all access tokens have the crypted_token field filled in, we
can drop the unencrypted column.

test plan: both before and after running the migration, you should be
able to use existing access tokens to make api calls, and create new
access tokens.

Change-Id: I83cfb2342ad2302bb7b43aabc528341d1d265920
Reviewed-on: https://gerrit.instructure.com/15601
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-11-28 14:19:22 -07:00
Jeremy Stanley 22e89bba38 check for name conflicts when validating Roles
refs #11739

Change-Id: I4cdca3926af368aef9ad00fd026af17f4daec525
Reviewed-on: https://gerrit.instructure.com/15634
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
2012-11-28 08:46:14 -07:00