Commit Graph

900 Commits

Author SHA1 Message Date
Tyson Brown d71945faad Register Parents and Add Observees when configured for SAML
authentication

Fixes PFS-1084

Parent Registration:
When a Saml config is designated for Parent Registration the parent
signing up will be redirected to a Saml login page where they will log
in with their child's credentials.  After login the child user's
Saml session will be ended and the parent registration process will complete.

Parent Adding Student:
When a Saml config is designated for Parent Registration the parent
adding another observee will be redirected to a Saml login page
where they will log in with their child's credentials.  After login the child user's
Saml session will be ended and the observee creation process
will complete.

---------------------------------------
TEST PLAN:
SETUP:
1) In your account settings check the box for 'Self Registration' (and
either of the sub-options)

2) Add the following users to your account (these will be the students):
billyjoel
eltonjohn

3) In Authentication Settings add a SAML authentication service
and enter the following fields (I've set up a remote SAML Idp):

IdP Entity ID:  http://107.170.212.143/saml2/idp/metadata.php
Log On URL:  http://107.170.212.143/simplesaml/saml2/idp/SSOService.php
Log Out URL:
http://107.170.212.143/simplesaml/saml2/idp/SingleLogoutService.php
Certificate Fingerprint:
9C:11:68:93:95:CD:18:01:EC:52:2B:9E:22:7F:73:55:ED:6D:82:D4
Parent Registration:  check

TEST:
Parent Registration:
* Go to '/login/canvas'
* Click on the signup banner
* sign up as a parent for billyjoel or eltonjohn
  (on SAML login page the password for either user is: tantrum)

Add Student:
* Log in as a parent user w/ a Canvas Auth login
* Go to '/profile/observees'
* Add Student 'billyjoel' or 'eltonjohn'

Authentication Settings (new parent reg checkbox):
* Go to Authentication Settings
* Add a second SAML config
* check the parent registration checkbox
  - it should warn that selection will deselect the other
    and in fact do so upon save.
  - the selected config is the one used for
    parent reg/add student
---------------------------------------

Change-Id: Ief83b604fc252c88dbb912c56de65d8620fe802f
Reviewed-on: https://gerrit.instructure.com/49691
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2015-06-11 15:25:19 +00:00
Weston Dransfield a8f024c6a3 Create app_center_id column in context_external_tools table
Fixes PLAT-1112

Test Plan:
 - make sure app_center_id column is added to ContextExternalTool

Change-Id: Ib44babc03de43730ee3c3f58732e916894ece992
Reviewed-on: https://gerrit.instructure.com/56108
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2015-06-10 19:57:46 +00:00
Ethan Vizitei ff056664b2 namespace pseudonyms by authentication provider
closes CNVS-19452

 * add the column and foreign key, uniquely index it,
   and replace the old unique index to make sure it's null
 * change lookup of pseudonyms on log in. CAS/SAML/LDAP
   look for matching or non-namespaced pseudonyms. OAuth
   looks only for matching.
 * update API for creating/exposing the provider info
 * update canvas_authentication modulation so it's only forced to true
   when deleting the LAST aac

test plan:
 * create a pseudonym for a specific provider (via the API)
 * ensure that even it matches for another provider, it's
   not found when you try to log in
 * check a CAS login will find a pseudonym with no provider,
   or the correct one
 * check that a OAuth login won't find a pseudonym not
   associated with any provider
 * finally, check that a OAuth login _will_ work with a
   matching pseudonym

Change-Id: I5d9ef8a992c6e0f6e1d8e13e4fb87d25304d982e
Reviewed-on: https://gerrit.instructure.com/55117
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2015-06-05 15:45:55 +00:00
Cody Cutrer 3b7e67242a fix another sso settings population migration
Change-Id: Ib37b243830c21e6a23fc9ecf347d8ead61bfa745
Reviewed-on: https://gerrit.instructure.com/55747
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Tested-by: Jenkins
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2015-06-05 15:09:10 +00:00
Cody Cutrer 0e89b38544 add attachments(namespace) index
fixes CNVS-20889

Change-Id: I96fc5f6e86511c11b759e819c9989544b9a469e9
Reviewed-on: https://gerrit.instructure.com/55593
Reviewed-by: Hubert depesz Lubaczewski <hlubaczewski@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-06-03 18:46:36 +00:00
Dylan Ross 5a8eac9f11 remove attachment_id foreignkey from gradebook_csv
remove attachment_id foreign key constraint from
the gradebook_csvs table to prevent foreign key constraint
violation. also added `has_many :progresses` to the course
class to keep the progress_id foreign key on the gradebook_csv
table

closes CNVS-20549

test plan
  ensure a an admin user (a user on a different shard
  than the course shard) can export a gradebook csv
  successfully

Change-Id: Iae9d0201192320ed45d5e901867ae20a9eb7ab1d
Reviewed-on: https://gerrit.instructure.com/54494
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Robert Lamb <rlamb@instructure.com>
Product-Review: Dylan Ross <dross@instructure.com>
2015-06-02 18:49:53 +00:00
Michael Nomitch 66fa28fa47 outcomes speed improvements
refs CNVS-12716

test plan:
  - make course with many assessed outcomes
  - load the mastery gradebook
  - it should load relatively fast

Change-Id: I81a91d58d37e5ae3d5399d59f6e3626af53496ea
Reviewed-on: https://gerrit.instructure.com/53493
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Deepeeca Soundarrajan <dsoundarrajan@instructure.com>
Tested-by: Jenkins
Product-Review: Hilary Scharton <hilary@instructure.com>
2015-05-29 15:20:28 +00:00
Sterling Cobb 878ab0e833 add modified_at column to attachments
fixes CNVS-20736

This is part of 3 other commits to create a modified_at endpoint for
attachments

Change-Id: I46719ecde2d5293243fbafab9e413c27a2a282af
Reviewed-on: https://gerrit.instructure.com/55275
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Sterling Cobb <sterling@instructure.com>
QA-Review: Sterling Cobb <sterling@instructure.com>
2015-05-28 20:34:23 +00:00
Cody Cutrer 9ec7c4ee0c Google and OpenID Connect auth backends
closes CNVS-19536, CNVS-19540, CNVS-19545

test plan:
 * test google auth
 * re-test the other oauth providers, cause more stuff got refactored

Change-Id: Ib1c0332cc31f0825f171f3281bf7255abb602844
Reviewed-on: https://gerrit.instructure.com/54526
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2015-05-21 22:57:51 +00:00
Cody Cutrer ddcfaa948e move unknown_user_url up to account settings
fixes CNVS-20620

no need to have 1 per AAC

test plan:
 * use a delegated auth provider
 * configure an unknown user url
 * log in with a user that doesn't exist in canvas
 * it should redirect to your url

Change-Id: I962513a58993bbb98921c2337d228cb53de06e9e
Reviewed-on: https://gerrit.instructure.com/54671
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2015-05-21 22:57:25 +00:00
Cody Cutrer c5b26ca160 linkedin auth
closes CNVS-19535, CNVS-19538, CNVS-19544

test plan:
 * you know the drill

Change-Id: I7ff16d06b58d11c2775a6ad251fc5d66d17160db
Reviewed-on: https://gerrit.instructure.com/54343
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2015-05-21 22:35:54 +00:00
Cody Cutrer 0a32c11bbc twitter login support
closes CNVS-19463, CNVS-19460, CNVS-19461

test plan:
 * you know the drill by now.
 * retest facebook, because that was refactored to share code

Change-Id: Iaf99b7b3c6850b1ac3690d1a5ebd1286268b5ae7
Reviewed-on: https://gerrit.instructure.com/54313
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
2015-05-19 22:54:09 +00:00
Cameron Matheson da7512cbdc excused assignments backend
closes CNVS-17549
closes CNVS-17553

Test plan:
  * excuse and unexcuse assignments from the api
  * student grades should be correct

Change-Id: Id8e0fa9edb404bdf65bff0bfc4c79c6f33e8a7e4
Reviewed-on: https://gerrit.instructure.com/53409
Tested-by: Jenkins
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Adrian Foong <afoong@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2015-05-18 20:36:51 +00:00
Ryan Taylor b02be2eae6 Prevent arbitrary timestamps in QLA event data from client
Overwrites timestamps from the client if they differ from server time by
greater than 30 seconds.

Closes CNVS-20405

Test Plan:
  - Start a quiz attempt.
  - Take a question or two
  - Change system clock to +2 minutes
  - Take a question or two
  - Change your system clock to -2 minutes (from real time)
  - Take a question or two.
  - Submit quiz.
  - View quiz submission event log (QLA) and confirm that
    the page events have correct timestamp information. Remember that answer
    events are not subject to the system clock problems, so look at page
    focused/page blurred events and others which are JS based.

Change-Id: I9e1fa20a9bb9e9373ad7422cc2e917480e7ac628
Reviewed-on: https://gerrit.instructure.com/53974
Tested-by: Jenkins
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Ryan Taylor <rtaylor@instructure.com>
2015-05-15 21:09:21 +00:00
Ryan Taylor c6888c6ad4 Remove QS missing data fix queuing migration
Refs CNVS-20069

Change-Id: I52461b1f2055a1190ca040dc29daa5152798ac86
Reviewed-on: https://gerrit.instructure.com/54368
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-05-15 02:19:21 +00:00
Cody Cutrer be8b9e0772 refactor and improve partition management
* move most of the logic into PartitionManager
 * use a setting for how many partitions to precreate/prune
 * enumerate existing tables for pruning, instead of assuming
   we can just roll off the last one
 * actually run the tests for partman from CI
 * simplify configuring partitioned migrations (just rely
   on the model to get the table name, instead of trying to
   guess the model from the table name, and sometimes having
   to provide both)

Change-Id: Ic8ac2b603a02f092b2f278d2b366b1cd9f942954
Reviewed-on: https://gerrit.instructure.com/53286
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Reviewed-by: Brian Finney <bfinney@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-05-15 02:15:09 +00:00
Ethan Vizitei af463d923d refactor views for unified AAC administration
closes CNVS-20076

First, pull a presenter out of the AAC index

This thing needs more flexibility before introducing
multiple OAuth connectors.  This commit adds a couple characterization
specs for the AAC controller, then drives out a presenter to pull
as much logic and config out of the nested views as possible.

Then, this commit refactors the
previously-somewhat-bespoke-and-presumptive sac
configuration into a workflow that shows each aac
in turn according to it's type, creating forms for
each type at the bottom, and
showing the relevant form for a new one based on
selection on the right.

Have regression tested in the browser to the level
of CRUD functionality, but also deserves solid QA
for SSO functionality post-configuration.

DONE:
-successful CAS creation/editing/deletion
-successful LDAP creation/editing/deletion
-proper differentiation between LDAP primary and secondary
-proper SAML creation/editing
-move away from "update_all" deprecated endpoint
-Selenium Spec fixes
-ensure discovery URL and debugging workflows for saml
-remove duplication from views
-tear down old JS workflow
-apply appropriate tests for new behavior
-remove presenter methods that are no longer valuable
-Moved change_password_url and login_handle_name
-up to account settings, removed them from AACs, and built
-migrations to manage the transition.
-Found and fixed all references to change_password_url on AACs
-Found and fixes all references to login_handle_name on AACs
-add datafixup for migrating AAC data to account settings
-unify repetative individual files into single form delcarations \o/
-remove old SAML editing js
-Make sure SAML still works
-Make LDAP partial flow just like SAML/CAS
-Unify position information across all types
-update "acts_as_list" to support STI classes
-move discovery URL into account auth form
-remove discover URL js management
-Unify form generation between new/existing aacs
-deprecate discovery url API endpoints
-update docs for authorization settings to deprecate their usage in AAC
  api and redirect their values to current settings for now
-make delete links non-js-y to stop this silly page refresh on api
  completion
-make form submissions actually submit the form rather than do this silly
  page refresh on api completion
-See if anything needs “Edit Details” button, remove if not
-Wire up removing account settings by blanking out form
-Removed "cancel" button from form because fields are always open
-placate gergich
-Test removing config info
-Test population fixup on real data
-write docs for authorization settings
-fix existing specs
-fix routing and docs to not break doc generation
-fix stupid jenkins task that thinks it can’t see controls
-re-fix selenium
-fix saml debugging workflow
-write tests for acts_as_list behavior
-write tests for authorization settings
-remove auth_info types of things
-clean up and unify styles where possible

TEST PLAN:
 Regression test creating/deleting/editing and logging
 in with SSO solutions for CAS, LDAP, and SAML.
 Should be no functional behavior modification, though
 workflow will be a little more unified between the
 3 currently supported types (each one will
 require using the menu in the right sidebar
 to add a new AAC).

 Also test setting and deleting account settings through
 the form underneath the configs when there are AACs in existence.

 Finally, make sure that the SAML Debugging workflow still works.

Change-Id: I448db10185512d1b9469c2a425be0a3bcf9e6ebf
Reviewed-on: https://gerrit.instructure.com/53448
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2015-05-14 21:47:05 +00:00
Ryan Taylor 6cf8fd9caa Updates for data fix script for missing QS
This updates the functionality of our QS data fix script to allow for
finding/fixing in a single delayed_job operation

Also, corrects a bug in the existing event_aggregator which
unnecessarily looped over the answers repeatedly.  This should speed up
the data fix by orders of magnitude.

Refs CNVS-20069

Test Plan:
  - Confirm script works well on beta

Change-Id: Icd4a1b1fa866650162a2b1b4ac97201efe6d5e76
Reviewed-on: https://gerrit.instructure.com/54249
Reviewed-by: Ben Chobot <bench@instructure.com>
Reviewed-by: Brian Finney <bfinney@instructure.com>
Product-Review: Brian Finney <bfinney@instructure.com>
Tested-by: Jenkins
QA-Review: Robert Lamb <rlamb@instructure.com>
2015-05-14 16:35:37 +00:00
Braden Anderson 30798e849b bookmark service, fixes CNVS-19363
test plan:
  * run bin/rake doc:api and open /doc/api/bookmarks.html
  * verify that the following endpoints are documented
    * GET /api/v1/users/self/bookmarks/
    * GET /api/v1/users/self/bookmarks/:id
    * POST /api/v1/users/self/bookmarks/
    * PUT /api/v1/users/self/bookmarks/:id
    * DELETE /api/v1/users/self/bookmarks/:id
  * using RESTClient, Postman, or similar, verify endpoints work

Change-Id: I9b7c7941b25e1ea8dfec6a11c4515b8ea558c523
Reviewed-on: https://gerrit.instructure.com/53827
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Braden Anderson <braden@instructure.com>
QA-Review: Pedro Fajardo <pfajardo@instructure.com>
2015-05-14 05:06:20 +00:00
Matt Wheeler a747d30aa1 Canvas API to mark a web conference as having a prepared recording
Fixes: CNVS-19783

Test Plan:
Run migrations
Create a new web conference.
Get the conference key from a rails console:
  conf_key = WebConference.last.conference_key
Get the secret key:
  secret = WebConference.last.config[:secret_dec]
Put together a signed payload like this:
  signed = JWT.encode({meeting_id: conf_key}, secret)

Then post it to your localhost like this (not in the rails console):
curl --data "signed_parameters={the string you got handed when you signed the payload}" http://localhost:3000/api/v1/courses/{your course id}/conferences/{your conference id}/recording_ready

If you look at the rails server you should see the html of the notification email fly by.

Change-Id: I87cf9fc229130c2e23529c47856a66aa8e57c697
Reviewed-on: https://gerrit.instructure.com/51813
Reviewed-by: Joel Hough <joel@instructure.com>
Tested-by: Jenkins
QA-Review: Derek Hansen <dhansen@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2015-05-11 19:33:41 +00:00
Brian Finney 335f065c5c Fix multiple_dropdowns_question affected by CNVS-19292
migration 20150506164227 should be skipped on large environments and the
following command should be manually run instead.

rails console
  DataFixup::FixCorruptAssessmentQuestionsFromCnvs19292.run(
    [
      'calculated_question',
      'numerical_question',
      'matching_question',
      'multiple_dropdowns_question'
    ],
    Date.parse('2015/3/14').beginning_of_day, # Beginning of corruption
    Date.parse('2015/3/18').end_of_day        # End of corruption
  )

Fixes CNVS-19365

 - Increments AssessmentQuestion version numbers so quizzes will pull new
   data on next quiz take

Test plan
 - Effected quizzes should be fixed

Change-Id: Iafae6525ae2406a6a4b3ae88c6f61e451719dd2b
Reviewed-on: https://gerrit.instructure.com/53536
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Product-Review: Brian Finney <bfinney@instructure.com>
QA-Review: Brian Finney <bfinney@instructure.com>
2015-05-06 21:43:33 +00:00
Dylan Ross 9ce06fb25e gradebook export process is now async
exporting the gradebook as a csv is now
done in a delayed job. when the user
clicks export, the export button will
be disabled. when the export has
completed, it will download the report
automatically. the csv generated previously
will be stored on the course, so it can
be downloaded again at a later time,
if a user leaves the page

fixes CNVS-17200

test plan
  ensure the data is consistent with the
  synchronously exported gradebook

  ensure the teacher can see the exported
  gradebook csv in the user's files page

Change-Id: I3d1e800326d82fe5cbca5a57ed7f60fad64daad5
Reviewed-on: https://gerrit.instructure.com/52689
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Robert Lamb <rlamb@instructure.com>
Tested-by: Jenkins
Product-Review: Christi Wruck
2015-05-05 17:54:49 +00:00
Cody Cutrer 54686f0cea add submissions.quiz_submission_id fk
Change-Id: I9bbfaf513d4632129f5368a25cb3bd329e5eb47c
Reviewed-on: https://gerrit.instructure.com/53094
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-04-29 17:47:36 +00:00
Strand McCutchen 1a24af8e53 fix Lint/StringConversionInInterpolation issue
Change-Id: Ibea00b023aa91e4f4a627161fbe87dbb54d22daf
fixes: CNVS-20009
Reviewed-on: https://gerrit.instructure.com/52884
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
Product-Review: Strand McCutchen <smccutchen@instructure.com>
QA-Review: Strand McCutchen <smccutchen@instructure.com>
2015-04-27 20:53:25 +00:00
Brian Finney 3b18cd0912 Fix quizzes affected by CNVS-19292
rails console
  DataFixup::FixCorruptAssessmentQuestionsFromCnvs19292.run(
    Date.parse('2015/3/14').beginning_of_day,
    Date.parse('2015/3/18').end_of_day
  )

Fixes CNVS-19365

 - Increments AssessmentQuestion version numbers so quizzes will pull new
   data on next quiz take

Test plan
 - Effected quizzes should be fixed

Change-Id: Ie1471f1920d8e59f4081732b26c48ed649054dfc
Reviewed-on: https://gerrit.instructure.com/50611
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
Tested-by: Jenkins
Product-Review: Brian Finney <bfinney@instructure.com>
QA-Review: Robert Lamb <rlamb@instructure.com>
2015-04-26 22:17:55 +00:00
Braden Anderson f5276f7a78 discussion entry liking
fixes CNVS-16277

test plan:
  * create a discussion topic
  * open edit page
  * change Allow liking, Only graders can like, Sort by likes
  * verify that changes persist

  * open topic show page
  * verify that like buttons are present if Allow liking is enabled
      and Only graders can like is disabled or the user can grade

  * click on a Like button
  * verify that the button is activated
  * refresh the page
  * verify that the rating persists
  * verify that the number of likes on each entry is displayed

  * enable Sort by likes
  * wait a minute for the topic's cache to rebuild
  * refresh the page
  * verify that entries are sorted by number of likes

Change-Id: I8e329899c8b81832bdf9132438537bcd7a32e258
Reviewed-on: https://gerrit.instructure.com/42786
Reviewed-by: Joel Hough <joel@instructure.com>
Product-Review: Braden Anderson <braden@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Tested-by: Jenkins
2015-04-25 03:10:48 +00:00
Alex Boyd a52af1503f Clear other access tokens under the same key when requested
Fixes PLAT-991

Test plan:
 - Run through an OAuth flow in the usual manner with a given
   developer key
 - Run through it again, this time giving replace_tokens=1 to the
   call to /login/oauth2/token
 - Ensure that the old token was nuked and only the new one remains
 - Set replace_tokens to true on the developer key you're using
 - Run through the OAuth flow again, without giving replace_tokens=1
   to /login/oauth2/token, and ensure that the old token was once
   again nuked

Change-Id: Id2b40bfd16918ab3d0852dabc13ed7b500277dc9
Reviewed-on: https://gerrit.instructure.com/52286
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Product-Review: Alex Boyd <aboyd@instructure.com>
2015-04-23 18:40:26 +00:00
Cody Cutrer d0c90ef52a add missing index supporting a foreign key
Change-Id: Ib1510268c21e1b1430767f20e5f9a2bf8eb87f64
Reviewed-on: https://gerrit.instructure.com/52526
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-04-21 15:19:26 +00:00
James Williams e4666edf09 default has_no_front_page to true for new wikis
also fixup old ones

test plan:
* export a course with a wiki page set as the front page
* create a new course
* import the exported package
* should be set as the front page

closes #CNVS-14601

Change-Id: Icb660f2c84ab9a9c208d0fc092cf348d69edcab7
Reviewed-on: https://gerrit.instructure.com/52245
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
2015-04-15 20:00:19 +00:00
Ethan Vizitei 19a71c6b64 add some ruby linting for jenkins to take advantage of
add migration lint as rubocop cops

create frozen constant linter

find_ids datafixup lint

send_later lint

lint send_later in predeploys

add freeze_constant cop to default config

don't forget to include rubocop when running

get the rubocop runner into the script

lint for wrong algorithm name

lint primary key

lint remove_column in predeploys

get rubocop output as parsed json

diff munging for gergich

disable a few style cops

tweak rubocop setup to allow IDE plugins to work

get gergich comment format right

shell out to gergich if we're in jenkins-land

Change-Id: I6eecc8d8ede17a755c9d9a86121c3658776de9cd
Reviewed-on: https://gerrit.instructure.com/51755
Tested-by: Jenkins
Reviewed-by: Jason Madsen <jmadsen@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
2015-04-09 14:37:37 +00:00
Cody Cutrer 8a37bba8a8 drop columns in a postdeploy, not a predeploy
also when dropping columns, you either need to specify full arguments so
that the inferred down works, or add an explicit down (in this case,
explicit because the conditional may interfere with generation of the
inferred down)

Change-Id: I314b1b17bfee973182827303575b3662a04bbc47
Reviewed-on: https://gerrit.instructure.com/51541
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-04-03 16:00:09 +00:00
Josh Simpson 6821dfe030 gradebook csv upload: make parsing step async
Test plan:
  * uploading the gradebook should work like it used to (except it will
    even work for ridiculous-large courses)
  * try to break it by running multiple uploads in parallel / etc

Change-Id: I80dfe7babe320a1cee4021c59c5691d1df5382dd
Reviewed-on: https://gerrit.instructure.com/51499
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
QA-Review: Robert Lamb <rlamb@instructure.com>
2015-04-03 06:52:25 +00:00
Spencer Olson 0f53b9f7a7 add workflow state to grading period groups and grading period grades
add workflow state to grading period groups and grading period grades.
also add a default value of 'active' and a not-null constraint for
workflow state on grading periods, grading period groups, and grading
period grades. also add a validate method for grading period group
that ensures the group belongs to either a course or account. add a
not-null constraint for grading period group id on grading periods. add
an index for workflow_state on grading period groups, grading periods,
and grading period grades.

closes CNVS-18995

test plan:

run migrations. in rails console:
  $ bundle exec rake db:migrate
  $ bundle exec rake db:migrate RAILS_ENV=test

Grading Period Groups:
  - you should not be able to create a Grading Period Group without
    assigning it either a course or account. If you don't supply a
    workflow state when you create a grading period group, it should
    default to 'active'.

    $ g = GradingPeriodGroup.create
    $ g.valid? #should return false

    $ g = Account.default.grading_period_groups.create
    $ g.valid? #should return true
    $ g.workflow_state #should return 'active'

    $ new_course = Course.create
    $ g = new_course.grading_period_groups.create
    $ g.valid? #should return true
    $ g.workflow_state #should return 'active'

  - when you delete a grading period group, it should do a 'soft delete',
    which means it should set its workflow_state to 'deleted' instead of
    actually deleting it from the database

    $ g = Account.default.grading_period_groups.create
    $ g.destroy
    $ g.workflow_state #should return 'deleted'

  - when you delete a grading period group, it should also soft delete
    any grading periods that belong to it.

    $ gp_group = Account.default.grading_period_groups.create
    $ gp = gp_group.grading_periods.create(
        start_date: Time.now,
        end_date: 1.month.from_now)
    $ gp_group.destroy
    $ gp_group.workflow_state #should return 'deleted'
    $ gp.workflow_state #should return 'deleted'

Grading Periods:
  - you should no longer be able to create a grading period without
    giving it a grading_period_group id. also, if you don't give it
    a workflow_state, it should default to 'active'. when you
    delete a grading period it should do a 'soft delete'.

    $ g = GradingPeriod.create(start_date: Time.now, end_date: 1.month.from_now)
    $ g.valid? #should return false

    $ gp_group = Account.default.grading_period_groups.create
    $ gp = gp_group.grading_periods.create(
        start_date: Time.now,
        end_date: 1.month.from_now)
    $ gp.valid? #should return true
    $ gp.workflow_state #should return 'active'
    $ gp.destroy
    $ gp.workflow_state #should return 'deleted'

  -  when you delete a grading period, it should also do a 'soft delete'
    on any owned grading period grades. Enrollments are tricky to make
    via the rails console, so i'm just grabbing one here that was already
    made -- you should be able to do the same. if you don't have any
    enrollments created, create one via Canvas and then come back to
    the rails console.

    $ gp_group = Account.default.grading_period_groups.create
    $ gp = gp_group.grading_periods.create(
        start_date: Time.now,
        end_date: 1.month.from_now)
    $ enrollment = Enrollment.first
    $ gp_grade = gp.grading_period_grades.create(
        enrollment_id: enrollment)
    $ gp_grade.workflow_state #should return 'active'
    $ gp.destroy
    $ gp.workflow_state #should return 'deleted'
    $ gp_grade.workflow_state #should return 'deleted'

Grading Period Grades:
  - these should now 'soft delete' as well. they require a grading period
    and an enrollment to be created (no change here, this has always been
    the case).

    $ enrollment = Enrollment.first
    $ gp_group = Account.default.grading_period_groups.create
    $ gp = gp_group.grading_periods.create(
        start_date: Time.now,
        end_date: 1.month.from_now)
    $ gp_grade = gp.grading_period_grades.create(
        enrollment_id: enrollment)
    $ gp_grade.workflow_state #should return 'active'
    $ gp_grade.destroy
    $ gp_grade.workflow_state #should return 'deleted'

Change-Id: Ic397a03beca4782c0c80e486673c7cfef59d38e5
Reviewed-on: https://gerrit.instructure.com/49754
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Robert Lamb <rlamb@instructure.com>
Tested-by: Jenkins
Product-Review: Spencer Olson <solson@instructure.com>
2015-04-01 00:07:44 +00:00
Rob Orton 66251f94d2 don't allow a user to observe oneself
fixes CNVS-18980

test plan
 - attempting to observe yourself should throw an error
 - attempting to add an observer enrollment where user_id
   is equal to the associated_user_id should throw an
   error
 - merging two users that would result in self observing
   should delete user observers
 - merging two users that would result in enrollments
   with user_id = associated_user_id should be marked
   as deleted and not moved
 - enrollments in this state should be removed
 - user observers in this state should be removed

Change-Id: I308bf474406a60b81550c21cefcab323ed0850db
Reviewed-on: https://gerrit.instructure.com/49759
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2015-03-19 20:46:07 +00:00
Jeremy Stanley 8a800af3e1 remove discussion entry attachment foreign key constraint
this constraint is problematic because entries belong to the course's
shard, but attachments belong to the user's shard.

test plan:
 - a user from a different shard than the course should be able to
   attach files to discussion entries without error

refs CNVS-19181

Change-Id: I7055b63df48a3726a615dd3b8810ad45633edc9a
Reviewed-on: https://gerrit.instructure.com/50222
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2015-03-16 15:25:53 +00:00
Cody Cutrer 13bc1e2d81 add index for querying latest account report
fixes CNVS-19099

Change-Id: I1b9f13ccdc24dfc1c98a611125438174b6bd6307
Reviewed-on: https://gerrit.instructure.com/50017
Tested-by: Jenkins
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-03-08 00:34:34 +00:00
Joel Hough 995c78feb5 destroy facebook channels and services
fixes CNVS-18977

test plan
BEFORE CHECKING THIS OUT
- have some facebook user services
- have some facebook communication channels with notification
 policies and delayed messages waiting to be sent

AFTER CHECKOUT
- run migrations and allow delayed jobs to run
- ensure that all facebook channels and user services are deleted

Change-Id: I1e210be8d517a138496576879bde58ad7ca63614
Reviewed-on: https://gerrit.instructure.com/49279
Tested-by: Jenkins
Product-Review: Matthew Wheeler <mwheeler@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
2015-03-06 23:24:43 +00:00
Cameron Matheson 6036360b79 turnitin: use a unique identifier for courses
fixes CNVS-17473

Test plan:
  * create two new shards
  * create a course in each shard (the courses should both have id 1)
  * in the rails console, try course.turnitin_id for each shard.  they
  * should be different

Change-Id: I70892e35eb53b32ede26cd00505142962c9785be
Reviewed-on: https://gerrit.instructure.com/49196
Tested-by: Jenkins
Reviewed-by: Strand McCutchen <smccutchen@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Cameron Matheson <cameron@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2015-02-27 22:05:18 +00:00
Rob Orton de4c4fd5ec fix migration to work with old bad data
the duplicate external feeds are referencing discussion
topics in addition to announcments

test plan
 - migrations should run

Change-Id: If99c583a35c87182c97c84ab13d40f230107576e
Reviewed-on: https://gerrit.instructure.com/49532
Tested-by: Jenkins
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2015-02-26 20:18:27 +00:00
Brian Palmer c212a473fd SIS CSV diffing
This opt-in preprocessing pass does a diff on the current SIS Import against
the last successful import tagged with the same "data set identifier",
and generates a new zip of CSVs containing only the diff between the
two. It then continues with the import as normal, applying that diff'd
zip, greatly speeding up large imports where most data doesn't change.

closes CNVS-18432

test plan:

Exercise the new diffing options using the diffing_data_set_identifier
and diffing_remaster_data_set api options. See the new API
documentation for details and expected limitations. Edge cases include:
- zips that contain multiple CSVs for the same data type (won't diff)
- failed SIS imports (shouldn't diff against these)
- remasters should skip doing the diff, but should be diffed against on
  the next import

We don't expose any functionality for downloading SIS data that has been
uploaded, but you can grab it from the rails console:

> SisBatch.find(<batch id>).attachment.authenticated_s3_url
and
> SisBatch.find(<batch id>).generated_diff.authenticated_s3_url

Change-Id: I40d5e5ca8c376cecd685f4d06012f11bac021599
Reviewed-on: https://gerrit.instructure.com/48428
Tested-by: Jenkins
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Tyler Pickett <tpickett+gerrit@instructure.com>
Product-Review: Linda Feng <lfeng@instructure.com>
2015-02-26 15:53:01 +00:00
Bracken Mosbacker d6f0f40f98 add force_token_reuse to developer key
API consumers should generally  try to reuse the api tokens that
they generate. This property makes it so that new tokens
won't be issued to a developer key for a user if that user
has a token that is still valid for that key.

Test Plan:
 * for both a trusted and an unstrusted developer key:
 * without force_token_reuse set on the key:
 * do the token request flow twice, you should get a new token each time
 * with force_token_reuse set:
 * do the token request flow twice, the second time access_token should be blank

closes PLAT-767

Change-Id: I94e7dfbe24ce534cca0ecba940c1e0b3af15b0cd
Reviewed-on: https://gerrit.instructure.com/44393
Reviewed-by: Dave Donahue <ddonahue@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2015-02-24 18:33:27 +00:00
Rob Orton e8a310d90f drop cc and bcc from messages
these have not been used ever

test plan
 - migrations should run

Change-Id: I44df2abe7df87ff4b3789ec55d8a6a553139155f
Reviewed-on: https://gerrit.instructure.com/48814
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2015-02-18 19:41:26 +00:00
Rob Orton ab4664668f drop unused column from sis_batches
test plan
 - migrations should work

Change-Id: I29a2b27607690ee62eee5c64e1111ea05772d2a7
Reviewed-on: https://gerrit.instructure.com/48810
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2015-02-18 19:39:34 +00:00
Rob Orton b1244f27f3 change and validate length of attributes on message
test plan
 - should not get a db error when to: is longer than 255 char

Change-Id: I55c697b3a0848cf700ecb4a19ef7447a643e0a64
Reviewed-on: https://gerrit.instructure.com/48157
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2015-02-18 19:39:15 +00:00
Michael Nomitch c52094377f add adhoc to quiz sql view
fixes CNVS-18403

test plan:
  - quick regression test on DA for quizzes

Change-Id: I2c9521ce9fd22374cd192ca228967fa6ec50ade7
Reviewed-on: https://gerrit.instructure.com/48372
Tested-by: Jenkins
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-02-13 17:55:16 +00:00
Michael Nomitch e46d4e8de5 add adhoc to sql view
fixes CNVS-17929

test plan:
  - simple DA regression test

Change-Id: I0e6624b7dd8a9758df7bce8cf991639346f064d8
Reviewed-on: https://gerrit.instructure.com/48172
Reviewed-by: Steven Burnett <sburnett@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins
QA-Review: Adam Stone <astone@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-02-13 17:55:14 +00:00
Simon Williams 9ca3e49bf8 cleanup and prevent duplicate external feeds
this commit does three things:
* runs a data migration to delete duplicate external feeds.  duplicates
  are defined as having the same context, url, verbosity, and header match
* prevents duplicates from being created on course copy, by searching
  for and re-using an existing feed if it exists when importing
* validating uniqueness of newly created/saved external feeds, and
  exposing validation errors in the UI

fixes CNVS-17523

test plan:
- before downloading this commit, create two courses, go to the
  announcments pages, and create several different external feeds, some
  of which only duplicate the url (but have differences for other values)
  and some of which are exact duplicates
- checkout this patchset, run migrations
- those courses should now only have unique feeds (the full duplicates
  will be deleted)
- now try creating a new full duplicate
- you should get an error message that says "taken" on the url field
- try importing the feeds from a course with a feed into another course
  that has the exact same external feed
- it should succeed, but not create a duplicate feed in the second course

Change-Id: If1655283102a74626c4579c24382cde92115e776
Reviewed-on: https://gerrit.instructure.com/45991
Tested-by: Jenkins
Reviewed-by: Rob Orton <rob@instructure.com>
Reviewed-by: Joel Hough <joel@instructure.com>
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
QA-Review: Derek Hansen <dhansen@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-02-13 17:35:34 +00:00
Spencer Olson 07e30b0668 make 'weight' attribute not-required for a grading period
run a migration to remove the 'weight' non-null constraint
on the grading_periods table. also, remove the non-null
validation from the grading period model.

closes CNVS-18443

test plan:
 1. run the migration to alter the grading_period table:
 	$ RAILS_ENV=development bundle exec rake db:migrate
 	$ RAILS_ENV=test bundle exec rake db:migrate

 2. create a new grading period without a 'weight' attribute

  In rails console:
  $ grading_period = GradingPeriod.new(start_date: Time.now,
                     	end_date: 2.months.from_now)

 3. verify that the grading period is valid and saves
 	(Still in rails console)

  $ grading_period.valid? #verify this returns true
  $ grading_period.save #verify this returns true

Change-Id: Ic081eaca859f85e0457e074509b1196dddacf2d4
Reviewed-on: https://gerrit.instructure.com/48554
Tested-by: Jenkins
Reviewed-by: Brian Finney <bfinney@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Cameron Sutter <csutter@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2015-02-12 21:18:24 +00:00
James Williams 6e72a13f4b remove last_inline_view from attachments
(remnant of scribd)

test plan:
* upload a file to a course
* preview the file
* previewing should not change the "modified at" column

closes #CNVS-18348

Change-Id: Id7ab17cadde8a218c3b7073632af9b3cf705afd0
Reviewed-on: https://gerrit.instructure.com/48461
Tested-by: Jenkins
Reviewed-by: Dan Minkevitch <dan@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-02-10 13:33:08 +00:00
Dave Donahue 583ab30eb4 add new permission and API endpoint for manage_catalog
refs CAT-819, CAT-822

Test plan:
 1. rake db:migrate and sign into Canvas as an admin
 2. Visit the permissions page for your account hooked
    up to Catalog and switch to the Account Roles tab.
 3. Note the "Manage catalog" permission does not show up.
 4. Now, console in and update that account to have a
    setting of :catalog_enabled => true, e.g.
    a = Account.find(1)
    a.settings[:catalog_enabled] = true
    a.save!
 5. Reload Canvas and note that "Manage catalog" now displays
    in the Account Roles tab.

refs CAT-823

Test plan:
 1. As a few different user types, make API requests to
    /api/v1/accounts/:id/permissions/manage_catalog
    For instance:
    curl 'http://canvas.dev:3000/api/v1/accounts/1/permissions/manage_catalog' -H 'Authorization: Bearer your-token'

    * Account admins should receive {granted: true}
    * Non-admin users should receive {granted: false}
    * Users with custom roles that have the Manage Catalog
      permission should receive {granted: true}
    * If :catalog_enabled is not set on the account in
      question, it should never return {granted: true}
    * Try changing up the permission name in the URL (to
      something other than manage_catalog). The response
      should be an error (status code: 400), since we only
      support checking manage_catalog for now.

Change-Id: I4fa53665ff866f5c016f32ce72036e8b5a75bda5
Reviewed-on: https://gerrit.instructure.com/48119
Tested-by: Jenkins
Reviewed-by: Ethan Gunderson <egunderson@instructure.com>
Product-Review: Ethan Gunderson <egunderson@instructure.com>
QA-Review: Ethan Gunderson <egunderson@instructure.com>
2015-02-06 19:45:20 +00:00
Cody Cutrer 1c8d862d34 add started_at to sis_batches
refs CNVS-17788

so you can easily tell the difference between how long a batch took
vs. how long it took to start

test plan:
 * upload an SIS batch and let it run
 * when you view it via the API, it should include a started_at
   timestamp

Change-Id: I142024f82260c2ba690a950a09365e90c18cd43d
Reviewed-on: https://gerrit.instructure.com/47412
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-01-23 21:31:26 +00:00
Cody Cutrer 4104f7e699 fix role ids synchronously now
since the constraint migration now exists, and will also run
synchronously

Change-Id: Ia17711300f7a19143a4cdfb73cc44362bb2d7236
Reviewed-on: https://gerrit.instructure.com/47393
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-01-19 20:29:36 +00:00
Joel Hough 28d82fa793 push notifications
fixes CNVS-7398

test plan
- using canvas mobile app with push notification support, enable
 push notifications
- cause a notification to be sent from the canvas web ui
- ensure that the canvas app gets a notification

Change-Id: Idb320520a23ba6c5c2649253da557160be54084a
Reviewed-on: https://gerrit.instructure.com/42892
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Joel Hough <joel@instructure.com>
2015-01-15 22:19:24 +00:00
Cody Cutrer c81bebbfdf skip legacy migrations when the default account does not exist
since it's no longer created on-demand for production environment

test plan:
 * set up a new database with `rake db:initial_setup` in a
   production environment

Change-Id: Ia048c77e74091c2e10ed81ded0a4c652788bb02a
Reviewed-on: https://gerrit.instructure.com/46311
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-01-14 20:21:38 +00:00
Simon Williams b10f626dde remove unused external feeds columns
external feeds have three columns that really aren't adding any value

* body_match: never used anywhere in the code, always nil in the
  database
* feed_type: always 'rss/atom' (built to handle ical, but never used)
* feed_purpose: always 'announcements' (build to handle calendar_events,
  but never used)

closes CNVS-17581

test plan:
- create an external feed on the announcements page
- wait for the rss feed to post a new story and the aggregator to run,
  OR, in a rails console:
  * set the created_at date on the external feed to before the last
    posted entry, something like
      ef = ExternalFeed.last
      ef.created_at = 5.days.ago
      ef.save!
  * run the external feed aggregator, like so:
      ExternalFeedAggregator.process
- it should create an announcement for the blog post from that feed

Change-Id: I74deffbdaaa1e217f8eefbdfd1000d50c2406cb1
Reviewed-on: https://gerrit.instructure.com/45990
Reviewed-by: Joel Hough <joel@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2015-01-07 23:36:18 +00:00
James Williams eaa7836c19 populate quiz audit role overrides
Change-Id: Ia099ecbfe6c3fa5ae2bec76daf16ebfb79c14a0b
Reviewed-on: https://gerrit.instructure.com/46573
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2015-01-07 20:21:07 +00:00
Derek DeVries 65cd872f8e fix issue with event created at time not being set to utc time
fixes CNVS-17723

test plan:
  - as a teacher
    - create a OQAAT quiz with a few questions
    - publish the quiz

  - as a student
    - take the quiz
    - you should not get errors when answering questions

Change-Id: I5811e775112bd030d1ea3703985c7f3b194d4901
Reviewed-on: https://gerrit.instructure.com/46458
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
Tested-by: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
Tested-by: Ahmad Amireh <ahmad@instructure.com>
2015-01-01 04:34:55 +00:00
James Williams beb5d633ae fix ChangeEnrollmentsRoleIdNull again
test plan:
* should be able to run migrations with duplicate
ObserverEnrollments as well

Change-Id: I15d811a31081177fc2c4c7b9b356858ab79db307
Reviewed-on: https://gerrit.instructure.com/46390
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-12-31 15:07:23 +00:00
Matthew Berns 11d95c51b8 resolves group discussion entries not appearing in gradebook and speedgrader
fixes CNVS-17632

test plan:
- create a graded group discussion
- add an entry to the group discussion as a student that is part of that group
- the gradebook should show a submission for that student
- the student's entry should also appear in speedgrader

- go back through test plan from gerrit.instructure.com/#/c/45461
- ensure that test plan still passes

Change-Id: Ib47a9c1299c8fa4083be19a61337dfc26060c36e
Reviewed-on: https://gerrit.instructure.com/46315
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Derek Hansen <dhansen@instructure.com>
2014-12-29 18:20:51 +00:00
Jeremy Stanley 96b7f1b419 fix ChangeEnrollmentsRoleIdNull
test plan: fixes migrations with lingering StudentViewEnrollments
with null role_id

fixes CNVS-17644

Change-Id: Ic75dee9a73447afdd21aabb0ef9732f9dcd74d30
Reviewed-on: https://gerrit.instructure.com/46239
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
2014-12-23 19:52:39 +00:00
Cody Cutrer 7d67087765 add foreign key index part 5
Change-Id: If8e99a709499a1b0d100a2d87b1766392e0272d6
Reviewed-on: https://gerrit.instructure.com/45268
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-12-23 19:37:10 +00:00
Nathan Mills 2b3c4343df create lti_app collection api
fixes PLAT-795

test-plan
do a GET at /api/v1/courses/#{@course.id}/lti_apps
it should retunr a list of lti_app definitions

Change-Id: I383682d1638f584ffae9544757cf5aa361777553
Reviewed-on: https://gerrit.instructure.com/45697
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2014-12-17 22:34:31 +00:00
Matthew Berns d5ad3f6e5b updated learning outcome to retain eval method and info for weighted methods
fixes CNVS-16915

(all mentions of 'gradebook' refer to learning mastery gradebook)
test plan:
- go to gradebook
- all existing mastery scores should still default to highest score to retain
  accuracy of existing calculations
- in rails console, set 'calculation_method' to 'latest' for an outcome
- all results for that outcome should now show student's latest score on gradebook
- in rails console, set method to 'highest'
- all results for that outcome should now show student's highest score on gradebook
- in rails console, set method to 'n_mastery' and set 'calculation_int' to a number
  between two and 5
- all results for that outcome should now show avg of student's higest n# of scores
  (#n being the number set for the outcome's 'calculation_int')
- in rails console, set method to 'decaying_average' and set 'calculation_int' to 75
- scores should now appear as they did first time gradebook was viewed on step #2
- in rails console, set 'calculation_int' to 65
- scores for that outcome should now reflect decaying average with 65% weight given to
  most recent score, and 35% weight for avg of all prior scores
- have a student make a new submission to an old assignment and give it a score
- the re-submission should now be most recent score for 'latest' and
  'decaying_average' methods
- amend a score for an old submission without a new submission from the student
- the amended score should not become the most recent, but still be accurately
  reflected in the 25%/35% part of the 'decaying_average' method

Change-Id: I330c47cb2288d99e589deca00ddb5a8ee8103a91
Reviewed-on: https://gerrit.instructure.com/44935
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Benjamin Porter <bporter@instructure.com>
2014-12-16 01:04:28 +00:00
James Williams 4baea5aa6b add not null column restraint to enrollments role_id
Change-Id: I167620165171b6fd0d41e69590e1f3225ac2fe2c
Reviewed-on: https://gerrit.instructure.com/45690
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-12-15 21:00:57 +00:00
Eric Berry cf53c45a4d Correct defaults for app center plugin
fixes PLAT-806

Change-Id: Iec9cb69c80fab471b1aff4d8b8d7bc2dc4190520
Reviewed-on: https://gerrit.instructure.com/45783
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Eric Berry <ericb@instructure.com>
Product-Review: Eric Berry <ericb@instructure.com>
2014-12-15 20:31:18 +00:00
Ahmad Amireh bfb266cedc Fix quiz questions from banks
This patch makes it so that whenever we generate a submission that pulls
questions from a QuestionBank, we are assured that we're dealing with
QuizQuestion objects. Retroactively, a data fixer is installed that will
process every submission on hot points like the API readers if they
happen to have bad data.

There are a lot of comments in the additions which should give you more
context.

Huge refactors:

- Quiz is no longer responsible for "preparing" its question data, nor
  generating questions for submissions. That's now delegated to the
  QuizQuestionBuilder

Closes CNVS-17412

TEST PLAN
---- ----

  - create a crazy quiz with all sorts of things:
    a) single questions,
    b) question groups with manual questions
    c) question groups tied to question banks
    d) question groups that have questions from banks and others
       manually created
    e) multiple attempts so we can verify versioning is not affected
  - MAKE SURE that you can get some questions duplicated (even if it
    takes you a couple of attempts), you can achieve this by creating 1
    group that is linked to a bank, and another group that has 1 or more
    questions from that same bank (and possibly other banks) - keep
    trying the quiz until you get a duplicate
  - take the quiz both as a student and a teacher, and do it multiple
    times
    + verify all the answers to the questions are as you entered
    + ON DUPLICATES: provide different answers, and make sure that all
      answers were recorded
    + go over all the submission-related pages and verify everything is
      still rendering
    + use the API to read the quiz, its questions, and the submissions
      and verify that all endpoints are functional

