Commit Graph

370 Commits

Author SHA1 Message Date
Cody Cutrer 73642ce76c skip importing accounts that didn't change
refs CNVS-17778

Change-Id: I8ff78392cee358df9bb28720a19cb956694b7d0e
Reviewed-on: https://gerrit.instructure.com/47025
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2015-01-13 21:22:42 +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
Nick Houle fbbd850369 load integration_id from user CSV file
fixes SIS-661

Test plan:
- confirm integration_id is now being loaded from user csv
- specs pass

Change-Id: Ie47c1bf9420871b1a017ebc0352d968e1564dda7
Reviewed-on: https://gerrit.instructure.com/45121
Reviewed-by: Ken Romney <kromney@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cosme Salazar <cosme@instructure.com>
2014-12-06 00:05:38 +00:00
James Williams 0111a78063 fix deleting of observer enrollments through sis import
test plan:
* enroll a student and an observer through an sis import
* delete the student enrollment through sis import
* delete the observer enrollment through sis import
* should properly delete the observer enrollment

closes #CNVS-1729

Change-Id: Ief3135f99549bdafa8f9068aeaca7c5e91fe8152
Reviewed-on: https://gerrit.instructure.com/44599
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Sean Lewis <slewis@instructure.com>
2014-11-25 01:21:51 +00:00
Jacob Fugal afcb8ba178 don't leak course objects during enrollment import
refs SIS-514

test-plan:
 - regression on SIS enrollment imports
   - particularly, that courses imported into get "touched"
 - start large enrollment import (~100k enrollments)
   - monitor job process memory (e.g. with top)
   - shouldn't climb while importing enrollments

Change-Id: I12ce16a0c86056f3588671140cb9a9fde5db85ce
Reviewed-on: https://gerrit.instructure.com/44703
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2014-11-20 22:45:36 +00:00
James Williams cf4837f708 fix sis_source_id setting with new roles
Change-Id: I4beb68a93f6eb4a613e63d12ec79dbca179083ed
Reviewed-on: https://gerrit.instructure.com/44447
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-14 16:57:31 +00:00
Nick Houle 97785c9d7e add translations to SIS Import plugin
fixes SIS-627

Test Plan:
- To allow Canvas to be translated you must start canvas with
  these options:
-- RAILS_LOAD_ALL_LOCALES=true USE_OPTIMIZED_JS=true rails s

- Confirm all translations in these screenshots are translated
-- http://screencast.com/t/DUuU85s0
-- http://screencast.com/t/HDawR9681i
-- http://screencast.com/t/QOVas4gfd

NOTE:
- If you're using the LOLCALIZE=true option to test translations
  months, days, etc. will not be translated by LOLCALIZE but will be
  translated in another language.
- If you're using Spanish or French as the language be aware that
  some of the short hand months are the same as english becasue
  they are related closely to english.

Change-Id: Ia14a3ec4408f40c9bcdd309c7088c5165519a1f9
Reviewed-on: https://gerrit.instructure.com/43983
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jayce Higgins <jhiggins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Nick Houle <nhoule@instructure.com>
2014-11-11 23:45:26 +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
James Williams d91b6e52a7 fix observer linking after sis import
test plan:
* create a student
* as a user with a valid login,
observe the student permanently using the
observees UI ("/profile/observees")
* enroll the student in a course through
an sis import
* should create an observer enrollment
for the observer as expected

closes #CNVS-14943

Change-Id: I087190b3672b51d2b2f91551ea3a0a424ab89091
Reviewed-on: https://gerrit.instructure.com/42205
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jahnavi Yetukuri <jyetukuri@instructure.com>
2014-10-07 16:37:55 +00:00
Cody Cutrer 5d42d023d2 no more dynamic finders (lib)
refs CNVS-15126

Change-Id: I4087b1c2442c5b8f70ce2138bf4aeef6ef7e59cd
Reviewed-on: https://gerrit.instructure.com/41259
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-09-23 16:53:56 +00:00
Brian Palmer fdefc984ae remove the new teacher registration email
This email only went to site admins, and isn't useful.

This commit stops new notifications being created, a subsequent commit
will remove the no longer used code and data.

refs CNVS-15219

Change-Id: Ibd8c88c7310cf3dcfb06cf0c782f2b3cf571d843
Reviewed-on: https://gerrit.instructure.com/40375
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2014-09-03 22:05:46 +00:00
Brian Palmer ac3a81c819 fix parallel sis batch progress interval
the marshalling to/from the child serialized delayed job isn't including
@last_progress_update, causing errors comparing a time to nil.

refs CNVS-14640

Change-Id: I6636335202921c0210edce2ebebd4eef4ec22dac
Reviewed-on: https://gerrit.instructure.com/39358
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
2014-08-14 23:47:56 +00:00
Brian Palmer 7ff79aff00 update sis batch progress on an interval, default 2s
Rather than based on a # of rows processed metric

fixes CNVS-14640

test plan: run a large-ish SIS batch, and it should succeed as you'd
expect. the progress in the UI/API should still update as it runs (and
when it completes), but maybe not quite as often.

Change-Id: I44e30c1bbd1cd70ade7633c48389bf6bf0d04773
Reviewed-on: https://gerrit.instructure.com/39281
Reviewed-by: Zach Wily <zach@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
QA-Review: Brian Palmer <brianp@instructure.com>
Tested-by: Brian Palmer <brianp@instructure.com>
2014-08-14 02:23:34 +00:00
Cody Cutrer 8b9fd9f462 use NO KEY UPDATE lock on postgres 9.3 for sis progress updates
Change-Id: Idcd3eaffcdac3e11a54ba6f172ce55b4c27b9737
Reviewed-on: https://gerrit.instructure.com/39287
Reviewed-by: Zach Wily <zach@instructure.com>
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-08-14 02:10:15 +00:00
Jeremy Stanley 6b7f0b3dc4 ignore zip entries containing '..' elements or symlinks
extract core unzip functionality into canvas_unzip gem, and put
security logic there. use this gem instead of shelling out to
`unzip` (which does not have the option to skip symlinks).

test plan:
 1. import 'evil_course_2.imscc' from CNVS-14338
    * there should be an import warning
    * you should get a blank syllabus body and
      definitely not see sensitive system data
 2. import 'evil_sis_import.zip' from CNVS-14346
    * a file called '/tmp/pwn3d' should not have been
      created on your app server
 3. sanity check the parts of canvas that unzip things:
    * course copy
    * course import
    * zip content imports via the API
    * zip file uploads from files page
    * assignment submission comments download/upload
    * sis imports

fixes CNVS-14338
fixes CNVS-14346

Change-Id: I38fa141653eb7bc483e99a28a135831b8cb3b2a6
Reviewed-on: https://gerrit.instructure.com/37959
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2014-07-24 15:41:21 +00:00
Nick Cloward feb9644b0f fix sis_batch id in course activity
fixes: CNVS-13302

Fixes the sis imports to log the sis batch correctly and to display the sis
batch on the details modal in the auditing ui.

Test Plan:

- Do a SIS import for a course.
- Open the Course Activity Audit logging and the sis batch id for the course
  should be shown in the dialog.
- If the source for an event is not SIS the sis batch field will not be shown.

Change-Id: Ib93a992dac83b2ec480d888e5d4686b808bcda8f
Reviewed-on: https://gerrit.instructure.com/35475
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2014-05-28 16:14:22 +00:00
Cody Cutrer 4777aac2df Merge pull request #445 from sfu/feature-sis-user-names
Add full & sortable name fields to SIS User Import

Change-Id: Ib8617572802ca69913b422d22301299ab75c211f
Reviewed-on: https://gerrit.instructure.com/34548
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2014-05-13 14:26:23 -06:00
Cody Cutrer c6090faa0a allow enrolling users via sis from another root account
fixes CNVS-12963

test plan:
 * set up a trust from account A to account B
 * enable sis imports for account A and account B
 * add a user to account B with an SIS ID
 * add a course to account A with an SIS ID
 * do an sis import to account A for enrollments as user
   that is an admin in both account A and account B;
   specify the course from account A as the target,
   the user from account B, and add another column
   root_account with account B's domain
 * it should succeed, and enroll the user from account B
 * unenroll the user manually
 * do the import as a user that's an admin in account A,
   but not account B - it should fail citing permissions
 * remove the trust link from A to B
 * do the import as the user that's an admin in both;
   it should fail citing no usable login

Change-Id: Ie5b7b71bfe563da9c49d3aa2321586994634ccb5
Reviewed-on: https://gerrit.instructure.com/32133
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2014-05-13 17:19:48 +00:00
Nick Cloward 5d4dda1c68 add option for course state changes (log auditing)
fixes: CNVS-347

Adds state change logging activity for courses.  This change also adds an event
source field to all the course activity events.  The options for this is api,
manual, and sis.

Note: This also adds a fix for the event stream record object to force request_id to
be a string.  Event stream will try to insert an integer into a text column which
Cassandra will complain about and throw an error.

Test Plan:
  - Test for each type of Event:
    * Concluded
    * Unconcluded
    * Published
    * Deleted
    * Restored
    * Updated
    * Created
    * Copied To
    * Copied From

  - Test each type of event and each source.  Note that some events can only
    have certain sources.  Also make sure SIS migrations show that the source
    is type SIS.