Change-Id: I322e2786d33eda03fb18dde0fbb5cd11a16f2449
Reviewed-on: https://gerrit.instructure.com/45456
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
Reviewed-by: Ahmad Amireh <ahmad@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
2014-12-15 17:38:13 +00:00
Jayce Higgins 5e87afa22f Adds Sis Notification table to canvas
Fixes: SIS-628

Change-Id: I08eea4ad89135ccbfba0ce7059e4325b2971954e
Reviewed-on: https://gerrit.instructure.com/44858
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2014-12-15 17:25:21 +00:00
Jacob Fugal 0c96126c80 validations on Version and SubmissionVersion
fixes CNVS-16961

don't create a SubmissionVersion when the Version fails to save. and if
we try to, don't let it be valid. add a data fixup to remove those that
had already happened (all of the instances of this found in production
came from cases where there was no corresponding Version the
SubmissionVersion should have been tied to).

Change-Id: I4e08acf41779ab88de85387b88db155955d3c50e
Reviewed-on: https://gerrit.instructure.com/44916
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2014-12-12 23:29:45 +00:00
Cameron Sutter f2e2e76d5b Grading Period Grade join table - MGP
fixes CNVS-16454

test plan:
 * test in the console
 - `GradingPeriodGrade.all` should return `[]` (no error)
 - `Enrollment.find(1).grading_period_grades` should return `[]` (no error)
 - make a GradingPeriod:
   `g = GradingPeriod.create(weight: 100, start_date: Time.now, end_date: 1.month.from_now)`
   `g.save!`
 - `g.grading_period_grades` should return `[]` (no error)