Change-Id: Ic2308e1d10e6fc1cc6437221d7842eaf1a596f46
Reviewed-on: https://gerrit.instructure.com/30343
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: James Williams  <jamesw@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2014-05-09 16:09:20 +00:00
Andrew Leung ab78550748 Add full & sortable name fields to SIS User Import
Both fields are optional. If absent, the user's name and sortable_name
will be set in the same manner as before.

The full_name field takes precedence over first_name and last_name. The
sortable_name field takes precedence over the inferred value.
2014-05-02 14:09:26 -07:00
Andrew Leung d495a3223b Rearrange add_user args to maintain compatibility 2014-04-25 14:23:45 -07:00
Andrew Leung 1b6e4a6ba3 Remove error for setting short_name w/o first+last names 2014-04-24 14:02:31 -07:00
Andrew Leung ba3a347533 Add display name field to SIS User Import
The display name (short_name) field is optional. If absent, short_name
will behave as before. If present, it will explicitly set short_name to
the given value, unless it's a stuck SIS field of course.

Previously, if first and last names were not given, the user's name will
be a single space. The behavior is the same now, except when short_name
is present. In that case, an error will be thrown.
2014-04-22 11:50:18 -07:00
Nick Cloward 10aa2d8131 add the current user to sis imports
fixes: CNVS-11546

Adds a user relation to sis batches so we can relate a sis batch job back to the
user who initiated it.

Test Plan:
  - Initiate SIS Imports.
  - The associated sis batch records user_id column should have the correct value.

  * SIS Imports should not be broken.

Change-Id: Ic5d0807af4d945a150a0268776e51c6db96b29c6
Reviewed-on: https://gerrit.instructure.com/31172
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nick Cloward <ncloward@instructure.com>
2014-03-25 21:38:37 +00:00
Rob Orton bf630b91a6 fix user sis imports on mysql
refs CNVS-11680

test plan
 - on mysql run user import
 - should not fail

Change-Id: I3c6ccc99aae493ba87fc5c2ebaf8e789dfca0338
Reviewed-on: https://gerrit.instructure.com/31543
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-03-08 01:00:29 +00:00
Rob Orton d11df046c3 compare login id using the db on sis user import
fixes CNVS-11680

test plan
 - import user.csv with a different case than
   existing user's unique_id
 - no import warning errors should be shown

Change-Id: I64a3a84f6874ec88c4f28bc046f80cad9219fc43
Reviewed-on: https://gerrit.instructure.com/31453
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Eric Adams <eadams@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
2014-03-07 07:02:34 +00:00
Jacob Fugal d023b40217 ActiveSupport::Callbacks::Suspension
refs CNVS-9522

replace our hokey ActiveRecord::Base.suspend_callbacks implementation
with something that integrates nicely with ActiveSupport::Callbacks in
general, as a gem.

include it into ActiveRecord::Base and use it to implement
save_without_callbacks for rails3 (rails2 still needs to do it the way
we had it before, because the notifications callback isn't handled
through ActiveSupport::Callbacks).

test-plan:
 - make sure ActiveRecord callbacks still run in most cases (e.g. after
   creating a course through the UI, it should have a value in the uuid
   column in the database)
 - make sure callbacks don't run while suspended (e.g. have a user
   enrolled in two courses. call user.delete_enrollments. both
   enrollments should be deleted, but only one delayed job for due date
   caching should be created)

Change-Id: Iecd1cc0346e218261677d16ee44bae9cb9149ddd
Reviewed-on: https://gerrit.instructure.com/29809
Reviewed-by: Anthus Williams <awilliams@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
2014-02-19 20:20:00 +00:00
Eric Adams 72fb2879dc do not show warnings when unique_id different case for same user
fixes SIS-162

TestPlan
----------
  - import user.csv with a different case than existing user' unique_id
  - no import warning errors should be shown

Change-Id: I653bcc7c2ace9953fe74ada0c0ab7da32c65662c
Reviewed-on: https://gerrit.instructure.com/30151
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Duane Johnson <duane@instructure.com>
Product-Review: Duane Johnson <duane@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Reviewed-by: Eric Adams <eadams@instructure.com>
2014-02-18 21:10:46 +00:00
Cody Cutrer a389fd18c1 rails 3 doesn't auto-require csv, so require it where necessary
Change-Id: Id76980c82024a082855f5b7b5b60cd7e760730a9
Reviewed-on: https://gerrit.instructure.com/30132
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Derek DeVries <ddevries@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
2014-02-14 16:04:34 +00:00
Jacob Fugal a2c3dc44fc rename skip_callback->suspend_callbacks
refs CNVS-9522

in rails3 ActiveRecord::Base.skip_callback is a real thing that doesn't
do what this does. because of load order, ours happens, but it would be
nice to leave the other available.

to simplify the switch, both suspend_callback and suspend_callbacks are
kept as renames, but suspend_callback should not be used, preferring
suspend_callbacks. suspend_callback will go away in the near future.

skip_callback is temporarily added back in as an alias to
suspend_callback to allow time for fixing a plugin that uses
skip_callback. it will be removed as soon as that plugin is updated.

Change-Id: Iaefd16dde3b6ce575780cb8f721dc826258eef4e
Reviewed-on: https://gerrit.instructure.com/29808
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Nick Cloward <ncloward@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
2014-02-11 23:14:41 +00:00
Anthus Williams 40c5c1f5f7 fix for rails3 refactoring of TestUploadedFile
in rails 3, ActionController::TestUploadedFile has
been moved to Rack::Test::UploadedFile. This commit
simply updates uses of TestUploadedFile to work
with this new structure

Change-Id: Ib31159c635f033a13908608dffeea88c8f719086
Reviewed-on: https://gerrit.instructure.com/28234
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Anthus Williams <awilliams@instructure.com>
QA-Review: Anthus Williams <awilliams@instructure.com>
2014-01-17 17:53:18 +00:00
Duane Johnson db12e5e7b1 Add integration_id to CSV import
Test Plan:
- Import a CSV with integration_id column in any
  of: account, course, section, term, user
- The integration_id should be available in the
  console for objects imported in this way (e.g.
  user = User.find(123); user.integration_id)

Fixes SIS-108

Change-Id: Ie7f0765c2ec7222d8c7ba7dfbf78c858812e62d3
Reviewed-on: https://gerrit.instructure.com/27672
Tested-by: Jenkins <jenkins@instructure.com>
Tested-by: Ken Romney <kromney@instructure.com>
Reviewed-by: Ken Romney <kromney@instructure.com>
QA-Review: Ken Romney <kromney@instructure.com>
Product-Review: Ken Romney <kromney@instructure.com>
2013-12-27 16:06:13 +00:00
Jeremy Stanley 1e29a97ee0 rubyzip 1.0.0 upgrade
test plan: zip functionality should continue to work, including:
 * course exports and imports
 * zip file uploads
 * zip submissions

also, the selenium dependency on rubyzip 1.0.0 is resolved
and we're making progress toward > 4GB exports

Change-Id: I58c5b0644b1e7fbb289821c9c0901f00750988de
Reviewed-on: https://gerrit.instructure.com/25474
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
Product-Review: Bryan Madsen <bryan@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
2013-11-22 19:23:34 +00:00
Jeremy Stanley 5773e05c3c avoid excessive update-cached-due-date callbacks
deleting a user could cause thousands of update-cached-due-dates
jobs to be enqueued (one per assignment per enrollment; in the
referenced ticket, the test student had 13 enrollments and there
were 88 assignments, yielding 1,144 jobs, causing the request
to time out).

fix this by
 (1) using a batch job to update all assignments in the course,
     instead of a job per assignment
 (2) when deleting a user with multiple enrollments in a course,
     only run the update cached due date job once per course

test plan:
 0. run in "production" configuration (i.e., in QA portal)
 1. have a course with 10 sections and 100 assignments.
    I suggest creating these in the console, e.g.

    course = course.create! name: "CNVS-8068"
    10.times { |x| course.course_sections.create! name: "section #{x}" }
    100.times { |x| course.assignments.create! name: "assignment #{x}" }

 2. enter student view mode in this course
 3. reset the student view student
 4. verify 1000 jobs were not created (and the request doesn't time out)

fixes CNVS-8068

Change-Id: If00dd3197b70df42b0f9ec18303b02594861f69f
Reviewed-on: https://gerrit.instructure.com/25160
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Matt Fairbourn <mfairbourn@instructure.com>
Product-Review: Bracken Mosbacker <bracken@instructure.com>
2013-10-16 21:04:03 +00:00
Cody Cutrer d3f0b18684 validate nullness in the db on a bunch of columns
fixes CNVS-7414

Change-Id: I60978f66d88d916dc5736dbb975715172bd1e14b
Reviewed-on: https://gerrit.instructure.com/23141
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>
2013-09-12 22:20:39 +00:00
Cody Cutrer b8470a85e8 batch up due date cachers during sis imports
fixes CNVS-8071

test plan:
 * create a course and a section with an SIS ID
 * create a an assignment, and override it's date for that section
 * enroll two users via SIS into the course; one with no section
   (i.e. the default section), and one into the section with the override
 * confirm that the users show appropriate due dates for the assignment

Change-Id: I0e2b64d1d7095d370ba981b3b0f3ec4d1742f15b
Reviewed-on: https://gerrit.instructure.com/24254
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-09-12 20:08:32 +00:00
Cody Cutrer a4bf708d33 batch up some massive updates at end of SIS import
fixes CNVS-7981

test plan:
 * run some SIS imports
 * they should succeed

Change-Id: Ia81981b04b3454d115ae607e9babed4c2548a906
Reviewed-on: https://gerrit.instructure.com/24092
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>
2013-09-10 17:35:52 +00:00
Cody Cutrer ca90299806 fix uniqueness validation of login ids
fixes CNVS-7266

test plan:
 * create an SIS user with a login id, then delete them
 * create a non-SIS user with the same login id
 * use an SIS import to resurrect the original user
 * the SIS import should succeed, but warn that it skipped the user
   cause someone else had his login information

Change-Id: I2102107fefb1d20fae6046ebe3a7e0c03416dcc9
Reviewed-on: https://gerrit.instructure.com/22867
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-08-01 20:32:14 +00:00
Brian Palmer 31f33164b5 remove 1.8 compatibility shims
- update the Gemfile to be 1.9 only, and raise an exception on wrong
  ruby version
- remove RUBY_VERSION checks, replacing with the applicable code
- remove the FasterCSV compatibility shim, just use CSV now

test plan: trying to bundle install on ruby 1.8 or 2.0 should raise an
exception, specs should pass, canvas should work as normal on 1.9

Change-Id: I49088e9d227c59c6d5d5acb417c2df971129474a
Reviewed-on: https://gerrit.instructure.com/19806
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2013-05-03 01:43:52 +00:00
Brian Palmer 666ecf77d3 rename SIS::CSV::BaseImporter to SIS::CSV::CSVBaseImporter
There is also a SIS::BaseImporter in the outer module/namespace, which
makes having the same class name in a nested module really error prone.

Change-Id: Ia61f87088748212f855577570a28871c06fe87d9
Reviewed-on: https://gerrit.instructure.com/19292
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Duane Johnson <duane@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2013-04-03 22:30:57 +00:00
Brian Palmer 35e19040ba remove unnecessary lib/sis requires
We were inconsistent about whether to require
'lib/sis/csv/base_importer' or 'sis/csv/base_importer', causing warnings
in the logs about already initialized constants (not to mention
evaluating the same file twice, though that seems to be ok in this
case).

rather than fix the requires to be consistent, i've just removed them,
as rails autoloading works for all but the sis/common require (doesn't
work for sis/common because that defines things other than a SIS::Common
module)

test plan: doing SIS imports should still work as normal, and you
shouldn't see any warnings in the logs about already defined constant
PARSE_ARGS

Change-Id: I787ee7486d967201bfb360bc95e61e48b385c449
Reviewed-on: https://gerrit.instructure.com/19190
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Product-Review: Brian Palmer <brianp@instructure.com>
2013-04-02 15:58:29 +00:00
Cody Cutrer 5ffbcbeb05 arel-ify lib
excluding api_find, which needs more work

refs CNVS-4706

Change-Id: I013d0660ff2b8dbe2abf6a5c973bd1203f432f99
Reviewed-on: https://gerrit.instructure.com/18921
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2013-04-01 19:12:22 +00:00
Duane Johnson 1d97ac0fc7 don't check section homogeneity on group membership update
When a GroupMembership is updated, don't check to make sure the user's
group is within the section, as this could impact SIS imports. We
only care about validating homogeneity when creating a new
GroupMembership.

Test Plan:
  - create a batch import in which a user is enrolled in a class,
    and is also in a group within that enrollment
  - add something else to the batch (to test that the rest of the
    batch is imported even when the error, below, occurs)
  - import the batch
  - mark the enrollment as deleted
  - re-import the batch
  - rather than failing to import the batch, there should be an
    error message indicating the group user had a validation error

fixes CNVS-4225

Change-Id: I2a20756d0464d833ce66e94a4d6c847bfb894f14
Reviewed-on: https://gerrit.instructure.com/18455
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-03-14 16:45:09 -06:00
Duane Johnson 0f3c5bed6b raise ImportError for invalid sis import data
When unhandled ActiveRecord validation errors occur during SIS import
for a single record, it can prevent an entire batch from importing.
This change catches validation errors in Enrollment and
GroupMembership objects and re-raises them as ImportErrors so that
batch imports can continue.

Test Plan:
  - create a batch import in which a user is enrolled in a class,
    and is also in a group within that enrollment
  - add something else to the batch (to test that the rest of the
    batch is imported even when the error, below, occurs)
  - import the batch
  - mark the enrollment as deleted
  - re-import the batch
  - rather than failing to import the batch, there should be an
    error message indicating the group user had a validation error

fixes CNVS-4226

Change-Id: I87078bd263f2b2487c5a8d41ff41c0ff71cbed95
Reviewed-on: https://gerrit.instructure.com/18271
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-03-07 15:51:08 -07:00
Cody Cutrer db0bf46471 clean up course account associations
closes CNVS-3417

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

Change-Id: I261cad633788efbf4b0c64db34436ef695856fee
Reviewed-on: https://gerrit.instructure.com/17256
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2013-02-08 16:33:25 -07:00
Cody Cutrer 423afe8571 truncate enrollments.sis_source_id when importing
fixes CNVS-3199

test plan:
 * have a section with a name ~250 characters long
 * enroll a user in that section via sis
 * it should not fail

Change-Id: I83a4537653a61ad0fd0bb9448a5f212fad90e35d
Reviewed-on: https://gerrit.instructure.com/17090
Tested-by: Jenkins <jenkins@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
Reviewed-by: Duane Johnson <duane@instructure.com>
2013-01-25 10:18:25 -07:00
Ethan Vizitei c6c34f11dc prevent bad sis_user_id queries
fixes #CNVS-2172

found every place I could in the codebase
that passed some kind of input into a finder
that looked up a pseudonym with an sis_user_id.
Then wrote specs to pass in integers (which in 
all cases turned up the error described
in the ticket), and 
made sure to do explicit casts on the inputs
until the specs didn't break anymore.

TEST PLAN (unsure of how to trigger from UI):

1) Take a pseudonym that already exists and has
an sis_user_id that could be an integer (is
made up of all numeric characters).

2) In the console, try to create a new 
pseudonym with the same sis_user_id, but use
an integer instead of a string.

3) you SHOULD NOT get a postgres error
telling you that you need to do an
explicit type cast

4) you SHOULD get a validation error telling
you that 2 pseudonyms cannot have the same
sis_user_id.

Change-Id: Ic69da6a40609a50234a5388af02dd1fbeb021214
Reviewed-on: https://gerrit.instructure.com/16925
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Clare Hetherington <clare@instructure.com>
2013-01-22 14:59:43 -07:00
Jeremy Stanley 61506b602c include role name in sis import prior enrollment search
fixes #CNVS-2516

test plan:
 - create two custom roles based on the same type
 - with a SIS import, try to enroll a user in a course with
   both roles (i.e., two rows in enrollments.csv)
 - make sure both enrollments are created

Change-Id: I09cef8a5dfbcac6e3d7fd5bd6dadbb1cebcab384
Reviewed-on: https://gerrit.instructure.com/16499
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
2013-01-07 09:09:12 -07:00
Jeremy Stanley b87eeb0149 course role support in sis import/export
closes #CNVS-1078
test plan:
 - create custom roles in an account
 - sis import:
   - put the custom role name in the 'role' column in a SIS
     enrollment import, and ensure the role_name is assigned
     in the Enrollment
   - ensure only valid roles can be assigned this way
     (must be defined in the course's account or parent
      account, and must not be inactive)
  - sis export:
   - ensure custom role names are exported in the 'role' column
     of the SIS enrollment export and provisioning reports

Change-Id: Ib8b4c129d451023fa51c73747baadd42cb305338
Reviewed-on: https://gerrit.instructure.com/15868
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Adam Phillipps <adam@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-12-10 08:41:20 -07:00
Brian Palmer eaa27eeb92 touch the user if only the sis communication channel changed
refs #11188

test plan: sis import a user with an email. then do another sis import
that only changes the user's email. the change should show up
immediately in the ui and in sis csv export reports.

Change-Id: I14efdf052ea7d2688ef07fff6ce25f76c6deb034
Reviewed-on: https://gerrit.instructure.com/15479
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-11-19 08:25:07 -07:00
Brian Palmer 61dc5b689c don't assign a random term with no sis id if none is given in sis import
it was doing a find_by_sis_source_id(nil)

also, don't find deleted terms

fixes #11465

test plan: create an enrollment term in the UI, separate from the
default term, with no sis id. do a course sis import and don't specify a
term, it should get assigned to the default term not the one you
created.

Change-Id: I4ff8e9df35b7f29237840314f118fe249d699838
Reviewed-on: https://gerrit.instructure.com/14738
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2012-10-26 14:34:36 -06:00
Bracken Mosbacker b6748eb1ed correctly conclude observer enrollment
if an SIS update tried to conclude an observer of a student
who was already concluded, that observer enrollment ended up
duplicated with one concluded enrollment and one active.