Change-Id: I7183d715dbfac3fcd89ab7e453237ad4ce6c650d
Reviewed-on: https://gerrit.instructure.com/45312
Product-Review: Cameron Sutter <csutter@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
2014-12-11 17:28:33 +00:00
Mark Severson 1a245e6bdd remove non-draft state wiki pages
test plan:
* regression test wiki pages

closes CNVS-16203

Change-Id: Ic37c69c8696151dc99f1df6f3cc9b013835b12a4
Reviewed-on: https://gerrit.instructure.com/42552
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-12-09 20:12:24 +00:00
Ahmad Amireh 6d1e53f608 canvas-partman - rolling partition migrations
Closes CNVS-16878

TEST PLAN
---- ----

Similar to g/44145 but no rake tasks needed.

  - check out the patch
  - run `bundle exec rake db:migrate`
  - run the rails server and visit any page:
    + if you got this far, and jenkins has passed, things are good

Change-Id: Icfed777974269c344b5e1e1c2617ab2f3836f38f
Reviewed-on: https://gerrit.instructure.com/44405
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
QA-Review: Ahmad Amireh <ahmad@instructure.com>
2014-12-03 19:53:53 +00:00
James Williams 34cf72ce5a fix add_role_id_columns migration for missing roles
migrate each missing role to their own unique
role to preserve the unique index