Test Plan:
 * Create a student with an observer
 * In an sis update conclude the enrollments with the student's row first
   (you can look at the example in the added spec)
 * Both users should be concluded and only have one enrollment

closes #11050

Change-Id: Iaf63f005397f7b93403e0fd032335bf0a1f364d2
Reviewed-on: https://gerrit.instructure.com/14094
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-10-02 13:25:37 -06:00
Cameron Matheson b5f566f1f6 crocodoc integration
Adds support for optionally viewing documents with Crocodoc.

closes #9865

Test plan:
  * configure the crocodoc plugin
  * add an assignment that allows file uploads
  * make a submission for that assignment with a pdf or doc or ppt
    - on the 'submission details' page, opening a preview of the
      assignment should display it in crocodoc
    - speedgrader should display the submission in crocodoc too
  * make a submission with odt or rtf
    - the submission should be displayed with scribd or google docs
  * if you disable the crocodoc plugin, submissions could continue being
    previewed in google docs or scribd

Change-Id: I7dd2547f8e2d907c98ebe894a7f1ee9d58f1e030
Reviewed-on: https://gerrit.instructure.com/13668
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2012-09-21 12:57:02 -06:00
Jeremy Stanley 3fe0ef63bc clear associated_enrollment between rows; fixes #10652
test plan:
 * create a SIS import that enrolls a student after an observer
 * the student's enrollment should not have an associated user ID

Change-Id: I6b05e1c7cc4a634a77795b5d8ddc7ba269810479
Reviewed-on: https://gerrit.instructure.com/13776
Reviewed-by: Jacob Fugal <jacob@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-09-18 11:57:13 -06:00
Cody Cutrer c41434c73c optimize GradePublishingResultsImporter
do it all in a single update query - avoids extraneous touches as well
as several queries to load data that can be checked in the update

test plan:
 * run grade publishing specs
 * publish grades with async option
 * import the results

Change-Id: I95a67cd1c4d7459cb0f28033421328da6de7113a
Reviewed-on: https://gerrit.instructure.com/12992
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-08-17 12:36:14 -06:00
Cody Cutrer 0f823a6701 validate that account chain loops aren't created
fixes #9768

test plan:
 * create two accounts via SIS that reference each other (you'll need
   to add the first account two times, once valid, the second changing
   its parent to the other account)
 * one of the accounts should cause a warning about a loop

Change-Id: Ieb1710a1d0b7d11c652d8e000dcf33b63d2b187f
Reviewed-on: https://gerrit.instructure.com/12749
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-08-07 09:05:01 -06:00
Cody Cutrer f5a225f6da reset counts for parallel sis import in case it's manually restarted
test plan:
 * configure parallel sis imports
 * start a massive import
 * kill the job
 * in script/console, reset the batch's workflow_state to 'created',
   and call process on it
 * when it completes, the counts should be accurate, and not
   doubly include what was processed the first time before it was
   killed

Change-Id: Ib49a5b56fa9db88908ab386aa869614972ae66eb
Reviewed-on: https://gerrit.instructure.com/12420
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-07-26 11:00:02 -06:00
Cody Cutrer 927d84ed48 don't include the queue at all if defaulting it for parallel SIS imports
test plan:
 * enable parallel SIS imports in plugin settings
 * do an SIS import that will parallelize
 * it should not hang because the jobs don't run

Change-Id: Ib3c32c2ee2378946b7a79c8df2f404dd94eb957c
Reviewed-on: https://gerrit.instructure.com/12242
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2012-07-13 16:34:19 -06:00
Cody Cutrer 9573ce76d6 search for xlisted sections when enrolling via CSV fixes #9175
test plan:
 * create two courses via SIS CSV
 * enroll a user in course 1 via SIS CSV by course_id only
 * xlist course 1's default section to course 2
 * enroll another user in course 1 via SIS CSV by course_id only again
 * the user should end up in the xlisted section in course 2

Change-Id: I3a114d70a109594a56915b705de77b87a177e966
Reviewed-on: https://gerrit.instructure.com/12122
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-07-11 08:59:07 -06:00
Cody Cutrer ca2947cad3 fix case sensitivity in sis headers
test plan:
 * import a csv file with all-caps headers
 * it should still work

Change-Id: Ifeac18095e742e974f3709915d6d21f8c5d2d11a
Reviewed-on: https://gerrit.instructure.com/11206
Reviewed-by: Simon Williams <simon@instructure.com>
Tested-by: Cody Cutrer <cody@instructure.com>
2012-06-01 11:07:41 -06:00
Cody Cutrer 393ba3a317 make courses#workflow_state sis sticky fixes #8258
test plan:
 * import a course via SIS
 * publish and conclude the course via the UI
 * re-import the course via SIS (still 'active') status
 * the course should stay concluded

Change-Id: Ieba993d1aac65a3e0872edec5deda2731f70e165
Reviewed-on: https://gerrit.instructure.com/10422
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-05-10 14:00:38 -06:00
Cody Cutrer 8beb4e0fd4 only perform batch sis removal for the types of data that were supplied
fixes #8310

test plan:
 * load some sis data for terms/courses/sections/enrollments into an
   account
 * do a batch mode import of an enrollments.csv with just the headers,
   no data
 * all enrollments should be deleted, but courses and sections should
   be left alone

Change-Id: I05beb577bfb4573e97f8b398aeb4bfff5df78a4f
Reviewed-on: https://gerrit.instructure.com/10265
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-05-08 09:46:49 -06:00
Cody Cutrer af39561e13 fix sis import of email addresses that match active and retired addresses
fixes #8402

test plan:
 * create a user via SIS with no e-mail
 * add an e-mail address and remove it from the user's profile
 * add the same e-mail address, and confirm it this time
 * re-import the user via SIS, with the e-mail address this time,
   but differing in case
 * it should succeed, and the e-mail address should be update to
   the new case

Change-Id: Id54f413bdf6b3c066530c53715141c7507d18f9b
Reviewed-on: https://gerrit.instructure.com/10552
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-05-04 16:14:36 -06:00
Cody Cutrer f158c5e9fd fix catching malformed csvs beyond the first few rows
test plan:
 * upload a mostly valid sis csv with lots of rows, and one bad quote
   way down
 * you should get a (somewhat) helpful "Malformed CSV" error, rather
   than an entirely unhelpful "Error while importing CSV. Please contact
   support."

Change-Id: I58c87c9e9078db53b1e18ab988d841b89b091ea7
Reviewed-on: https://gerrit.instructure.com/9946
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-04-16 13:41:03 -06:00
Cody Cutrer 503e0eb7ec don't send merge notifications to same-account sis users
fixes #7159

test plan:
 * import two users with the same e-mail into the same account
 * the user should not get a merge notification e-mail

Change-Id: Ic9f3a3948df1e2a877fcd8e79f3d05d86a2d1e5b
Reviewed-on: https://gerrit.instructure.com/8774
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-02-21 09:43:22 -07:00
Bracken Mosbacker faaa2072af change how group sis csvs are detected
The group SIS CSV was being detected by an optional setting
so this makes it check on only required headers.
It also adds counts to the "report" shown on the sis page.

Test Plan:
 * Import groups without the account_id header
 * It should be successful and show the count in the UI

closes #5730

Change-Id: I9b8cc27be82499fbb7b8778eacab183fb77a5126
Reviewed-on: https://gerrit.instructure.com/8828
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-02-20 15:50:22 -07:00
Cody Cutrer 6a5f7f6878 temporary and deleted users have no account associations
fixes #7147

test plan:
 * enable open registration
 * invite a new user to a course
 * that user should not show up in the account's user list
 * finish registering the user
 * the user should now show up in the account's user list

Change-Id: I60790c213671a7c16a52082602725a2468ad2dc4
Reviewed-on: https://gerrit.instructure.com/8502
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-02-08 14:37:17 -07:00
Cody Cutrer 8c68fec61a fix sis imported multiple enrollment types and multiple observers in same section
fixes #7117

test plan:
 * import a user as a student and a teacher in the same course
 * import two students, and one observer that is associated with both students

Change-Id: Iab49f6884f84a2e947edb5d5380f8d31b23c5afc
Reviewed-on: https://gerrit.instructure.com/8427
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-02-08 13:06:10 -07:00
Cody Cutrer b6300298d2 don't duplicate enrollments on sis import if all enrollments are deleted
test plan:
 * import the same deleted enrollment several times; only one should be
   in the db

Change-Id: If067578fc1b42e501e4c43243f9745654b633701
Reviewed-on: https://gerrit.instructure.com/8417
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-01-31 22:28:59 -07:00
Cody Cutrer bf80ea4eb9 handle MalformedCSV errors gracefully fixes #6814
run the file completely through the parser before giving it to the
importers, and fail-fast with a useful error message

test plan:
 * import an SIS file with mismatched quotes
 * you should get a warning about malformed CSV, not a reference
   to "Error while importing CSV. Please contact support."

Change-Id: If785910e76bce6fcc2efe5507febcbfc14727a05
Reviewed-on: https://gerrit.instructure.com/8095
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
2012-01-17 10:56:52 -07:00
Cody Cutrer f49f2f0ae1 only search active pseudonyms when finding an implicit sis pseudonym
test plan:
 * create a user via the UI
 * add another pseudonym
 * delete the extra pseudonym
 * import a new user via SIS import with the login of the pseudonym
   you deleted
 * it should create a separate user for the SIS user, instead of
   resurrected the deleted pseudonym onto the original user

Change-Id: Ia1ff1490bae82fc4daef3f91b05293d7c79cc50b
Reviewed-on: https://gerrit.instructure.com/7975
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2012-01-12 12:38:00 -07:00
Cody Cutrer f491308163 drop unused user.creation_* columns
test plan: run the migration

Change-Id: I75184edd64ddee384de485c443d4c7eee45cc26f
Reviewed-on: https://gerrit.instructure.com/7895
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2012-01-10 10:49:49 -07:00
Cody Cutrer cc9ce1dd02 validate UTF-8 in SIS CSVs fixes #6780
test plan:
 * create a csv file with invalid UTF-8
 * import it
 * you should get an immediate error, without processing any records

Change-Id: Ife6c851d798613c161449dc8f6233dfadd67be4e
Reviewed-on: https://gerrit.instructure.com/7885
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-01-06 13:01:09 -07:00
Cody Cutrer b9fee70ee6 use Pseudonym.custom_find_by_unique_id instead of find_by_unique_id
so that it's case insensitive

also fix some latent CommunicationChannel.find_or_initialize_by_path
discovered by specs for this

test plan:
 * run the specs
 * use forgot password with a username that differs in case
 * self-register a new user multiple times (without confirming)
   with e-mail addresses that differ in case

Change-Id: I476325f591c997fc8d50d5f38480177f732f07a7
Reviewed-on: https://gerrit.instructure.com/7724
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2012-01-04 15:58:40 -07:00
Cody Cutrer f13e7ea2fa fix sis communication channels inadvertently switching users fixes #6707
test plan:
 * import a user via SIS
 * do another SIS import that lists the same user, and a new user
 * the e-mail addresses for each user should be correct

Change-Id: I0a95804056e38bdfd36f24c0c78187d601940451
Reviewed-on: https://gerrit.instructure.com/7833
Reviewed-by: Zach Wily <zach@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2012-01-03 17:05:30 -07:00
Cody Cutrer 2b2f49d66f search for communication channels case insensitively fixes #6750
test plan:
 * create a user via SIS import with an e-mail address
 * add a different e-mail address to the user
 * re-import the user via SIS, and set their e-mail address
   to the second e-mail you added, but with a different case
 * the user should have a single e-mail address, the one set
   in the second SIS import

Change-Id: Iab6b16e0b37cfb8caac3faa453be570b99621a9e
Reviewed-on: https://gerrit.instructure.com/7784
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Reviewed-by: Zach Pendleton <zachp@instructure.com>
2011-12-30 19:36:29 -07:00
JT Olds 464950050a make sure sis import libraries depend on the right files
most specs load the files in the right order anyway, but the
nightly plugins build was getting the wrong order and breaking.
this calls out the dependency correctly

testplan: n/a

Change-Id: Ie543492a3c02cb587e578cbc2b12badb663acd63
Reviewed-on: https://gerrit.instructure.com/6999
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bryan Madsen <bryan@instructure.com>
2011-11-15 16:00:53 -07:00
Cody Cutrer f259d610bd don't send merge notifications to users that can't login
refs #5833

Change-Id: Ibf9ca8188510ba0aa5e722dc2f64d87293686c4f
Reviewed-on: https://gerrit.instructure.com/6597
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-11-01 09:36:09 -06:00
Cody Cutrer 3f3f72637a expose sortable name to user, fixes #5317
* expose sortable name directly to the user
 * don't downcase it
 * use a LOWER(sortable_name) index for postgres
 * set sortable name as "last_name, first_name" explicitly for SIS imports
 * populate sortable name intelligently in the UI

Change-Id: I476641f4817e27a11b573d91f102c5a74d3eba26
Reviewed-on: https://gerrit.instructure.com/6512
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Reviewed-by: Ryan Florence <ryanf@instructure.com>
2011-10-31 12:22:08 -06:00
JT Olds 6403cdf705 don't actually delete users, just pseudonyms. fixes #6117
Change-Id: I560a9de442b75c07eca204ad63be5f3c76f1d5bc
Reviewed-on: https://gerrit.instructure.com/6564
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-10-31 11:48:18 -06:00
Cody Cutrer f99abb4e56 Revert "add distinct name part fields refs #5317"
This reverts commit 995110f555.

Change-Id: Ic00e7ced20ca9d912587e3440862ceb50e601d15
Reviewed-on: https://gerrit.instructure.com/6511
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-10-27 10:17:29 -06:00
Cody Cutrer c59c0f593f refactor user creation/invitations closes #5833
fixes #5573, #5572, #5753

 * communication channels are now only unique within a single user
 * UserList changes
   * Always resolve pseudonym#unique_ids
   * Support looking up by SMS CCs
   * Option to either require e-mails match an existing CC,
     or e-mails that don't match a Pseudonym will always be
     returned unattached (relying on better merging behavior
     to not have a gazillion accounts created)
   * Method to return users, creating new ones (*without* a
     Pseudonym) if necessary. (can't create with a pseudonym,
     since Pseudonym#unique_id is still unique, I can't have
     multiple outstanding users with the same unique_id)
 * EnrollmentsFromUserList is mostly gutted, now using UserList's
   functionality directy.
 * Use UserList for adding account admins, removing the now
   unused Account#add_admin => User#find_by_email/User#assert_by_email
   codepath
 * Update UsersController#create to not worry about duplicate
   communication channels
 * Remove AccountsController#add_user, and just use
   UsersController#create
 * Change SIS::UserImporter to send out a merge opportunity
   e-mail if a conflicting CC is found (but still create the CC)
 * In /profile, don't worry about conflicting CCs (the CC confirmation
   process will now allow merging)
   * Remove CommunicationChannelsController#try_merge and #merge
 * For the non-simple case of CoursesController#enrollment_invitation
   redirect to /register (CommunicationsChannelController#confirm)
   * Remove CoursesController#transfer_enrollment
 * Move PseudonymsController#registration_confirmation to
   CommunicationChannelsController#confirm (have to be able to
   register an account without a Pseudonym yet)
   * Fold the old direct confirm functionality in, if there are
     no available merge opportunities
   * Allow merging the new account with the currently logged in user
   * Allow changing the Pseudonym#unique_id when registering a new
     account (since there might be conflicts)
   * Display a list of merge opportunities based on conflicting
     communication channels
     * Provide link(s) to log in as the other user,
       redirecting back to the registration page after login is
       complete (to complete the merge as the current user)
   * Remove several assert_* methods that are no longer needed
 * Update PseudonymSessionsController a bit to deal with the new
   way of dealing with conflicting CCs (especially CCs from LDAP),
   and to redirect back to the registration/confirmation page when
   attempting to do a merge
 * Expose the open_registration setting; use it to control if
   inviting users to a course is able to create new users

Change-Id: If2f38818a71af656854d3bf8431ddbf5dcb84691
Reviewed-on: https://gerrit.instructure.com/6149
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2011-10-24 12:07:08 -06:00
Cody Cutrer 995110f555 add distinct name part fields refs #5317
Change-Id: I0d11c51d4e0e9be093b65cca2ea85ba18e99bce9
Reviewed-on: https://gerrit.instructure.com/6314
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
2011-10-24 12:06:59 -06:00
JT Olds 9d4a4944b6 allow sis imports to make things sticky or clear stickiness altogether
* adds ui

Change-Id: Id8f3639457879d23125c0fb04ef5038d91826f21
Reviewed-on: https://gerrit.instructure.com/6050
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2011-10-13 10:54:58 -06:00
Cody Cutrer d2a5328993 drop Pseudonym#sis_source_id closes #5897
Change-Id: I81f2df5324ae7f9747f5d72ac1f8686932c815ff
Reviewed-on: https://gerrit.instructure.com/6093
Reviewed-by: JT Olds <jt@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-10-12 12:18:37 -06:00
Brian Palmer 1fe1b1ad6b csv lib compat in ruby 1.9.x
fastercsv is not supported in 1.9, instead csv in the stdlib has been
modified to be api compatible with fastercsv. in this first step, we
alias CSV to FasterCSV when running under 1.9. This allows 1.8.7 to
continue working with no changes.

Change-Id: I34c3a9031b6f4946380510e4833203e29a05073a
Reviewed-on: https://gerrit.instructure.com/5835
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-10-12 09:36:18 -06:00
Cody Cutrer 133f2a156a make Pseudonym#unique_id sis sticky refs #5897
Change-Id: If969d8bfd8844a2dcd5263a11c9bc06dcaa47c55
Reviewed-on: https://gerrit.instructure.com/6092
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-10-11 10:16:06 -06:00
JT Olds cb5d048c77 store grade publishing messages
Change-Id: Icfb13244dd46cdeb54b07ef4426d3ba14825b591
Reviewed-on: https://gerrit.instructure.com/5939
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-09-30 13:46:59 -06:00
JT Olds 858b33549f make course terms sticky
refs #5407