refs #CNVS-17068

Change-Id: Ibecd48a880d2948fb02af8d50fb1e2eb5b9fe8ba
Reviewed-on: https://gerrit.instructure.com/44840
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-11-26 13:52:48 +00:00
Nick Cloward 5818ed9458 add external integration keys
refs: CNVS-16627

First part is to add the framework for tracking external keys.  This
commit handles the ability to add multiple types easily to the
external_integration_keys with custom rights per type of key.

Test Plan:
 - Make sure the section for External Integration Keys does not display
   when no types are set.
 - Add a few custom types to the external integration keys with all
   combinations of write and read rights.
 - Make sure you can edit the appropriate keys inside the account
   settings page and that they are persistent.
 - Remove a value from a key and it should delete the appropriate
   record.
 - If the user does not have access to any keys the section should not
   display.

Change-Id: I37d56c3ee1bf44876c220e9d5a1ae80a22ac1289
Reviewed-on: https://gerrit.instructure.com/44161
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Colleen Palmer <colleen@instructure.com>
2014-11-21 01:19:24 +00:00
Jeremy Stanley 96362fd69a data model and API for file usage rights
test plan:
 1. consult the files API documentation and note the additions:
   A. usage_rights include parameter on 'List files'
   B. usage_rights include parameter on 'Get file'
   C. 'List licenses' endpoint
   D. 'Set usage rights' endpoint (PUT)
   E. 'Remove usage rights' endpoint (DELETE)
 2. exercise these new API features