Change-Id: I3b8fc96198e6dd583619b078294874dc7cfba19c
Reviewed-on: https://gerrit.instructure.com/5878
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-09-30 11:00:27 -06:00
JT Olds 8ac681f201 adding start and end date stickiness
Change-Id: Ifd23b2731725619009884ee56f0c8b1964c6a996
Reviewed-on: https://gerrit.instructure.com/5875
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-09-30 11:00:09 -06:00
JT Olds 96312879f5 plumb sis stickiness override option through to the csv importer
refs #5407

Change-Id: I2532160ac519e9618e95043bd9818cf3a18b78db
Reviewed-on: https://gerrit.instructure.com/5874
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-09-30 10:36:06 -06:00
JT Olds ba64a08d4a handle grade result passback when there is either no course or section
Change-Id: I7d20b373e93fc4a9703434a9eab3fc718735df66
Reviewed-on: https://gerrit.instructure.com/5865
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-09-30 10:35:56 -06:00
JT Olds 02e4132107 refactor sticky sis fields
Change-Id: I1cddc633b11b8937f8a3b36c2fa0a00d4d75b513
Reviewed-on: https://gerrit.instructure.com/5745
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-09-27 16:34:37 -06:00
Brian Palmer 3dc8ecc4df don't drop sis rows if transaction timeout is reached
Change-Id: Ib6744eb6410727afbd8b86f55d379d1c126a96db
Reviewed-on: https://gerrit.instructure.com/5830
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-09-26 23:52:30 -06:00
JT Olds 006cde7157 new generic-format importer classes
notable changes:
 * nothing is processed as a sis-import blocking error now. bad imports now
   result in warnings, while just skipping bad data
 * we no longer check for duplicates before going to the database

Change-Id: Iedc96b29d92caccdc6a71ae1de8100a1c82dd137
Reviewed-on: https://gerrit.instructure.com/5724
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-09-26 11:24:58 -06:00
Cody Cutrer 483786ba7e fix the -and-a-half of precalculated account associations importing enrollments
Change-Id: Ia783d496c34ff3000402108c64eca55b811b94de
Reviewed-on: https://gerrit.instructure.com/5721
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-09-20 11:21:30 -06:00
JT Olds 9016452480 handle nil sis_communication_channels appropriately
refs sis batch id 8860, error report 2538380

Change-Id: I6576ee0a38fc163e88746d753ddd3400b54f21c9
Reviewed-on: https://gerrit.instructure.com/5712
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-09-17 15:06:43 -06:00
Cody Cutrer 06fe062709 don't log users out when doing a sis import fixes #5583
Change-Id: I3450f1d7369f7710cf5627597f38ea7e9f5fea0a
Reviewed-on: https://gerrit.instructure.com/5659
Reviewed-by: JT Olds <jt@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-09-14 15:53:09 -06:00
Cody Cutrer 6238c7a044 more gracefully handle pre-existing communication channels for sis imports
Change-Id: I6b2522d299a51576b3ca85e14f9e702de9f30f14
Reviewed-on: https://gerrit.instructure.com/5474
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-09-08 08:40:29 -06:00
Cody Cutrer 191f9d4998 optimize and fix account associations during user sis import
It wasn't handling removing the association on the transition to deleted state.

Change-Id: Ia9f0714b8eba200531b5e2764c1c4f152f8ff8be
Reviewed-on: https://gerrit.instructure.com/5380
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-09-01 15:14:59 -06:00
Cody Cutrer 555d004cfd speed up SIS imports dramatically
Change-Id: Ida224803f82aaddc8cf3d2821d0b222a79a28817
Reviewed-on: https://gerrit.instructure.com/5382
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-09-01 14:50:49 -06:00
Bracken Mosbacker 795d10776f clear whitespace on sis csv imports
Also clear old whitespace that was missed before this fix

closes #5448

Change-Id: I6096685223c43bfec9fd0c669c737af422687e10
Reviewed-on: https://gerrit.instructure.com/5354
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-08-31 18:26:42 -06:00
Cody Cutrer 563af3816f recognize enrollment csvs with only section_id
Change-Id: I913dae88e3517d9a1dbcece39aa033f8e4affa40
Reviewed-on: https://gerrit.instructure.com/5352
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-08-31 10:23:12 -06:00
Jacob Fugal 1a761c2d1f explicit utc db times in update_all
update_all's update hash doesn't have any magic performed on bare Time
objects; it assumes any Time object it's given is already in UTC. using
a TimeWithZone object (regardless of timezone), which Fixnum#ago and
friends happen to return, is still fine.

Change-Id: I297b2a3211b896b5225ebcfaaee3c1eb56e55fb6
Reviewed-on: https://gerrit.instructure.com/5351
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2011-08-30 16:46:25 -06:00
Cody Cutrer 443d925902 add start_date/end_date to enrollment sis imports closes #5408
Change-Id: Ic300cd25ea87210e0cb61d11a433a89bd56dcb3d
Reviewed-on: https://gerrit.instructure.com/5325
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-08-30 15:45:04 -06:00
Cody Cutrer ba786a4508 statelessly enforce enrollment date restrictions fixes #4996
Change-Id: I978c1524518fd17bbffca73071f7b500ca79c435
Reviewed-on: https://gerrit.instructure.com/5166
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-08-23 12:23:22 -06:00
Cody Cutrer de92627373 optimize course, section, and xlist sis imports
optimize crosslisting itself:

 * use ids where possible to avoid unnecessarily loading up objects
 * Don't worry about keeping track of if we need to save; we're gonna
   save anyway
 * update account associations on any account change, not just root
   account change (if you re-crosslist a section from one sub-account
   to another sub-account, the users may no longer be associated with
   the first sub-account).

optimize sis imports:

 * really batch up update_account_associations

Change-Id: Ic0fbe1601afcbcd3e6540e69febc2e6a1a94157f
Reviewed-on: https://gerrit.instructure.com/5137
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-08-19 10:21:56 -06:00
Cody Cutrer 4bb161c9a4 optimize sis enrollment imports
* Attempt to cache the course/section between rows
 * On section change, calculate the new account associations *once*,
   and use the new User#update_account_associations incremental mode
   for strictly new enrollments
 * Keep the account_assocations account_chain cache intact between
   calls
 * Fall back to global update_account_associations if too few
   enrollments in the section, if not a strictly new enrollment, or
   if the user is already going to be globally updated

Change-Id: I884a394aef4f4b81f4472ee3a57f89c1f72ae371
Reviewed-on: https://gerrit.instructure.com/5136
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-08-19 10:21:49 -06:00
JT Olds 41785a0ea2 support importing enrollments that are enrolled to cross-listed courses
if an enrollment belongs to a course/section pair, and then the section is
crosslisted to another course while the enrollment data stays with the
original course/section pair, the next time that enrollment gets imported
canvas shouldn't bail, but should instead pick the new crosslisted course

Change-Id: Ieb93ab19be6ee620fcf39463fc31db82048f3ea8
Reviewed-on: https://gerrit.instructure.com/5125
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-08-17 14:39:31 -06:00
Zach Wily 8d01083315 fix importing active enrollments in courses with date restrictions
Previously we were allowing 'active' to override any term date restrictions.
Now we interpret 'active' to mean 'active excluding any other date-based
restrictions'.

Also fixed a bug that was causing inactive to be treated as active.

Change-Id: Idf435e7b5c129c410f828b6393d7d50fc366fbde
Reviewed-on: https://gerrit.instructure.com/5119
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-08-17 12:26:10 -06:00
JT Olds 12d9fa334b support falling back to a fallback account with course sis imports
Change-Id: I368e59b6abf65ed5adce5d75b0e9b066066ece1f
Reviewed-on: https://gerrit.instructure.com/4974
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-08-05 13:25:10 -06:00
JT Olds c930cfd6db don't bail when an abstract course is not available
fixes #5183

Change-Id: I2425b901bcbc454ec5238694c337cda1b4e1de81
Reviewed-on: https://gerrit.instructure.com/4904
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2011-08-04 10:06:08 -06:00
JT Olds b92427222e allow unchanged passwords to be reset via sis
fixes #5182

Change-Id: I5c7a6705714b3991048b468ad5961875311f1348
Reviewed-on: https://gerrit.instructure.com/4903
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Fugal <jacob@instructure.com>
2011-08-04 10:06:00 -06:00
Brian Palmer b970f4a650 limit sis import transaction time
Change-Id: Ife4425585bf413f8b4c8d26a42dddff2786e7d1e
Reviewed-on: https://gerrit.instructure.com/4847
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-07-29 08:41:55 -06:00
Brian Palmer 85476a42fb fix typos in sis importer causing wrong object ids to update batch id
This was causing "full batch mode" to delete things that it shouldn't.

Fixes #5084

Change-Id: I6e19820ae9daf0b2096fd569451669ad2bb5f52f
Reviewed-on: https://gerrit.instructure.com/4820
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-07-27 09:46:24 -06:00
Brian Palmer 92feb2bcdb replace ActiveRecord::Base calls with subclass calls where it makes sense
This was already a small issue if the job queue was on a different
database driver than the main database, and it'll become more important
as more AR connections are introduced.