closes CNVS-16826
closes CNVS-16841

Change-Id: I6c01128423adc24a5b70f71bb109d5a005379c37
Reviewed-on: https://gerrit.instructure.com/44403
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2014-11-19 16:14:00 +00:00
Spencer Olson 9cde815d68 add grading period group model
add GradingPeriodGroup, and change associations between GradingPeriods,
GradingPeriodGroups, Courses, and Accounts. also adjust the grading
periods controller to account for addition of grading period groups

closes CNVS-16538

test plan:
-run bundle exec rake db:migrate, and bundle exec rake db:migrate RAILS_ENV=test
-verify the migrations successfully run
-open the rails console in sandbox: bundle exec rails c -s
-create a course, a few grading periods, and a grading period group. Add the grading periods to the group. Assign
  the grading period group to the course.
  $ course = Course.create
  $ grading_period1 = GradingPeriod.create(weight: 25.0, start_date: Time.zone.now, end_date: 2.days.from_now)
  $ grading_period2 = GradingPeriod.create(weight: 30.0, start_date: Time.zone.now, end_date: 2.days.from_now)
  $ grading_period_group = GradingPeriodGroup.create()
  $ grading_period_group.grading_periods << grading_period1
  $ grading_period_group.grading_periods << grading_period2
  $ grading_period_group.course = course
-verify the associations are working as expected, i.e. a GradingPeriodGroup has GradingPeriods, a GradingPeriod
  belongs to a GradingPeriodGroup, and a GradingPeriodGroup belongs to a course or account.
  $ grading_period_group.grading_periods #should return an array containing grading_period1 and grading_period2
  $ grading_period1.grading_period_group #should return grading_period_group
  $ grading_period2.grading_period_group #should return grading_period_group
  $ grading_period_group.course #should return course
  $ grading_period_group.account #should return nil (should not throw error)

Change-Id: I9d7465431dabd2afa18e7a8a33706b9a78a94cd1
Reviewed-on: https://gerrit.instructure.com/43512
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
2014-11-14 22:07:00 +00:00
James Williams c4b8c664af datafix missing observer enrollments from sis imported enrollments
fixes #CNVS-16391

Change-Id: I37943039912d88e2ea3946fa5c2fcacbf9909265
Reviewed-on: https://gerrit.instructure.com/44416
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-11-13 23:01:39 +00:00
James Williams 46bdd91fda fix add_role_id_columns for inactive roles
Change-Id: I19d60fee85e4cb4cd1bddf606adc53be1caa36eb
Reviewed-on: https://gerrit.instructure.com/44296
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-11-11 22:38:49 +00:00
Ahmad Amireh da11cb0cbd QuizLogAuditing - JS core
- workflow for modular event tracking
- two basic event trackers: PageFocused and PageBlurred
- events are buffered, and are stored in localStorage when possible
  - they will also be (re)loaded when the page is reloaded
- events can be submitted in bulks to the API

backend changes:

  - renamed "answers" column to "event_data"; answers is now an alias
    for nicer API when dealing with EVT_QUESTION_ANSWERED events
  - renamed EVT_ANSWERED to EVT_QUESTION_ANSWERED for consistency with
    how we're naming events
  - API now accepts and stores the "event_data" attribute
  - The optimizer in the Snapshot parser is now more aggressive; it will
    do as many passes as needed to achieve 0 data redundancy

Closes CNVS-16177

TEST PLAN
---- ----

  - create a quiz
  - take it
  - open the developer's console, go to the Resources tab and also leave
    the console open (i left some messaging in to make this easier)
    - move the cursor out of the window then back in
    - look at the console, you should see messages like
      "Enqueuing event ... for delivery"
    - click the little reload/refresh icon in the dev tab
      + verify you see an entry called "qla_events"
      + the value of this entry should be a JSON that looks something
        like what's shown below
    - in a few seconds, if you look at the Network tab, you will notice
      a request to a URL like
      "/api/v1/courses/1/quizzes/1/submissions/1/events"
    - (optional) look up the records in the database and verify they
      make sense (don't really need to do this if the request was
      successful :)

Sample of PageFocused and PageBlurred events serialized in localStorage:

    [
      {
        "type": "page_focused",
        "created_at": "2014-10-09T14:55:50.887Z"
      },
      {
        "type": "page_blurred",
        "created_at": "2014-10-09T14:55:51.131Z"
      }
    ]

Change-Id: I7efbbef281faece5df90f09c299bfa3260abcff6
Reviewed-on: https://gerrit.instructure.com/42466
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Derek DeVries <ddevries@instructure.com>
2014-11-11 22:25:02 +00:00
Ahmad Amireh cb498b345f canvas-partman & quiz log auditing partitioning
A small gem for abstracting partitioning at the model layer, as well as
helpers for dynamically creating the partitions needed for quiz
submission events.

You can read more about the gem's API in its README file.

Closes CNVS-16795

TEST PLAN
---- ----

  - check out the patch
  - run `bundle exec rake db:migrate`
  - run `bundle exec rake canvas:quizzes:create_event_partitions`
  - run the rails server and visit any page:
    + if you got this far, and jenkins has passed, things are good

Change-Id: I7d6b77c62db8510e09a54fbae00048a14b5366bb
Reviewed-on: https://gerrit.instructure.com/44145
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-11-11 19:06:00 +00:00
James Williams 6272acceb4 improve add_role_id_columns migration performance
Change-Id: I6550a53b2cde3ff9e5638c5af9c60ed77698e9b7
Reviewed-on: https://gerrit.instructure.com/44208
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-11-11 14:47:02 +00:00
Rob Orton 6c975aa87b change migration to be postdeploy
refs g/42395

test plan
 - migrations should run

Change-Id: Icb302d1b26c4cabed1bbb3dd25dad31b7d381936
Reviewed-on: https://gerrit.instructure.com/44106
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-11-07 21:05:53 +00:00
Cody Tanner fcaedde451 adds checkbox to quiz/show_answers to show correct answers on last attempt
closes PFS-201, PFS-202, PFS-203

Test Plan Happy Path: 
	1) Setup Canvas and run migrations
	2) Create a quiz and set the number of attempts to 2
	3) Check "Let students see their responses"
	4) Check "Let Students see their correct answers"
	5) Check "Only after last attempt"
	6) As a student, take the quiz. On the first attempt verify that you do not see the correct answers.
	7) As a student, take the quiz for the final attempt and verify that you see the answers to the questions.

Change-Id: I6c108174c817959be23770b3dfa9065831907460
Reviewed-on: https://gerrit.instructure.com/43179
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Cody Tanner <ctanner@instructure.com>
Product-Review: Cody Tanner <ctanner@instructure.com>
QA-Review: Cody Tanner <ctanner@instructure.com>
Tested-by: Cody Tanner <ctanner@instructure.com>
2014-11-06 21:29:29 +00:00
James Williams 81d4adc319 new roles
refactor everything that used to use strings for roles
to use actual role_ids

the apis should be backwards compatible so we don't need
to update (most of) the UI's right away in this commit

test plan:
* regression tests for permissions, role overrides,
 alerts (for account roles), enrolling users,
 adding account admins, etc.

refs #CNVS-15481

Change-Id: Id57fd3104c5c518b6fbf180609950dcddcdd474d
Reviewed-on: https://gerrit.instructure.com/41208
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-10-31 19:44:14 +00:00
Cameron Matheson 217ae3b60b add workflow_state to grading periods
closes CNVS-16215

Test plan:
  * create some grading periods
  * delete some
  * the api shouldn't return deleted grading periods in subsequent
    requests
  * the grading periods should be soft deleted

Change-Id: If4b795a05fd8eee9cde1bd90ab4db941004bc2a0
Reviewed-on: https://gerrit.instructure.com/43266
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
2014-10-31 16:58:21 +00:00
James Williams 2580db6a52 course link validator + API
test plan:
* the course link validator should look at all user supplied
 HTML content in a course and return a list of bad links:

 - links to external content that does not return
 a valid response (i.e. dead links).
 - misconfigured urls
 - links created by missing file references in imports

* use the (currently) undocumented link validator API

POST /courses/:course_id/link_validation
 - Starts a link validation process

GET /courses/:course_id/link_validation
 - Gets the current process status
 and results (if processed)

* should return a list of items in a course, the
 bad urls, as well as a direct link to the item (for the
 future UI to follow)

refs #CNVS-15162

Change-Id: I613fff7d603e133cc155e5fb33c7f257affe0f48
Reviewed-on: https://gerrit.instructure.com/42821
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2014-10-30 15:06:32 +00:00
Spencer Olson 0b52ed43cf add custom naming functionality to grading period
closes CNVS-16370

test plan:
-in rails console, create a GradingPeriod and give it a title.
  $ rails c
  $ g = GradingPeriod.new(start_date: Time.zone.now, end_date: 2.days.from_now, weight: 25.0, title: "Custom Name")
-verify you can get the title, change it, and save it.
  $ g.title #should return "Custom Name"
  $ g.title = "New Title!"
  $ g.save #should return true
  $ g.title #should return "New Title!"


Change-Id: I3c1fe8f7f5849fb9550b0006b837e22aeef0abdb
Reviewed-on: https://gerrit.instructure.com/43172
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
2014-10-29 15:31:17 +00:00
Spencer Olson 73e6d2ecc6 add foreign keys to grading_periods table
closes CNVS-16414

Change-Id: I58543fbc267350871b170b5a58644d54b9721c09
Reviewed-on: https://gerrit.instructure.com/43211
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-10-24 22:32:17 +00:00
Jon Jensen 9b19b077bb fix submission deadlocks, fixes CNVS-15988
this removes our db triggers and instead uses AR callbacks in conjunction
with after_transaction_commit. this way we won't get processes fighting
over the same assigments tuple.

note that we can't actually remove the hairtrigger gem until we clean up/
remove all those old migrations :-/

test plan:
1. tests should pass (and cover 2. and 3.), but just to be sure...
2. ensure that "assignments needing grading" counts work as expected
3. ensure that quizzes w/ essays don't show as graded in the speedgrader
   until the essays have been graded

Change-Id: I6af67605b18378bd3c181c710ba5027ec944394b
Reviewed-on: https://gerrit.instructure.com/43202
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Hannah Bottalla <hannah@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
2014-10-23 23:09:52 +00:00
Ahmad Amireh 657f9d14ef Non-null constraints for quiz_submission_events
Closes CNVS-16408

TEST PLAN
---- ----

N/A

Change-Id: I798cda1bd10fd4bc7c19253bbaefd7927efe56c0
Reviewed-on: https://gerrit.instructure.com/43205
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Derek DeVries <ddevries@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-10-23 16:28:06 +00:00
Michael Nomitch 5a03cf7f9b DA - students with quiz submissions can see show page
fixes CNVS-15783

test plan:
  - as a teacher make a DA'd quiz
    - as a student with an override and a grade,
      as a student with an override and no grade, and
      as a student without an override with a grade
      - the quiz is on the quiz index and assignment index,
        and the show page is normal
    - as a student without a grade or override, with a submission
      * note the submission grade must be nil (the gradebook is messed
      up so you may have to change it via the API)
      - the quiz is on neither the assignment index or quiz index
      - the quiz show page has a flash message telling you it doesnt count
    - as a student without a grade or override without a submission
      - the quiz is on neither the assignment index or quiz index
      - the quiz show page redirects you to the quizzes index
  - with DA off everything works as usual

Change-Id: I51e1e7efd1543e7bb6b858dfa04d7798a516c7c3
Reviewed-on: https://gerrit.instructure.com/41696
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cameron Sutter <csutter@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2014-10-22 14:58:40 +00:00
James Williams 96ab142d6c drop unused column from enrollment terms
Change-Id: Ib6cb6d6e9244b6c3be9602fc3fa2c33ea866e41d
Reviewed-on: https://gerrit.instructure.com/42395
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-10-09 19:28:47 +00:00
Spencer Olson 5fe8e3bd14 set up grading_period model, migration, and tests
closes CNVS-15906

test plan:
-run rake db:migrate
-verify the migration successfully runs, creating the grading_periods table and adding the index for course_id and account_id

Change-Id: If991a00fc79bc4aecabe8189a43432e2158709c8
Reviewed-on: https://gerrit.instructure.com/42161
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Reviewed-by: Josh Simpson <jsimpson@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Spencer Olson <solson@instructure.com>
2014-10-06 20:26:00 +00:00
Cody Cutrer dacf060160 no more dynamic finders
fixes CNVS-15126

Change-Id: I48b99ff69942463df6d6c355fe6f8a2fc679e69a
Reviewed-on: https://gerrit.instructure.com/41969
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-10-03 16:22:49 +00:00
Ahmad Amireh 63a5a8ac4c Extract events from quiz submission snapshots
Closes CNVS-15880

- a new model, QuizSubmissionEvent, for tracking events done during a
  quiz-taking session
- utilizes the quiz question answer serializers to maintain JSON
  representations of the students' answers, which are stored in the
  :answers DB column (also in JSON)
- events can be optimized to track only what has really changed between
  snapshots of a quiz submission
- all exported records are tagged with the "answered" event type (this
  is currently all we have without josh's patch)
- a few fixes were needed for the serializers to function, primarily
  adding (no)support for FileUpload and TextOnly questions so they don't
  blow up

Extras:

- a new convenience rake task, canvas:quizzes:dump_events that can be
  used by support to produce a JSON dump of all the events in a single
  quiz submission (for tracking student behavior)
- another rake task, canvas:quizzes:generate_events_from_snapshots, for
  use by developers for migrating data in QuizSubmissionSnapshots to
  QuizSubmissionEvents for a single quiz (or many). This will hit the DB

TEST PLAN
---- ----

There's no UI in this commit, only touches the DB. You can still test if
you like:

  - make sure you got some data logged before you check out this patch:
    + create a quiz and take it by a student, choose different answers
      so you log some actions, and then:
  - check out the patch
  - run `bundle exec rake db:migrate`
  - run the command below[1] to generate a JSON dump of the events and
    view it for integrity

[1] bundle exec rake canvas:quizzes:dump_events[quiz_submission_id,out]
    - replace "quiz_submission_id" with the ID of the student submission
    - replace "out" with some path to store the JSON in, like
      "./events.json"

Change-Id: Ifd8a43a66aba99780428623b956d868d87e53215
Reviewed-on: https://gerrit.instructure.com/41999
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Reviewed-by: Ryan Taylor <rtaylor@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-10-01 21:23:47 +00:00
Michael Nomitch 0a5e71d28e DA - quizzes
fixes CNVS-14094

test plan:
  - course with DA as students and teacher
    - api show & index
    - quizzes index page shows only assigned quizzes
    - quizzes show page url redirects to index if
      quiz isnt visible to user
    - grade calculation
    - gradebook/grades page
    - calendar events events
    - modules filter out quizzes correctly
    - observers see same things as their students
    - if a student takes a quiz and it is not graded and then
      loses visibility, make sure that the GB greys out the cell
      rather than showing a submission icon
  - same course with DA off works normally

Change-Id: I10b936f1516d6d24f11d74c0bb572051f0b1d1c4
Reviewed-on: https://gerrit.instructure.com/39897
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Mike Nomitch <mnomitch@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Mike Nomitch <mnomitch@instructure.com>
2014-10-01 20:58:54 +00:00
Brad Horrocks 06dc725a50 CC author on conversation create
Now it is possible to set a notification preference to receive
notifications when you create a conversation.

Fixes: CNVS-13744

Test plan:

Set conversation created notification preference
go to inbox
create a new message and send it
go to /messages to verify there is a notification for the new conversation

note: you will have to have a verified channel to see the new message

Change-Id: I662f2eb62806183871adcce39602d639dbbfc0a3
Reviewed-on: https://gerrit.instructure.com/40873
Reviewed-by: Joel Hough <joel@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Brad Horrocks <bhorrocks@instructure.com>
2014-09-26 22:23:00 +00:00
Rob Orton 71a5e88dec drop unused columns from asset user accesses table
refs CNVS-15776

test plan
 - migrations should run

Change-Id: I38f694782ed1733b83271bc1369c318183ed0120
Reviewed-on: https://gerrit.instructure.com/41770
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
2014-09-25 19:07:05 +00:00
Jeremy Stanley 2d33566c57 fix incorrect file state in Attachment#restore
test plan:
 0. BEFORE APPLYING THIS PATCHSET,
    a) delete a file in a course
    b) restore it via /courses/X/undelete
    c) notice that the restored file is not visible
       to students (but is visible to teachers)
 1. apply this patchset and run migrations
 2. confirm that the file deleted in step 0 is now visible
    to students
 3. delete and restore another file
 4. confirm that the restored file is visible to students

fixes CNVS-15616

Change-Id: Id8be88e63686cd0811409dfe6adb8bbf1a9d74c3
Reviewed-on: https://gerrit.instructure.com/41286
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2014-09-18 21:06:18 +00:00
Michael Nomitch a34b935850 DA - remove deleted assignments from sql view
fixes CNVS-15511

test plan:
  - turn DA off and make an assignment then delete the assignment
  - note the assignment's id
  - open the rails console and run this
    - "AssignmentStudentVisibility.where(assignment_id: XXXXX)"
    - instead of XXXXX, you should write the assignment's id
    - the result of that command should be an empry array => []

Change-Id: I2f09560ce46bd4682e9bf671b4c116508a6f4b49
Reviewed-on: https://gerrit.instructure.com/41114
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-09-17 15:11:50 +00:00
Nathan Mills 5af52334f6 move not_selected from external tools settings to it's own column
fixes: PLAT-646

Test Plan:
 * Install an external tool with the property "not_selectable" as true
 * when you look in the asmnt/module item external tool list the tool
   should not be listed

Change-Id: If66e09b83373fad83274d0120cb464e7caf60c83
Reviewed-on: https://gerrit.instructure.com/41205
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2014-09-17 14:32:37 +00:00
Cameron Matheson a1f400e754 remove scribd
closes CNVS-13380
closes CNVS-8057
closes CNVS-5156

Test plan:
  * scribd should no longer exist
  * document previews should work in canvadocs

Change-Id: I5ac60c3e986f030c3aea88e32d2992ec7b1c7a08
Reviewed-on: https://gerrit.instructure.com/37895
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-09-11 18:42:15 +00:00
Brad Horrocks f79db65e82 Copy of Announcement to Sender, notify announcement replies
Creates a new notification preference for announcements created by
you. Now you can see what you've sent, and how it looks in specific
communication channels. This new notification preference will also
send notifications when someone responds to the announcement.

Fixes CNVS-13745
Fixes CNVS-2135

Test Plan:

- Set "Announcement Created By You" preference
- Create an Announcement
- Check /users/[:user_id]/messages for "Announcement Created By You"
- As another user comment on the announcement
- Check /users/[:user_id]/messages for "Announcement Reply"

Change-Id: Ibb16f0dc3ba34d98f749c40d1df1eb12430aecca
Reviewed-on: https://gerrit.instructure.com/40636
Reviewed-by: Joel Hough <joel@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Brad Horrocks <bhorrocks@instructure.com>
2014-09-11 02:04:34 +00:00
Michael Nomitch cae40b6418 DA - get only unique entries from sql view
fixes CNVS-15063

test plan:
  - in course with DA
  - as a student submit multiple times to a selrel'd assignment
  - go to grade summary page and ensure there aren't dupes
  - in a course without DA, everything still works

Change-Id: I7bd24b71bc8661f9747200579e7c11ade4fac1bf
Reviewed-on: https://gerrit.instructure.com/39894
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Anna Koalenz <akoalenz@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2014-09-10 20:49:44 +00:00
Rob Orton 487ef9e8fc add gist index to pseudonyms to improve user search
refs CNVS-15212

test plan
 - rake db:migrate should succeed
 - user search should work and be faster

Change-Id: I8af5a1928e315a8ec68ea7b2b580a28d961c4147
Reviewed-on: https://gerrit.instructure.com/40690
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2014-09-09 21:14:04 +00:00
Nathan Mills 63945c4d35 add tool setting service
fixes PLAT-608 PLAT-613 PLAT-615 PLAT-616 PLAT-620

test-plan
*spec should pass

Change-Id: Idf2a7d89973231a070a8d368bd60554e3501cdf6
Reviewed-on: https://gerrit.instructure.com/40227
Reviewed-by: Brad Humphrey <brad@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
QA-Review: Nathan Mills <nathanm@instructure.com>
2014-09-08 16:58:00 +00:00
Ethan Vizitei 537d9ff033 Make substring searches for courses more performant
fixes #CNVS-12711

Using three seperate trigram searches
when looking for courses by a name match
is taking more time than we'd like.
This builds an index for all 3 relevant
columns together and reworks the scope
that references them to build a search
clause that takes advantage of that index.

TEST PLAN:
 - no behavior changes, just performance improvements
 - regression test /users/x/manageable_courses api
     endpoint with a name parameter as that's what
     makes the primary use of this query.

Change-Id: Ia645da66f0df1a4cec9298f7fa941fa51de815f4
Reviewed-on: https://gerrit.instructure.com/40507
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2014-09-05 21:21:00 +00:00
Cody Cutrer d589c9e7ec fix migrations that don't send later, even if prod
(i.e. new shards)

Change-Id: I2c66bcdc087229eb827cb4b91a2734723fdefbe9
Reviewed-on: https://gerrit.instructure.com/40578
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-09-04 22:10:27 +00:00
Ryan Shaw 5ab6d5beb5 Make sure no one has the new styles feature enabled
Since the work we are doing here is still very much
WIP, this makes sure no one has the new styles feature
flag turned on

this is a different approach than previous patchsets
since, because of caching or whatever, it was not
working correctly on test portals.

this just renames the feature so if anything was cached
for the previous feature, it won't matter.

and finally, just to clean up, we clear out the db
of any people that had set the old, now meaningless,
feature flag of 'new_styles'

fixes: CNVS-13571 CNVS-14903

test plan:
a) enable the feature flag before checking out the
   patch set
b) check out the patch set and run migrations
c) verify that the feature is no longer set and
   is hidden from non-site-admins

Change-Id: I6230064fe965c80128b047786c393043292114d5
Reviewed-on: https://gerrit.instructure.com/36225
Reviewed-by: Colleen Palmer <colleen@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-08-25 16:01:34 +00:00
Brad Horrocks 279fa22ddb Fixes Profile avatar on thumbnail no longer showing correct image
Thumbnails will now have namespace column which will be populated with
its attachments namespace on save. Old thumbnails will have null
namespace and should behave as they used to. New thumbnails will work
like boss.

Fixes CNV-12380

Test Plan
=========

Prerequisites
-------------

- S3 storage
- **Sharding**
	- multiple users with the same ID on different shards
	- profile photos on all the users with the same fileID

Details
-------

Before the fix the last uploaded avatar will be the *thumbnail* for
all user avatars that collide with each other.
After the code is updated all avatars will be blank.
After `bundle exec rake db:migrate` avatars should display correctly.

Change-Id: Iec533086308da352f317cda60b404327b14516e3
Reviewed-on: https://gerrit.instructure.com/39108
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
2014-08-22 22:17:51 +00:00
Nathan Mills 0a7d44b815 create tool_setting and tool_link models
fixes PLAT-600

test-plan:
specs pass

Change-Id: Ic7168bb5cca194b16b3c7f92ea51584ba9e747e7
Reviewed-on: https://gerrit.instructure.com/39714
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
QA-Review: Nathan Mills <nathanm@instructure.com>
2014-08-21 18:35:07 +00:00
Cody Cutrer b1dca446f1 fix duplicate notification policies
* use a join, not an include, when looking for channels by frequency
 * make the index more specific and unique

Change-Id: Ie8b83144e5155241ff22e40519584ffe5314541b
Reviewed-on: https://gerrit.instructure.com/39442
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-08-19 16:59:42 +00:00
Cody Cutrer 6706a69c81 drop notification_policies.broadcast
it's never used

NotificationPolicy#preference also becomes obsolete, because NOT NULL
and FK ensure that #communication_channel can never be nil; it's
also never used