Change-Id: I204becadd32bb935df096e8c937a04bb6962f0b2
Reviewed-on: https://gerrit.instructure.com/4601
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-07-18 13:56:08 -06:00
JT Olds eaf2c6390a abstract course importer
Change-Id: Ic96bc376171a8d52bc7f175395eba7687d4dac28
Reviewed-on: https://gerrit.instructure.com/4089
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-06-27 11:01:32 -06:00
JT Olds 5cd6d3b679 make non-sis crosslisting sticky
if a user crosslists via the ui, we don't want the SIS to blow away those
changes. fixes #4840, refs #4815

Change-Id: Ia3f844b3a33d9c9a6e9433dc79ce74e433f1f389
Reviewed-on: https://gerrit.instructure.com/4162
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-06-16 08:42:46 -06:00
JT Olds 4bbeacce99 set enrollment restriction to course/section dates when provided
closes #4832

Change-Id: I204a00863d7c85c1e4c8489d1dc367e99bcffde6
Reviewed-on: https://gerrit.instructure.com/4156
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-06-16 08:42:36 -06:00
JT Olds bc7a9050f1 make sure users and pseudonyms get added together
Change-Id: I912f39f09a6b59daea9ac04f158a0e94279159dc
Reviewed-on: https://gerrit.instructure.com/4183
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-06-14 10:46:54 -06:00
Brian Palmer d17dfcd883 add groups/group_memberships to sis csv import, closes #4247
Change-Id: I49fd646c8f4ce9c5d3fa8f9b1a7ba2e0a6d84e9d
Reviewed-on: https://gerrit.instructure.com/4034
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-06-03 15:17:08 -06:00
JT Olds c63bd9c558 keep crosslisted course data up-to-date via sis imports for original course
Change-Id: Ibfbc5a22c8778bd5188505812f3f5abbdd807578
Reviewed-on: https://gerrit.instructure.com/3652
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
2011-05-31 13:03:05 -06:00
JT Olds 654bf600cf update course account associations on section save
Change-Id: I97f88e43c489691ab5f63a28e4d0695f6c8096b6
Reviewed-on: https://gerrit.instructure.com/3673
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-05-31 13:02:54 -06:00
JT Olds 38f221a2d4 enrollment importer fix
Change-Id: I044c8c659f6bf546c9834bb939a79c58b81ae6e8
Reviewed-on: https://gerrit.instructure.com/3896
Reviewed-by: Cody Cutrer <cody@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-05-26 16:48:25 -06:00
Cody Cutrer b60e645b0d import and support ssha passwords from sis. fixes #4573
Change-Id: I703730644f0094d7cb85d8def322969267de3ce5
Reviewed-on: https://gerrit.instructure.com/3755
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-05-23 08:40:35 -06:00
Cody Cutrer 4299d867ae fixups for distributed sis imports
In particular, @batch.finish is necessary for the "blocked" job to finish.
Also, don't use send_later_if_production, just do it everywhere. By default
it won't get here anyway, so it's okay for tests.

Change-Id: I53bb4276769af481e3787073ddebb7ea5e5a5ed1
Reviewed-on: https://gerrit.instructure.com/3769
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-05-23 08:37:29 -06:00
Cody Cutrer 21f636cb0f use transactions for user and enrollment imports
For "small" imports (<5000 users), this improves wall-clock time
only a bit, but is much much nicer to the db.  The larger the
import, though, the more the improvement here.

Be careful that we only use transactions on things that wouldn't
block other imports running in parallel, or even progress updates
running on the same thread.

Also be smarter about how often we update progress, since that
transaction can have a considerable impact on wall clock time.

refs #3752

Change-Id: I8a79bc530f5433858ccf7d62d33b98ba25e98ffa
Reviewed-on: https://gerrit.instructure.com/3613
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-05-20 10:39:11 -06:00
Cody Cutrer cfedec15da parallelize sis imports
* Controlled by plugin settings; default 1
 * Will re-balance incoming CSVs into at least <parallelism> new CSVs
   (per import type)
   * If there is a single CSV, it will be split optimally
   * If there are multiple CSVs, no such guarantees are made
 * Each CSV will be processed as a separate DelayedJob
 * Accounts are not parallelized
 * All other import types are parallelized within their own type. I.e.
   all courses will be imported before any sections are started

Change-Id: Ifa6fe4e63812be95db999bdf963ab7cc1b15b75d
Reviewed-on: https://gerrit.instructure.com/3582
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-05-20 10:39:02 -06:00
Cody Cutrer 12329cc621 avoid several sub-jobs during sis import refs #3752
* Account#update_account_associations during account import
 * Course#update_account_assocations during xlist and section import
 * Course#update_enrolled_users during xlist import
 * Enrollment#recompute_final_score during xlist and section import

Change-Id: Ic97fe0e7ceeb50dcf89e4569d2571a0626f2114d
Reviewed-on: https://gerrit.instructure.com/3609
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-05-16 15:38:07 -06:00
JT Olds 0af7ccee09 don't reset the account id if the course already has one and one wasn't provided
Change-Id: Ib0c33bd880b597968fd0eda31d29ae64939e299b
Reviewed-on: https://gerrit.instructure.com/3628
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-05-16 14:16:13 -06:00
JT Olds cfae736f5c don't increment successful user counts on failures
Change-Id: I90ea084deeaacb954ebad94e1803460534df92b9
Reviewed-on: https://gerrit.instructure.com/3626
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-05-16 14:15:47 -06:00
JT Olds 08ab2a604c always reset section account on sis import
Change-Id: I91c50b23f8349b878ec3ef6714ee04d399e5c0a5
Reviewed-on: https://gerrit.instructure.com/3671
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-05-16 08:23:32 -06:00
Brian Palmer b657f4e959 generate an error report for all errors, not just some of them
refs #4487

This consolidates our ErrorReport class with our ErrorLogging mechanism,
it's all in ErrorReport now and you call ErrorReport.log_error or
ErrorReport.log_exception to both create an ErrorReport object, and call
the hooks similar to what ErrorLogging did so that plugins for other
error handling mechanisms can be injected.

ErrorReport has a category field now, similar to how ErrorLogging used
to take a type. the /error_reports UI can filter by category.

The plugin interface was designed with Hoptoad integration in mind, but
it should be pretty general.

Change-Id: I59f7a0d44cf4b6215ad13ff92d30e1d1af607b74
Reviewed-on: https://gerrit.instructure.com/3577
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-05-11 10:36:56 -06:00
JT Olds 1b900f660e update existing sis communication channel instead of creating new ones. fixes #4538
Change-Id: Idf6e03ee14b2f93e4393a36229305dcdb3da14e8
Reviewed-on: https://gerrit.instructure.com/3585
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-05-11 10:34:08 -06:00
Cody Cutrer 3b206bdeef refactor csv importer for less copy/paste
Change-Id: I7b35914c32629d503354ad6cddfaecd9bdf954fe
Reviewed-on: https://gerrit.instructure.com/3569
Reviewed-by: JT Olds <jt@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-05-10 11:19:58 -06:00
JT Olds 837b99828d enable account hierarchy modifications via the sis interface. refs #4521
Change-Id: Iea6e2abd6f2222e22ba67f2f0bfd91446d118e92
Reviewed-on: https://gerrit.instructure.com/3528
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-05-10 11:00:56 -06:00
JT Olds f027bd7bc1 undelete courses that are crosslisted to. fixes #4519
Change-Id: I620b30d4af5280b735f26f61c8a39a92e34957d2
Reviewed-on: https://gerrit.instructure.com/3519
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-05-10 11:00:48 -06:00
Cody Cutrer 60ae77b062 avoid saving unchanged courses, and batch updating sis_source_id
refs #3752

Change-Id: Ic65f555ad7ca501f6f7ecab4957ec7df40dfd876
Reviewed-on: https://gerrit.instructure.com/3563
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-05-10 10:22:11 -06:00
Cody Cutrer 8ac765f6ff avoid saving unchanged enrollments, and batch updating sis_source_id
refs #3752

Change-Id: If282d829a0714e98c31cfccdb94ec0639c063f9b
Reviewed-on: https://gerrit.instructure.com/3566
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-05-10 10:19:53 -06:00
Cody Cutrer 50173ca63f don't lookup sections by name
it is not a suitable unique identifier, as evidenced by actual data

Change-Id: Ib2b2f6d523b2ad052b4eff9a35c10a6e62d394c5
Reviewed-on: https://gerrit.instructure.com/3565
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-05-10 09:43:06 -06:00
Cody Cutrer 52fd347a6c avoid saving unchanged sections, and batch updating sis_source_id
refs #3752

also avoid an account lookup if possible

Change-Id: I8ea6b276cfdcfa86c5c70bd0051bca62737d7d77
Reviewed-on: https://gerrit.instructure.com/3564
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-05-10 09:42:59 -06:00
Cody Cutrer 768e217967 user import optimizations refs #3752
* Only save the pseudonym once
 * Avoid saving the user and pseudonym if nothing actually changed
 * Related to that, since we skipped updating sis_batch_id
   individually, we still need to do that, so do it en-masse instead.
   updated_at will *not* get updated now.