Change-Id: I0669d3b89964ee6f6d4c6a62e348e276bb7ef315
Reviewed-on: https://gerrit.instructure.com/39446
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-08-18 19:27:05 +00:00
James Williams d25d9e23bc fix importing module items with missing content
fixes an issue that arose with rails 3, where
module items that were not set with content (and thus
shouldn't have been saved) were being autosaved and
breaking the entire modules page

test plan:
* import the package(s) referenced in the ticket
* the modules page should still be functional

fixes #CNVS-14777

Change-Id: I82fe287a4db9492489461e971911a0f7c15fbcb0
Reviewed-on: https://gerrit.instructure.com/39404
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-08-18 18:12:35 +00:00
Nick Cloward fbc53265e4 add redirect config to account authorization
fixes: CNVS-9194

This adds a configuration to CAS and SAML which will redirect to when an
unknown user is authorized from CAS or SAML but we do not have a
pseudonym for them in canvas yet.  Instead of logging them out of CAS or
SAML it will redirect them to a custom url.  By default if no url is
configured it will redirect to the login page or cas login page.

Test Plan:

CAS:
  - Setup a User on the CAS server that can login.
  - Make sure the user is not in Canvas and wont be matched up to any
    other Canvas pseudonyms.
  - Log in to CAS and Canvas.
  - Canvas should redirect to cas_login_url.
  - Configure the Canvas CAS setting unknown user url to redirect to
    a custom url.
  - Log in to CAS and Canvas
  - Canvas should redirect to the custom url specified.
  - The user should not be logged out of CAS.

SAML:
  - Setup a User on the SAML server that can login.
  - Make sure the user is not in Canvas and wont be matched up to any
    other Canvas pseudonyms.
  - Log in to SAML and Canvas.
  - Canvas should redirect to login_url and provide a flash message
    stating that the user could not be found.
  - Configure the Canvas SAML settings Unknown User Url to redirect
    to a custom url.
  - Log in to SAML and Canvas
  - Canvas should redirect to the custom url specified.
  - The user should not be logged out of SAML.

Change-Id: I29a78f8ec60c94caecf63547584d8ae804ffc9de
Reviewed-on: https://gerrit.instructure.com/38472
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Matt Fairbourn <mfairbourn@instructure.com>
2014-08-14 15:12:41 +00:00
Cody Cutrer d33066ea27 more indexes supporting foreign keys
Change-Id: I43026dd7b489dcc87f6629f47a2a52e7b44f6c96
Reviewed-on: https://gerrit.instructure.com/39035
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-08-13 14:49:03 +00:00
Cody Cutrer 4f4ffd1ea9 only clear cache for default shard
so that we don't accidentally clear it for each new shard

Change-Id: I93f760e72646ae0231a8d6659ea3b5370ecbac10
Reviewed-on: https://gerrit.instructure.com/38913
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-08-12 18:13:25 +00:00
James Williams 75d21f8f84 migrate has_X context_external_tool columns to separate table
currently every extension type has its own boolean db column
while this isn't strictly a problem, it is a little sad, and
given the fact that we will be adding more extension types soon,
it's probably better to take care of this now

also i'm refactoring some of the methods in context_external_tool

test plan:
* external tool regressions

refs #CNVS-13815

Change-Id: I6caf7b0e3d0de054906e3530f085fbfa9e8e499f
Reviewed-on: https://gerrit.instructure.com/38923
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-08-12 12:13:42 +00:00
Brad Humphrey 817f5429b4 change tool proxy root_account to context
also, clean up ims-lti usage with pluralized lti methods

test plan:
  - registrations should still work
  - registrations without resource handlers
    and using a default message handler should still work

fixes PLAT-566 PLAT-567

Change-Id: Icd9feca44ba9f5600d89a4943b0b93b34aeb78a5
Reviewed-on: https://gerrit.instructure.com/38182
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
QA-Review: Brad Humphrey <brad@instructure.com>
2014-08-07 19:57:40 -06:00
James Williams 81558f728c remove rails 2 support
closes #CNVS-14261

Change-Id: I1b0e8a4438ab659ecd1ac8462bc3559d810989b3
Reviewed-on: https://gerrit.instructure.com/38744
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-08-06 18:16:19 +00:00
Nick Cloward 8a06da0ca1 store last batch for data fixup
refs: CNVS-13987

Added a way to store the last batch that was ran.  Seperated out
the batch processor and the actual cleaner methods.  This will
allow us to add it to event stream to fix records as they are
queried if we choose.  This also moved the temporary mapping and last
batch tables to the migration.  g/38429 removes the tables.

Test Plan:
  - Same as g/37956 and g/37605
  - Migration should not fail if mapping table already exists.
  - With a grade change try deleting the submission then running the
    fixup.

Change-Id: Ibce843c22b72885f7e2510d85b482c39f513996b
Reviewed-on: https://gerrit.instructure.com/38407
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2014-07-30 21:59:41 +00:00
Jayce Higgins f3f8b0c428 Adds peer review notification for assigning peer reviewers
Fixes: CNVS-3771

Adds a peer review notification to go out after
a peer reviewer is added to the discussion. This
also resolves the issue with a notification not
being sent if a rubric is not attached.

Test-Plan:
1.) Run bundle exec rake db:migrate in the console
	before doing anything else -- (This sets up your
	db by using notification_types.yml to populate
	notification types in the DB.)
2.) Create a graded discussion with at least 2
     students
3.) Make sure both students have everything
     in their notifications set to ASAP.
4.) Edit the assignment settings and select the
     'Require Peer Reviews' - Choose to manually
     select peer reviewers.
5.) Navigate to discussions as an admin
6.) Select the cog and go to peer reviews.
7.) Assign a peer reviewer and verify that the
     notification was sent out.

Change-Id: I78212cb8043de0fcf809a9ffa56ffca327ffcacc
Reviewed-on: https://gerrit.instructure.com/36646
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
Product-Review: Matthew Wheeler <mwheeler@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
2014-07-25 19:56:57 +00:00
Nick Cloward dec7a2231e data fixup needs to support Cassandra 1.1
refs: CNVS-13987

Test Plan:

  Same as g/37605 but under Cassandra 1.1
  Lower the batch size and make sure it has the same results.

Change-Id: Id35b7a2690fd33e1769d27836deb374630f27fd3
Reviewed-on: https://gerrit.instructure.com/37956
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2014-07-24 18:01:25 +00:00
Cameron Sutter 79f45f569d DA - quiz edit page
fixes CNVS-9766

test plan:
 * turn on the Differentiated Assignments feature flag
 * from the quiz edit page
  - add a due date for some of the sections, but not all
  - save (update quiz)
  > the only_visible_to_overrides flag on the quiz should be true
  > edit the quiz again and there should not be an
    empty due date row for 'Everyone else'
  - add a due date for all the sections
  - update the quiz
  > the only_visible_to_overrides flag should not be there
  - edit the quiz so that there are only due dates
    for some sections but not all
 * on the normal quiz show page and
 * on the new Quiz Statistics show page
  > there should not be a row in the due date area
    for 'Everyone else'
 - turn off the DA flag and make sure the quiz show page works
   with the 'New Quiz Stats page' flag and without it
 - make sure the edit page works with the DA flag off as well

Change-Id: Ifb090a195ff3283d963df12ae7a9eb503f32ee86
Reviewed-on: https://gerrit.instructure.com/34085
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Amber Taniuchi <amber@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
Product-Review: Cameron Sutter <csutter@instructure.com>
2014-07-23 14:41:24 +00:00
Nick Cloward 2bc1395790 audit log uuid data fixup
refs: CNVS-13987

Creates new records for audit log data that has been overritten.  Since
we cannot all of the actual event data they are created as a corrupted
record

Test Plan:
  - Clear Audit logs (Not manditory but easier to see data)
  - Generate Bad Audit data for each test case.
    * Supplied script should generate the bad data.
    * Refer to test case to ensure data is created correctly.
  - Pull Commit and run migrations.
  - Check Case 1
    * The original id record should still exist with a record in
      courses_by_course.
    * Before the fix only one course change record will exst.  After the
      after the fix a second tombstone record with a record type of
      corrupted should exist with related index records in
      courses_by_course.
    * Key column in each index should match the id/bucket format.
    * ordered_id in each should match timestamp/first eight of id.
 - Check Case 2
    * After the fix pick a tombstone record and ensure that it as an
      index record in each of the index tables: authentications_by_pseudonym,
      authentications_by_user, authentications_by_account.
    * Ensure cross bucket event indexes create a tombstone and match in
      other indexes as well.  Id should be unique in the index tables
      and stream table.

- Code to generate test cases:

target_course = Course.find(...)
target_user = User.find(...)
target_pseudonym = target_user.pseudonyms.first

event = Auditors::Course.record_created(target_course, target_user,
source: :manual)
record = Auditors::Course::Record.generate(target_course, target_user,
event.event_type, event.event_data, source: :manual)
record.attributes['id'] = event.id
record.attributes['created_at'] = Time.now + 1.day
Auditors::Course::Stream.insert(record)

event = Auditors::Authentication.record(target_pseudonym, 'login')
record = Auditors::Authentication::Record.generate(target_pseudonym,
event.event_type)
record.attributes['id'] = event.id
record.attributes['created_at'] = Time.now + 100.days
Auditors::Authentication::Stream.insert(record)

Change-Id: I888da1758282d0e3f2d19a4438c1a866a6f54125
Reviewed-on: https://gerrit.instructure.com/37605
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2014-07-18 21:44:46 +00:00
Nathan Mills a91d9c09d0 add lti2 models and registration endpoints
fixes PLAT-522 PLAT-429 PLAT-545 PLAT-540 PLAT-498

test-plan
you can register an lti2 tool

Change-Id: If045b694213e1019f8a595b63a7e33ea4ac28e64
Reviewed-on: https://gerrit.instructure.com/37095
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
2014-07-18 16:42:10 +00:00
Cody Cutrer 45bf5773f3 fix migrations for mysql
fixes CNVS-13306
fixes gh-453

MySQL refuses to change columns that have a foreign key on them

Test plan
- Run the polling migrations on MySQL
- They should migrate the database correctly.

Change-Id: Ib781c5237c0973b254043096e536ac094dd809cf
Reviewed-on: https://gerrit.instructure.com/35511
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-07-17 20:38:10 +00:00
Michael Nomitch a60802d00e DA - sql view and shared methods
fixes CNVS-13649

test plan:
  - go to a few pages and make sure no errors occur
    - GB2
    - assignment index
    - student grades page
  - do same with and without DA on

Change-Id: I72f303cf54c36420a57dfbd23635f319f9827bd0
Reviewed-on: https://gerrit.instructure.com/36675
Reviewed-by: Cameron Sutter <csutter@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
2014-07-15 18:03:57 +00:00
Ahmad Amireh ab0c410b49 Quizzes - Lock down results after first view
Adds an option to Quiz that prevents the students from seeing their
results more than once after their submission.

Closes CNVS-13877

CHANGES
-------

  - New option in quiz settings:
    "Let Student See Their Responses" => "Only Once After Each Attempt"
  - Teacher can always see the student's results
  - Moderate dialog allows teacher to manually reset the result-locking
    flag, allowing the student one more glimpse
  - The flag is reset whenever a new attempt is taken

TEST PLAN
---- ----

  - create a quiz
  - toggle the new option: "Let Student See Their Responses" then "Only
    Once After Each Attempt"

Turn off Ember/quiz stats:

  - take the quiz by a student, turn it in:
    - verify that you see your results
    - reload the page
      - verify that you no longer see the results
  - take the quiz again:
    - verify you see the results once, then not
  - go to the moderate page as the teacher
    - open the moderate dialog for that student
      - check the new option "Let the student see the results one more
        time"
      - click Save
        - reload the page as the student, verify that you see the
          results

Turn on Ember/quiz stats:

  - repeat the process

Other things to test:

  - verify the new field "has_seen_results" is visible in the
    submissions API and is documented
  - verify the new field "one_time_results" is visible in the quizzes
    API and is documented properly
  - verify that the new option has no effect if the Quiz option is not
    set
  - verify that you can always see the student's results as a teacher
    (the setting should not affect teachers)

Change-Id: I6eb4909f777e038acf6afc9ef2823352f5ea78be
Reviewed-on: https://gerrit.instructure.com/37544
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Ahmad Amireh <ahmad@instructure.com>
2014-07-15 09:47:56 +00:00
Cody Cutrer 9b1e8c7350 more fk indexes
also fix an old migration that should have ran on all shards

Change-Id: Ib4305c4f1b84ba0cfd525d0f552cfc21d365dc24
Reviewed-on: https://gerrit.instructure.com/37492
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-07-14 21:06:23 +00:00
Jacob Fugal d9c6e2a0cd clarify Slug vs. UUID and fix event stream
refs CNVS-13987

what was called CanvasUuid was *not* generating UUIDs. it was generating
slugs. by default, its generate method only creates 4 character slugs.
these should obviously not be used as UUIDs. the misnomer already caused
a bug in EventStream where it used these slugs as UUIDs, causing
collisions. to fix:

 (1) rename canvas_uuid gem to canvas_slug, and rename it's primary
     class CanvasUuid to CanvasSlug
 (2) create new canvas_uuid gem, with class CanvasUUID, extracted from
     lib/uuid_singleton for actual UUID generation
 (3) fix event stream use CanvasUUID, rather than following the rename
     of CanvasUuid to CanvasSlug

test-plan:
 - have cassandra set up for audit logs
 - create an audit log entry (e.g. change a grade)
 - look at the generated audit log entry's id field; it should be a UUID
   value, not a 4 character slug

Change-Id: I19758fff4433cd6cb2e21219217dced19ee05c5a
Reviewed-on: https://gerrit.instructure.com/37506
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2014-07-11 16:58:42 +00:00
Jeremy Stanley 3fa2e9c3db give content_exports polymorphic context
test plan:
* content export regressions

closes #CNVS-13468

Change-Id: I44dcf077967d4273c0ae9056074b03853d66a5dc
Reviewed-on: https://gerrit.instructure.com/35745
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jon Willesen <jonw@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-07-09 16:34:39 +00:00
Cameron Matheson ed5b8ae452 get rid of weird before_quiz_submission_types attr
Test plan: specs pass

Change-Id: Ibfcaf313345277daa2a1f2f50741b7e3131fc9ec
Reviewed-on: https://gerrit.instructure.com/37365
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cameron Matheson <cameron@instructure.com>
QA-Review: Cameron Matheson <cameron@instructure.com>
2014-07-08 17:58:06 +00:00
James Williams 17d5bd42a6 fix db:migrate in non-production environment
Change-Id: Ibb4465348162219b4f1da6f1a842234a7cecd78e
Reviewed-on: https://gerrit.instructure.com/37316
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
2014-07-07 14:46:45 +00:00
Rob Orton fe8e121ee3 move deleted enrollments when cross listing sections
fixes CNVS-13828

test plan
 - prior to checking out patch set
 - enroll a user in a section
 - delete the enrollment
 - cross list the section
 - attempt to add user to sections new course
 - it should fail
 - checkout patch set and run migration
 - attempt to add user to sections new course
 - it should succeed

 - enroll a user in a section
 - delete the enrollment
 - cross list the section
 - attempt to add user to sections new course
 - it should work (it will restore the old enrollment)

 - enroll a user in a cross listed section
 - delete the enrollment
 - uncross list the section
 - attempt to add the user to the sections current course
 - it should work (it will restore the old enrollment)

Change-Id: Ib397f96b0761d87bf6f9fb11ffc978012f0f5b39
Reviewed-on: https://gerrit.instructure.com/37036
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2014-07-02 18:45:04 +00:00
Michael Ziwisky d3d356f89a fix some migration rollbacks
Change-Id: Icd0faea42d6eae75604f9fc0f51df77072fc37a2
Reviewed-on: https://gerrit.instructure.com/36814
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
2014-06-25 01:04:48 +00:00
Jon Willesen 9b960aae30 add integration type to context external tools
Fixes RD-78

Test Plan:
 - specs pass

Change-Id: I4a53cdd71784ce9e2988cbfe9b6df7e7347a9d25
Reviewed-on: https://gerrit.instructure.com/34501
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
QA-Review: Jon Willesen <jonw@instructure.com>
2014-06-24 16:07:59 +00:00
Jon Willesen f19389f8a9 Add course settings sub navigation lti extension
fixes RD-76

test plan:
 - as a teacher, navigate to a course settings page. the right
   sidebar should look normal.
 - modify an lti app's xml to include the
   course_settings_sub_navigation extension
 - configure an lti app via modified xml.
 - navigate to a course settings page, where you should see a
   button for the configured tool at the top of the right
   sidebar.
 - clicking on the button should launch the tool.

Change-Id: Iec9e3337437295865bab66a499fe8fc096ad0ba5
Reviewed-on: https://gerrit.instructure.com/36471
Reviewed-by: Brad Humphrey <brad@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
2014-06-24 13:39:17 +00:00
Jeremy Stanley 3279012b9f fix incorrect published states for quizzes and assignments
test plan:
 0. BEFORE APPLYING THIS CHANGESET, reproduce the original bug:
   a) Have a course with draft state enabled
   b) Create a new module in the course, and do not publish it yet
   c) Add a new assignment to the course via the modules page
   d) Publish the module. This should publish the assignment.
      (refresh the modules page if you don't see that happen.)
   e) As a student, look for the assignment in the Assignments
      index page and the Syllabus page. You don't see it there.
      Because the modules page didn't publish it correctly.
 1. Apply the changeset and run migrations.
 2. (If production) wait for the datafix job to complete.
    It should complete almost immediately unless your job
    server is backed up. Look for the following in your log:
    DataFixup::FixIncorrectPublishedStatesOnQuizzesAndAssignments
 3. The assignment created in 0e should now be visible to
    students in the Assignments page and the Syllabus page.
 4. Repeat steps 0a-0e. This time, the published assignment
    should be visible to students in the assignments index
    and syllabus page right away.

fixes CNVS-13604

Change-Id: I657c90deb115a6d047abb81cbdabe014fd74778f
Reviewed-on: https://gerrit.instructure.com/36511
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>
2014-06-20 17:28:39 +00:00
Jon Willesen 56aee2cfc1 add concurrently to recent add_index migration
Change-Id: If3cd851f83315a7bc7484fbd9948aebcd356eb2a
Reviewed-on: https://gerrit.instructure.com/36518
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-06-19 17:02:24 +00:00
Brian Palmer 1b6bb95425 don't try to drop cassandra column in 1.2.x
test plan: run migrations in cassandra 1.2.x, and you shouldn't get an
error. migrations in 1.1 and 2.0 should still drop the
page_views.contributed column.

Change-Id: I18d0fc52c8a9f6e86e3f4907a0bf2e9a7aaee283
Reviewed-on: https://gerrit.instructure.com/36528
Reviewed-by: Rob Orton <rob@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
2014-06-17 17:25:43 +00:00
Cody Cutrer 195172f1c9 delete delayed messages before deleting cc in migration
also do notification policies in bulk for sanity

Change-Id: If32f06c073f8eb86d424b1287b3423ba212e2b43
Reviewed-on: https://gerrit.instructure.com/36472
Reviewed-by: James Williams  <jamesw@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-06-16 18:51:49 +00:00
Ethan Vizitei a0c96d6a41 Add reporting name for learning outcomes
fixes CNVS-13242

This adds a special field to learning outcomes
to use for friendly reporting in case the outcome's
actual name is quite complex or cryptic (like common core
standard outcomes).

TEST PLAN:
- login as an instructor
- create or edit an outcome and validate that you can add a "friendly"
  name and that it persists
- use that outcome for an assignment and let a student complete it
- navigate to the student mastery report for that student
- verify that by hovering over that outcome name on the student mastery
report you can see both the real title and the friendly name

Change-Id: I89d1a5de590666ddf6cbc82617e4475d1f7a5226
Reviewed-on: https://gerrit.instructure.com/35919
Reviewed-by: Drew Bowman <dbowman@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Drew Bowman <dbowman@instructure.com>
2014-06-11 17:25:33 +00:00
Josh Simpson 53920a96ce add explicit poll choice ordering and poll_session deletion
fixes CNVS-13521,CNVS-13489
This commit adds 3 things.  One is a fix for deleting a poll_session when
there are poll_submissions created already for the poll_session. The
second is the addition of a new attribute on poll_choices called
'position'.
The 'position' attribute specifies the order a poll choice should be
returned in. The third is the visibility of poll sessions to students:
as long as a student is enrolled in the course (and course section, if
it exists on the poll session) associated with the poll session, they
can access it, whether or not it's open or closed.

Test plans
1. Deleting a poll session
As a teacher
- Create a poll and related poll session
- Open the poll session for submissions
As a student
- Create a submission for the newly created poll session
As a teacher
- You should be able to delete the poll session

2. Position ordering attribute
As a teacher
- Create a poll
- Create poll choices, passing along the 'position' attribute to specify
  ordering (try to mix these up, e.g. create a poll choice with a
  position
  of 2, then a poll choice with an position of 4, then a poll choice with
  an position of 3, then a poll choice with an position of 1)
- Retrieve the poll choices for the poll with the poll choices index
  endpoint
- The poll should be returned in the order they were specified using the
  'position' attribute

3. Poll session visibility to students
As a teacher
- Create a poll
- Create an associated poll session with a valid course
As a student enrolled in the given course
- You should be able to view the poll session whether or not it's open
  or closed.
As a student not enrolled in the given course
- You should not be able to view the poll session, whether or not it's
  open or closed.

Change-Id: Ifabd64540d843c83f3a22fb6668c4fcac8f728b0
Reviewed-on: https://gerrit.instructure.com/36087
Reviewed-by: Derek DeVries <ddevries@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2014-06-11 00:48:16 +00:00
Josh Simpson 608b0896e2 improve polling performance
fixes CNVS-13440
this commit addresses bad polling performance, particularly in
poll_sessions. It also removes a foreign key constraint on the
poll_sessions poll_id, that would introduce sharding issues.

Test plan
- Test the following attributes on particular models to insure that
  they're still correct:
  - Poll#total_results should accurately return the aggregate results for all of
    the poll_sessions that belong to the poll
  - PollSession#results should accurately return the results of all poll
    submissions submitted for the particular poll session

Change-Id: Ic0d4aaeb77c735fa4ba6c5f73dfbf84d8e6ac615
Reviewed-on: https://gerrit.instructure.com/35860
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Trevor deHaan <tdehaan@instructure.com>
Product-Review: Josh Simpson <jsimpson@instructure.com>
2014-06-10 19:53:31 +00:00
Brian Palmer c2dbb83883 protect against previously-run switchman migration
Change-Id: I8ef069aa61132d1d5772b3814f478d041dfd08a8
Reviewed-on: https://gerrit.instructure.com/36002
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeff Belser <jbelser@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2014-06-10 16:38:56 +00:00
Joel Hough 4ec0d04bb9 live assessments api
fixes CNVS-12916

test plan
- as a teacher in a course, use the api to create a live
 assessment aligned with an outcome (see the api docs for how the
 endpoint works)
- create results for some students
- ensure that the results and the assessment can be read back using
 the index endpoints
- ensure that the assessment shows up in the web ui at
 /course/:course_id/outcomes/users/:student_id (click 'Show All
 Artifacts')

- try to create an assessment using the same key as an existing
 assessment
- ensure that the existing assessment is returned (check the id)

- fetch results specifying a user id to filter by
- ensure that only results for that user are returned

Change-Id: I2d09691f772658aea3ccdd36cff2df5835b1f2cd
Reviewed-on: https://gerrit.instructure.com/35092
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Derrick Hathaway <derrick@instructure.com>
2014-06-10 14:53:40 +00:00
Jon Willesen 3c65211658 add course_home_sub_navigation extension to external tools
this puts lti app links on the right side bar of the course
home page.

fixes RAN-53, RAN-55

test plan:
 - modify an lti app's xml to include the
   course_home_sub_navigation extension
 - configure an lti app via modified xml
 - navigate to a course home page, where you should see a button
   for the configured tool on the right sidebar.
 - clicking on the button should launch the tool.
 - configure another tool the same way, but include a
   "visibility" property in new extension with a value of
   "admins"
 - view the course home page as a teacher. you should be able
   to tee the newly configured tool, in addition to the
   previously configured tool.
 - view the course home page as a student. you should only see
   the first tool you configured, and not see the tool with the
   limited visibility property.

Change-Id: Ibe50c649f6d5f6806a87f0c8e8402f1209b9ed40
Reviewed-on: https://gerrit.instructure.com/35161
Reviewed-by: Brad Humphrey <brad@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Nathan Rogowski <nathan@instructure.com>
Product-Review: Jon Willesen <jonw@instructure.com>
2014-06-09 23:30:43 +00:00
Brian Palmer ce945a721b migration lint for instance vs class migration methods
self.up works in rails2 and rails3, but up only works in rails3+

also tag the switchman migrations as RAILS3 only, now that they actually
run in rails2

Change-Id: I768c8e657e86de6504a40444d127e2d875ce6934
Reviewed-on: https://gerrit.instructure.com/35390
Tested-by: Brian Palmer <brianp@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2014-06-05 15:55:55 +00:00
Jeremy Stanley b8310e49f5 track attachments through overwrite+rename/move via replacement_attachment_id
test plan:
 1. upload a file to a folder in a course
 2. link to the file from course content (such as a wiki page
    or assignment body)
 3. overwrite the file with another file of the same name
 4. rename the file
 5. view the course content and ensure the file link still works
 6. repeat steps 1-5, replacing step 4 by "move the file to another folder"

fixes CNVS-12359

Change-Id: I11832c307f286920174ba4731af2e88490497f92
Reviewed-on: https://gerrit.instructure.com/35677
Reviewed-by: James Williams  <jamesw@instructure.com>
Reviewed-by: Mark Severson <markse@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Hilary Scharton <hilary@instructure.com>
2014-06-02 17:11:51 +00:00
Ethan Vizitei 39a35ab09e Use source user as "FROM" for emails
This gives certain user-triggered events
a "look" as though they came directly from
that user (the FROM and REPLY-TO headers
have the name of the source user).

This also introduces "letter_opener" into the
dev environment.  If you use "letter_opener"
as your send method for dev emails, it will
open all emails in a browser tab. Very useful.

closes: CNVS-11837

TEST PLAN:

Validate each of the following notifications
looks like it's "from" the source user:

- Submitting an assignment
- Resubmitting an assignment
- Posting to a discussion
- sending a conversation message
- posting a comment on a submission

Change-Id: I0e04aa9aa5bf31a590e69507e04b86b637247acf
Conflicts:
	app/models/message.rb
Reviewed-on: https://gerrit.instructure.com/35362
Reviewed-by: Drew Bowman <dbowman@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Steven Shepherd <sshepherd@instructure.com>
Product-Review: Drew Bowman <dbowman@instructure.com>
2014-05-31 01:02:14 +00:00