These changes make re-importing the same data 3x faster than the
original import (it used to be less then 2x as fast as the original
import).

Change-Id: Ia6ea32cdeb2f4aebe041d8a51b9efe6c89bc819c
Reviewed-on: https://gerrit.instructure.com/3558
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-05-09 15:58:43 -06:00
Cody Cutrer a7e646f79c set account object not just id to avoid later lookup in Pseudonym#validate_unique_id
refs #3752

Change-Id: Ice950e03c1b6f226bb24d7b9f23ffb0042dba3eb
Reviewed-on: https://gerrit.instructure.com/3555
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-05-09 15:54:27 -06:00
Cody Cutrer a349d49000 update_all needs an array, not a set
Change-Id: I16c0cd8c44e21af574b8bb5b9c137e791b334688
Reviewed-on: https://gerrit.instructure.com/3551
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Jon Jensen <jon@instructure.com>
2011-05-09 10:41:28 -06:00
Cody Cutrer c4ade8327d touch courses en-masse
And avoid broadcast_policy callbacks for them
(save_without_broadcasting only affects the object you call it on,
and not everything that gets automatically saved along with it).

Change-Id: Iaeff7c038bfb2516449eaa12c8b87a1256374ca5
Reviewed-on: https://gerrit.instructure.com/3533
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-05-09 10:20:50 -06:00
Cody Cutrer 7af4dfd742 strategic cache use refs #3752
* Pre-set objects we already have that get used later
 * Compare ids instead of objects to avoid loading stuff we don't
   have (and don't need)

Change-Id: Idf7b701a5ae294c973b3c058dfa4d4f4d0b752bc
Reviewed-on: https://gerrit.instructure.com/3527
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-05-09 10:20:44 -06:00
Cody Cutrer 799c7f0164 update course account associations synchronously during import
Change-Id: I6c27bf7964987a27e7e019556e35b683987d90ed
Reviewed-on: https://gerrit.instructure.com/3521
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
2011-05-09 10:20:38 -06:00
Cody Cutrer 7505e1d303 avoid force-reloading data from the database if possible
refs #3752

Change-Id: I7eb25aafd59ff1c785de2f318117336827e776cc
Reviewed-on: https://gerrit.instructure.com/3516
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-05-06 14:01:56 -06:00
JT Olds 9ab40ec477 course start and end dates. refs #4398
Change-Id: I1fe062fe1b54a8e387822e636e3c7ed3ece49c9c
Reviewed-on: https://gerrit.instructure.com/3494
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-05-06 09:37:33 -06:00
Zach Wily 7beaf4d764 fix update_account_associations job getting created for every imported user
Change-Id: Ia7dc8ca3912510114d88035e264e59ebb54fe086
Reviewed-on: https://gerrit.instructure.com/3446
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-05-03 14:26:18 -06:00
JT Olds 03fae4c7dd banner does *not* have email addresses we can deterministically figure out for every user
Change-Id: If114f99f577affcc8f33ab743be45479f537cc52
Reviewed-on: https://gerrit.instructure.com/3376
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-04-29 14:39:24 -06:00
JT Olds 4c6c9056d1 be more paranoid when looking up users for sis
Change-Id: I4129ba2d687ba8d9cb6cdb363711635a6e443955
Reviewed-on: https://gerrit.instructure.com/3353
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-04-29 09:49:01 -06:00
Cody Cutrer d5c439b0c2 grade publishing results importer
Change-Id: I5279b8dadc9084858099b4b55aaf2dc8ef632a9a
Reviewed-on: https://gerrit.instructure.com/3134
Reviewed-by: JT Olds <jt@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-04-27 16:45:49 -06:00
Zach Wily 2f3756fc37 optimize account association setup when saving enrollments
First of all, be smarter about when we do it - it's only necessary on new
records or when something in the enrollment changes that could affect account
associations.

Second, during SIS import, gather up each user that will actually need their
associations updated and do it at the end. Normally a user will get several
enrollments during a SIS update and this can reduce the amount of work we do
by a lot.

Change-Id: I2f095dd9e7e148229e52e6b5e8b6624dfe389c31
Reviewed-on: https://gerrit.instructure.com/3200
Reviewed-by: Brian Palmer <brianp@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-04-22 08:40:57 -06:00
Zach Wily 06e89cdb6e do default notification policy setup synchronously during SIS import
Change-Id: Ic619952b079d0774bb78fdd8cbb3b930b83bce28
Reviewed-on: https://gerrit.instructure.com/3199
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-04-22 08:23:51 -06:00
Zach Wily 3911ab3cd3 update account associations while creating users
Change-Id: Ie7eda5d1f27da0ee9da8b723ac151a63e97288c9
Reviewed-on: https://gerrit.instructure.com/3198
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
2011-04-22 08:23:37 -06:00
JT Olds 33854cbc4b renaming last_course to nonxlist_course and changing crosslisting semantics
Change-Id: I0b017d4506c54151f34c50c28754b6e1c1a46691
Reviewed-on: https://gerrit.instructure.com/3171
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
2011-04-21 15:43:39 -06:00
JT Olds 6e8acdf576 when creating a new crosslist course, prepopulate course data with existing section's course
Change-Id: I647c9ede4826b7e85c7906d9b24b95e056a7efff
Reviewed-on: https://gerrit.instructure.com/3162
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
2011-04-21 15:01:43 -06:00
JT Olds f5149ad4d7 sis import feedback fixes
Change-Id: I81c96b0ca050c0888b20fa886b735b93bf92d1c4
Reviewed-on: https://gerrit.instructure.com/3161
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Zach Wily <zach@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
2011-04-21 15:01:37 -06:00
Zach Wily 9823cbe480 make the sis verification step check for global section id uniqueness
Change-Id: Ic04b193bcc8835771fcac7ff8c052322b1a49863
Reviewed-on: https://gerrit.instructure.com/2906
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: JT Olds <jt@instructure.com>
2011-04-17 15:28:35 -06:00
JT Olds 6ec333f475 xlist sis importing tests with fixes
Change-Id: Ied4b5fe75984bd399f294041e80935bd86671e0e
Reviewed-on: https://gerrit.instructure.com/3112
Reviewed-by: Zach Wily <zach@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-04-15 15:36:18 -06:00
Zach Wily dc0d205b89 make sure to get the right section on sis import
Change-Id: Ie08fbaea4babc960bdb3a859b14282eaaf4b27b9
Reviewed-on: https://gerrit.instructure.com/2887
Reviewed-by: Brian Whitmer <brian@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-03-30 14:20:44 -06:00
JT Olds d46a843458 cross-list importing logic
Change-Id: I4aebf7a05a2231f039c6b197f43f1e5344621230
Reviewed-on: https://gerrit.instructure.com/2516
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
2011-03-08 15:15:03 -07:00
JT Olds 04165d74c1 cross list importing stub
Change-Id: Ifc755f3dacf23e6b0a8a3159b0c16bde1c4523ce
Reviewed-on: https://gerrit.instructure.com/2512
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
2011-03-08 15:14:35 -07:00
Brian Whitmer 41c9f12988 enforce term/course/section start and end dates
before we were recording these values but not doing
anything about it.  This commit starts scheduling
delayed_jobs to activate/conclude enrollments
in the background when dates pass.

it does not conclude/publish courses/sections
automatically, though.  if we want that to be
automated based on dates then I think we should
do that in a separate commit.

fixes #3356

Change-Id: Id94356fbc5b82196dd041fdb250607a7633cee9f
Reviewed-on: https://gerrit.instructure.com/2431
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2011-03-01 13:47:12 -07:00
JT Olds 3d229d9ea4 optionally scale siscsv progress to some subsection of total work
Change-Id: I99cb59667c2fb57aac194b6c06777f8c6c4ffb2e
Reviewed-on: https://gerrit.instructure.com/2448
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2011-02-25 16:14:09 -07:00
JT Olds 148e66ac68 supporting designer/observer imports and make course_id optional
now one of course_id/section_id is required for enrollments, but not both

Change-Id: I4ebd19ac05988bf3eeffcb846d8bc1fafce73b40
Reviewed-on: https://gerrit.instructure.com/2316
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Reviewed-by: Brian Whitmer <brian@instructure.com>
2011-02-18 13:25:29 -07:00
Brian Whitmer 8035e390f4 add observer role to csv import
and add a new column for linking it to a user

refs #3315

Change-Id: I8333a0530bb2da5557385bf30f45cdd56b5eb261
Reviewed-on: https://gerrit.instructure.com/2266
Tested-by: Hudson <hudson@instructure.com>
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
2011-02-16 13:49:18 -07:00
Bracken Mosbacker e832bb9af2 set the correct workflow state on sis import
users need to be 'registered' not 'active'

closes #3744

Change-Id: Ia32aa3a32689c98fd17ea19594e3d314f9e3918f
Reviewed-on: https://gerrit.instructure.com/2205
Reviewed-by: Bracken Mosbacker <bracken@instructure.com>
Tested-by: Hudson <hudson@instructure.com>
2011-02-08 14:31:36 -07:00
Brian Whitmer 8b8173dcc9 Initial commit.
closes #6988138
2011-01-31 18:57:29 -07:00