Commit Graph

7270 Commits

Author SHA1 Message Date
Cody Cutrer a0a399136a RuboCop: Lint/UnusedBlockArgument config,doc,gems,lib
all manual

Change-Id: I8bb9c11634b0e2b2c8a79dd6f8f2cb71eaa90450
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276628
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-10-27 22:30:15 +00:00
Marcus Vinicius Pompeu d97ffa57a8 Make outcome_imports endpoint aware of the parent group
closes OUT-4768
flag=improved-outcomes-management

Test plan:

  - Jenkins verifies this (API change only)

Change-Id: Ib41277d66c1e81b9d7ff7c1b94fe5a521b2552d6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274606
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Brian Watson <bwatson@instructure.com>
QA-Review: Brian Watson <bwatson@instructure.com>
Product-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
2021-10-27 15:57:14 +00:00
Cody Cutrer aee91b708e RuboCop: Lint/UnusedMethodArgument app/models
all manual

several instances I noticed that the entire method was unused, so removed it

Change-Id: I14ffe7d4b6966ee790e32410f1dbaf5b26ea7f21
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276513
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-10-27 15:55:26 +00:00
Cody Cutrer 61e5b3a6dc RuboCop: Lint/UnusedMethodArgument lib
all manual

Change-Id: I0db0dbf9ffec3ac6675f6d159f8d038fe2f09256
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276489
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-10-27 15:54:27 +00:00
Cody Cutrer 44614b47d7 RuboCop: Lint/UselessAssignment app, config, doc, gems, lib
(everything except spec)

all manual

Change-Id: I6c49a3139efb0f0802ba63a15cab4d4d2cd0b8dd
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276310
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-10-27 15:36:29 +00:00
Keith T. Garner 19d9329411 add prioritizeNonToolGrade extension to grade passback
This flag is useful for if an LTI tool needs to provide a grade
passback, but would prefer to use the grade in canvas already if a
teacher graded via the gradebook instead of the tool.

An example of where this comes into play is if an LTI tool's grade
passback is delayed, during the delay a teacher manually grades in
canvas's gradebook, and then later the grade passback happens. We know
that certain institutions would prefer the teacher grade stay. (Why the
teacher is giving a different grade than the LTI tool? No idea.)

test plan:
 - specs pass

Change-Id: I2b166f892cc11bfc64522a850944a91aa4d94a96
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274389
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Product-Review: Susan Sorensen <susan.sorensen@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
2021-10-27 15:03:43 +00:00
Xander Moffatt 0a5c90cff2 process content items with line items
closes INTEROP-7069
flag=lti_deep_linking_line_items,lti_deep_linking_module_index_menu

why:
* a new addition to the IMS LTI spec is to accept line items as part of
a deep link response, and the Canvas way of handling line items is to
create an assignment

test plan:
* with a 1.3 test tool set up, launch the tool from either the modules
or assignment index menu (3-dot button in top right of page)
* fill in the line item box in the test tool with:
```
{"scoreMaximum":10,"label":"line item test","resourceId":"id","tag":"test"}
```
* fill in the available box in the test tool with:
```
{"startDateTime":"2021-10-18T14:32:07Z","endDateTime":"2021-11-18T14:32:07Z"}
```
* fill in the submission box in the test tool with:
```
{"endDateTime":"2021-11-18T14:32:07Z"}
```
* send the content items back to Canvas
* the page should reload
* you should have one new assignment, titled "line item test"
* it should be worth 10 points, and launch the test tool when opened
* it should unlock on Oct 18 and lock on Nov 18, and be due on Nov 18
* launch the tool from the index menu again and this time fill in the
line item box with:
```
{"label":"this should do nothing"}
```
* submit the content items back to Canvas
* the page should reload
* you should not have any new assignments, since scoreMaximum is a
required field and was not present

Change-Id: I5a7cd02f20da23f162efc7705ac1d98cf1bffe8b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/272069
Product-Review: Xander Moffatt <xmoffatt@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Alexandre Trindade <alexandre.trindade@instructure.com>
QA-Review: Alexandre Trindade <alexandre.trindade@instructure.com>
2021-10-26 23:18:51 +00:00
Ethan Vizitei 8aafc7d464 unconfuse OAuth::Helper references
refs FOO-2529
flag=none

TEST PLAN:
  1) sentry error goes away

Change-Id: I32305a316832fa21bd1edb8550cba309a3222c35
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276823
Reviewed-by: Ben Rinaca <brinaca@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Simon Williams <simon@instructure.com>
Product-Review: Simon Williams <simon@instructure.com>
2021-10-26 16:18:22 +00:00
Cody Cutrer 3b38d39572 support suspending users via SIS import
closes FOO-2414

test plan:
 * create a user via SIS
 * run another SIS import with the user's status set to "suspended"
 * that use should no longer be able to login

Change-Id: I31b177ee797b3dd8962112960bda11c5c4fa575a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276557
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2021-10-26 15:26:11 +00:00
Ethan Vizitei c656c0d60e make globalLookups a module to extend, not a stub
refs FOO-2498
flag=none
[pin-commit-multiple_root_accounts=5bd07698db01843f784622d0a99277bbd7be0dc1]

the stub pattern won't work with zeitwerk

TEST PLAN:
  1) specs pass with plugins migrated to autoextension of GL

Change-Id: I29c7249e38d06e54d4fc111f8a845d4e94ea70f3
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276301
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-10-26 14:58:27 +00:00
Aaron Ogata 5ec29f69d0 only spawn threads for files that will actually upload
refs DE-859

Change-Id: I625a36b823a3ed7d879e0e1da266c235c74a1f0a
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276752
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2021-10-25 18:03:14 +00:00
Evan Battaglia 07b7fef075 DRY up a couple constants by using JS ENV
Test plan:
- go to course settings integrations page
- make sure copy mentioning max number of users in a team still shows
  correct numbers (25,000 and 100)

refs INTEROP-6805
flag=microsoft_group_enrollments_syncing

Change-Id: I01c6839bd63d8f221159050a68c04b28da09fda8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276585
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2021-10-25 16:39:21 +00:00
Evan Battaglia 5bfb1572bd Don't restrict canvas_icon_class
We apparently we're restricting the values before
dbd8c466 fixed `"canvas_icon_class": { ... }` to
`"canvas_icon_class" => { ... }`

(Since that commit was ostensibly just a linting commit but changed
semantics, it might be worth revisiting other things in that commit.)

fixes INTEROP-7109

Test plan:
- Edit an LTI 1.3 dev key JSON in the Developer Keys UI
- Add "canvas_icon_class": "icon-pdf" to a placement in an LTI 1.3 dev key
- Make sure the dev key saves
- Observe that the dev key cannot be saved before this commit

Change-Id: Ibb22a8d5d9ebdb9b7afb99adf9ab2893be863165
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276645
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Karl Lloyd <karl@instructure.com>
2021-10-25 16:31:19 +00:00
Alex Slaughter 616edf086c Add $Canvas.externalTool.id to LTI launch params
Add support for LTI tools to consume the tool id
as defined in canvas for themselves.

Test Plan:
 - Specs pass

flag = none

Change-Id: I6765b907c14a79bad8e68b3b8037efc140bd7bf5
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276455
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Alex Slaughter <aslaughter@instructure.com>
2021-10-22 20:27:31 +00:00
Aaron Ogata b5e77f261f add verbose logging option to s3 uploader
refs DE-859

Change-Id: I4e4615cf57ec47afc0a405848eec6302a11c9702
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276609
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Aaron Ogata <aogata@instructure.com>
Product-Review: Aaron Ogata <aogata@instructure.com>
2021-10-22 19:51:15 +00:00
Jacob Burroughs b329523126 Migrate twilio to use rails creds
fixes FOO-1496

Change-Id: I26e329e09022aecca3f575667fe5ff8c377eb24d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276546
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-10-22 14:51:17 +00:00
Evan Battaglia bacc7131f8 MSFT sync fallback to batch if "too many users"
This was discovered in QA for a previous commit. If a course has over
100 owners, the sync fails, and then we run a partial sync, we can run
into the case where the partial sync tries to add 20 owners but many if
not all or duplicates. If there are >= 81 owners, Microsoft won't
realize this but instead say "there are too many users". Instead of
trusting this message, we should fall back to the batch API -- because
it adds each user individually, it will ignore any that are already in
the group instead of saying there isn't room.

Test plan:
- Have a Microsoft group with >= 82 owners
- From a rails console, get the graph service object and then get a list
  of 20 owners in the group.
    def all_owners_ids(gs, group_id)
      [].tap do |list|
        gs.list_group_owners(group_id) do |slice|
          list.concat slice.map{|u| u['id']}
        end
      end
    end
    group = MicrosoftSync::Group.first
    gs = group.syncer_job.steps_object.send:graph_service
    owners = all_owners_ids(gs, group.ms_group_id).take(20)
    gid = group.ms_group_id
- Remove one of the owners from the group:
    one = [owners.last]
    gs.remove_group_users_ignore_missing(gid, owners: [owners.last])
- Wait a couple seconds (API is eventually consistent) and check that
  the user is no longer in the group:
    all_owners_ids(gs, gid).include?(owners.last)
- Add the 20 owners -- 19 of which should already be in the group:
    gs.add_users_to_group_ignore_duplicates(gid, owners: owners)
- The function should return a list of the 19 duplicates. You should see
  it log that it first tried the 'patch' endpoint and fell back tothe
  'post $batch' endpoint.
- Wait a couple seconds and check that the user was added back in.
    gs.list_group_owners(gid).map{|g| g['id']}.include?(owners.last)

refs INTEROP-6805
flag=microsoft_group_enrollments_syncing

Change-Id: I4a3dd47edb62b29ba8278182b37894b28604ceda
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276318
Reviewed-by: Sean Scally <sean.scally@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2021-10-21 17:11:38 +00:00
Evan Battaglia 3a80c3caa6 MSFT Sync copy changes
Test plan:
- have a course with > 100 owners
- try to enable sync on it
- check copy is updated in the two places

refs INTEROP-6805
flag=microsoft_group_enrollments_syncing

Change-Id: I911c6ca6998918a3a49cbbbb2473566800ea2d60
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276483
Product-Review: Karl Lloyd <karl@instructure.com>
Reviewed-by: Sean Scally <sean.scally@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-10-21 16:46:41 +00:00
Jacob Burroughs e4e7aa4814 Expose vault config
Change-Id: I8f4518995f617e5baf8f878967e58ce865dce850
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276501
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Jacob Burroughs <jburroughs@instructure.com>
Product-Review: Jacob Burroughs <jburroughs@instructure.com>
2021-10-21 15:51:47 +00:00
Evan Battaglia 808ab82d34 MSFT sync: handle adding/removing users near limit
refs INTEROP-6805
flag=microsoft_group_enrollments_syncing

Test plan:
- have a course with one owner
- remove an owner and add a different owner. recall that enrollments
  have to be in an "active" workflow_state to count.
- run a partial sync (`group.syncer_job.run_synchronously :partial`)
- sync should fail, but it should still add the new owner. Check in the
  Microsoft admin console. Both owners will exist in the group.
- run a full sync (`group.syncer_job.run_synchronously`). Check in the
  MS admin console. The old owner should now be removed.
- Repeat but run a full sync instead of a partial sync the first time.

Change-Id: I0cce5a50a51f40ed36f5eea928638c4782b31937
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276019
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
2021-10-21 14:53:17 +00:00
Evan Battaglia 51b5ddc080 MSFT Sync: refactor http code
Also fix default special_cases ([] instead of {}) in graph_service/http.rb

The diff http.rb doesn't show nicely here, try:
  diff --ignore-space-change \
    <(git show HEAD^:lib/microsoft_sync/graph_service_http.rb) \
    <(git show HEAD:lib/microsoft_sync/graph_service/http.rb)

refs INTEROP-6805
flag=microsoft_group_enrollments_syncing

Test plan:
- run through a sync, make sure it still works

Change-Id: I12d4339c0c1a50417ed23f9476ca12b1b9f711a4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275802
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
2021-10-21 14:53:05 +00:00
Evan Battaglia 702cf49cbd Disable course once reaches too many enrollments
closes INTEROP-6805
flag=microsoft_group_enrollments_syncing

Test plan:
- note: this is closely based on test plan for last commit
- enable sync for a course
- add 101 teachers that have users in our test tenant. I
  made a bunch of test users to use owners you can use. What I did was
  generate the list of UPNs with
  'echo evantest{001..101}deleteafternov2021@...' and add them to my
  course)
- Remember the enrollments have to be all active and the communication
  channels 'registered', so I did
  `CommunicationChannel.update_all(workflow_state: 'active')`
  followed by
  `ms_group.course.enrollments.map{|e| e.update workflow_state: 'active'}`
  which will add the users to the PartialSyncChanges table.
- run a partial sync (e.g.
  `group.syncer_job.run_synchronously :partial`)
- in the course settings check the Microsoft Sync integration, it should
  be disabled. Note that it won't show any error because errors are not
  shown when the sync is disabled, but trying to enable it will show the
  error shown when trying to enable a course with too many enrollments
  (added in a previous commit)
- in a console, check that last_error is set on the group
- remove the 'check_for_enrollment_limits' before_action hook in
  app/controllers/microsoft_sync/groups_controller.rb
- also remove the 'rescue Errors::OwnersQuotaExceeded' block on
  lib/microsoft_sync/syncer_steps.rb:263 so we can be sure we are testing
  the step_full_sync_prerequisites code path
- enable the sync again
- run a full sync
- check the course settings page again. Again the sync should be
  disabled. And last_error should should have the "too many teachers"
  error message

Change-Id: Ied4faf7f997040e224c1cbdcdb7f0c5d24c4e02e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274953
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Michael Ziwisky <mziwisky@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
2021-10-21 14:52:54 +00:00
Isaac Moore f94fe15d01 Add `locked_for_user` property to `observer_alert_json`
This change adds a new `locked_for_user` property to the Observer Alert
API to indicate whether or not a particular alert's context is "locked"
(e.g., invisible) for the calling observer. This can be set to `true` for
a number of reasons, but most commonly, the deletion of the content or
the conclusion of the course.

closes LS-2668
flag=none

test plan:
- create an observing enrollment for a student enrolled in a course
- using the API, as an observer, create an observer alert threshold for
  a high assignment grade for your student (see the bottom of the commit
  message for an example request)
- as a teacher, enter a grade for the student in the course above the
  value you set in your threshold
- call the `/api/v1/users/self/observer_alerts/<student_id>` endpoint and
  verify an alert appears, and `locked_for_user` is false
- set the course end date to the past, and restrict students from viewing
  the course after the end date
- call the API again, and verify `locked_for_user` becomes true
- revert your change to the course end date
- call the API again, and verify `locked_for_user` becomes false
- delete the assignment
- call the API again, and verify `locked_for_user` becomes true again

### Example threshold creation request:
```
curl --request POST \
  --url http://<canvas URL>/api/v1/users/self/observer_alert_thresholds \
  --header 'Authorization: Bearer <your token here>' \
  --header 'Content-Type: application/json' \
  --data '{
	"observer_alert_threshold": {
		"alert_type": "assignment_grade_high",
		"threshold": "90",
		"user_id": <your student's user id>
	}
}'
```

Change-Id: Ifc0775c70a0e0cb6bf66c5e60968013a91661eb9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276187
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Isaac Moore <isaac.moore@instructure.com>
2021-10-20 22:54:45 +00:00
Eric Saupe 023f356e85 Remove pace plans start_date column
fixes LS-2723
flag=pace_plans

test plan:
- Creating and publishing pace plans for courses, sections, and users
should create all relevant assignment overrides with correct dates
- Pace plans frontend should continue to work as expected
- Pace plans should no longer have the start_date column but should
return a start_date for the relevant context's start_at date. For example,
if the pace plan is for the user then the start_date will be the start_at
date for the user's enrollment. Course section pace plans return the
course_section.start_at. The fallback for all start_at is the course's
start_at date.

Change-Id: Iffce86bd0eca65a4f51db5f88e2b35833b7bc1f1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276317
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Eric Saupe <eric.saupe@instructure.com>
2021-10-20 21:57:54 +00:00
Ethan Vizitei 75a442a563 keep db connections in MB producer thread clean
closes FOO-2500
flag=none

TEST PLAN:
  1) re-enable MB pulsar writes in high traffic environment
  2) connection leasing errors do not return

Change-Id: I63bbfc370777c542d7d74441991fbafc188146b1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276255
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2021-10-19 19:48:45 +00:00
Jackson Howe 60f3a182fe Tweak zoom/webex regex to allow '-' in url
fixes LS-2752
flag = none

Test plan:
 - Add a link like https://instr-ucture.zoom.us/j/9585021282 (with a
   hyphen) to a k5 subject calendar event location or description
 - Visit the planner
 - Expect to see a join button

Change-Id: Iac43b8bc15eada834bdc71054e3f239d253e4aee
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276272
Reviewed-by: Robin Kuss <rkuss@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Jackson Howe <jackson.howe@instructure.com>
2021-10-19 19:43:13 +00:00
Rob Orton 4c14d0fdf1 don't join cross shard for discussion_topics
test plan
 - specs should pass

fixes VICE-2164
flag=none

Change-Id: I3be48a2d4500dc7377ec274d9a6a87c01130f725
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275553
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Drake Harper <drake.harper@instructure.com>
QA-Review: Drake Harper <drake.harper@instructure.com>
Product-Review: Drake Harper <drake.harper@instructure.com>
2021-10-18 15:47:51 +00:00
Eric Saupe 36ebfea4ec Fix inconsistent can_submit value
fixes LS-2679
flag=none

test plan:
- Create a published course with a student enrolled
- Create and publish an assignment
- Create a module and leave it unpublished
- Check the API for the assignment for the student with
include[]=can_submit in the request like this,
api/v1/courses/:course_id/assignments/:assignment_id?include[]=can_submit&as_user_id=:user_id
- Verify the can_submit value is true
- Add the assignment to the module
- Verify the API response for can_submit is false
- Publish the module
- Verify the API response for can_submit is true

Change-Id: Ife6ce897bf52c990ad6bdd3a7d7d5787dda069dc
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275985
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Eric Saupe <eric.saupe@instructure.com>
2021-10-15 19:33:05 +00:00
Jeremy Stanley cabece352d log job ids in exports and imports
if something goes wrong, but not so wrong that the entire export
or import fails (so there is no captured exception), it's
essentially impossible to review logs of the migration. if we
store the job id, we can provide it to the log-downloader script.

test plan:
 1. a. perform a common cartridge export
    b. in the console, examine ContentExport.last and ensure
       settings[:job_id] is set
    c. look at log/delayed_job.log and verify the log lines
       for the recent export include that id
 2. a. perform a course copy
    b. in the console, examine ContentMigration.last and ensure
       migration_settings[:job_ids] contains a job id
 3. a. perform a common cartridge import, choosing to import everything
    b. same as 2(b)
 4. a. perform a common cartridge import, choosing to import selectively
    b. make some kind of selection and complete the import
    c. ensure migration_settings[:job_ids] contains two job ids
       (one for each stage of the migration)

flag = none
closes LS-2730

Change-Id: I5d4028f4384111a06fa10d6327dce99c487fb9d6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275929
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Jeremy Stanley <jeremy@instructure.com>
2021-10-15 16:11:28 +00:00
Alex Slaughter 30f0a02445 Add $Canvas.assignment.description to LTI launch params
Add support for LTI tools to consume the assignment description
set in canvas.

Test Plan:
 - Specs pass

flag = none

Change-Id: I339d80f91fbe2bf2e9c855f227b9ee015f1bb835
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275548
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Alex Slaughter <aslaughter@instructure.com>
Product-Review: Alex Slaughter <aslaughter@instructure.com>
2021-10-15 06:08:05 +00:00
Ethan Vizitei 8b9c0d126d wrap core_ext module in Canvas for zeitwerk
refs https://instructure.atlassian.net/browse/FOO-2476
flag=none

TEST PLAN:
  1) specs pass

Change-Id: Iaa6a7150eb1eb0bd2bc778a5ef2df540eefde500
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275962
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-10-14 22:39:18 +00:00
Luis Oliveira 372399e798 Fix content export/import with longfilenames
closes: LS-2657
flag=none

test plan:
- Upload 2 files to a course with long file names (above 215 chars)
- Create an export
- Import into a new course
- Check that the files are there

Change-Id: I336763c2f10dbe7cec3a535e39e213172bd290ad
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275069
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Luis Oliveira <luis.oliveira@instructure.com>
2021-10-14 18:26:37 +00:00
Spencer Olson 734344eaff fix speedgrader status menu with anonymous assignments
closes EVAL-1995
flag=edit_submission_status_from_speedgrader

Test Plan:
1. Enable "Edit Submission Status from Speedgrader".
2. Create an anonymous assignment.
3. Go to SpeedGrader and change a student's status (i.e. Late, Missing,
   Excused, or None) using the select menu. Verify the request succeeds
   and the status is updated.
4. Create an assignment that is not anonymous.
5. Go to SpeedGrader and change a student's status using the select
   menu. Verify the request succeeds and the status is updated.

Change-Id: I949648b7a2c78e01642d0c73298995acb3e4e7d6
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275004
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Adrian Packel <apackel@instructure.com>
Reviewed-by: Eduardo Escobar <eduardo.escobar@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
QA-Review: Kai Bjorkman <kbjorkman@instructure.com>
Product-Review: Jody Sailor
2021-10-14 16:19:50 +00:00
August Thornton bc6a684750 prefer active user if matching uuid for InstAccess tokens
Prefer local users with a caveat. in case there are user merge
artifacts left behind with matching uuids we can prefer a local
user record object, BUT it could be in a deleted state, instead
we want to only look up active user record objects as we can
count on shadow records getting updated properly on workflow
state changes.

fixes FOO-2424
refs FOO-2374
flag = none

test plan:
 • have a user-merge occur x-shard
 • visit an api-gateway mediated pathway like account notifications
 • the correct _active_ shard-local user should be loaded as the
   proper auth context

Change-Id: I7d7e53663cd34e3d016863b1d04f34a562c2dcbe
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275897
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ethan Vizitei <evizitei@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: August Thornton <august@instructure.com>
2021-10-14 14:35:24 +00:00
Evan Battaglia 9650b9bd15 Support detecting too many owners/members
* This needs to be done when adding users, either via the endpoint which
  adds multiple users, or adding via the "$batch" endpoint (which batch
  subrequests which each add one user).
* To ease handling of the ever-growing number of special cases, I
  refactored code away from using the "special case block" paradigm to a
  "special_cases" hash with matchers (status code + body regex)

More work to rescue the exception and disable sync will be done in
the next commit.

flag=microsoft_group_enrollments_syncing
refs INTEROP-6805

Test plan:
- have a course setup with Microsoft Sync enabled and run a full sync
  once.
- add 101 teachers that have users in our test tenant. I
  made a bunch of test users to use owners you can use. What I did was
  generate the list of UPNs with
  'echo evantest{001..101}deleteafternov2021@...' and add them to my
  course)
- Remember the enrollments have to be all active and the communication
  channels 'registered', so I did
  `CommunicationChannel.update_all(workflow_state: 'registered')`
  followed by
  `ms_group.course.enrollments.map{|e| e.update workflow_state: 'active'}`,
  which will add the users to the PartialSyncChanges table.
- run a partial sync (e.g.
  `group.syncer_job.run_synchronously :partial`) It should fail with the
  Errors::OwnersQuotaExceeded error, coming from the request() call in
  add_users_to_group_ignore_duplicates() (not from
  add_users_to_group_via_batch())
- run:
    MicrosoftSync::UserMapping.to_a.each_slice(20) do |users|
      graph_service.add_users_to_group_via_batch(
        group.ms_group_id, [], users.map(&:aad_id)
      )
    end
  That should also fail with the same error.
- Note: I didn't add 25,000 members to see the too many members error,
  but I assume it looks nearly the same.

Change-Id: I425b7c8f09609db11fed31a475ffac2f77b1d3e7
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274798
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Michael Ziwisky <mziwisky@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Evan Battaglia <ebattaglia@instructure.com>
2021-10-13 22:55:59 +00:00
Ethan Vizitei 5f4bf2e8ea Inflect OAuth2 for Zeitwerk
refs FOO-2476
flag=none

TEST PLAN:
  1) specs pass

Change-Id: Ic5b67c658913a31dd0a6ac25a8813397745e6c2b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275754
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-10-13 20:25:00 +00:00
Ethan Vizitei 015d7abc62 inflect OAuth for zeitwerk
refs FOO-2476
flag=none

TEST PLAN:
  1) specs pass

Change-Id: I9f73e0021f5efec2be3c2f419e758baf00e6914f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275642
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-10-13 16:32:05 +00:00
Michael Ziwisky cf4da290e3 don't blow up when InstAccess::Token contains a bad user_uuid
fixes INTEROP-7105

test plan:
 - create an InstAccess::Token for a bogus user, e.g. in a rails
   console:
   > InstAccess::Token.for_user(user_uuid: 'bogus', account_uuid: 'whatever').to_unencrypted_token_string

 - try to use that token to query the subgraph, e.g.:
   $ curl http://localhost:3000/api/graphql/subgraph \
     -v \
     -X POST \
     -H "Accept: application/json" \
     -H "Content-type: application/json" \
     -H "Authorization: Bearer $INST_ACCESS" \
     --data '{ "query": "{ allCourses { name } }" }'

 - notice the response is a 401, not a 500

Change-Id: Ia303ce2a233d3bc3b4e30358ac71f19bb360a091
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275785
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Tucker Mcknight <tmcknight@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Michael Ziwisky <mziwisky@instructure.com>
2021-10-13 16:06:40 +00:00
Spencer Olson 41b9a6e4cc add annotatable_attachment_id to assignment json
closes EVAL-2025
flag=none

Test Plan:
1. Verify the /api/v1/courses/:id/assignments and
   /api/v1/courses/:course_id/assignments/:id endpoints return
   annotatable_attachment_id on the assignment.

Change-Id: I740c71adcb30f472ca44b2ef9e30ef1ac3321e54
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275737
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Aaron Shafovaloff <ashafovaloff@instructure.com>
Reviewed-by: Syed Hussain <shussain@instructure.com>
QA-Review: Syed Hussain <shussain@instructure.com>
Product-Review: Syed Hussain <shussain@instructure.com>
2021-10-13 15:48:39 +00:00
Eric Saupe a299cab570 Add pace plans publish endpoint
fixes LS-2454
flag=pace_plans

test plan:
- With pace plans feature flag enabled
- Create a pace plan and verify it isn't active and does not have a
published_at date
- Make a POST request to /api/v1/courses/:course_id/pace_plans/:id/publish
- Verify the request is successful and the pace plan is active and has
a published at date
- Verify the modules have assignment overrides created
- Change the duration dates for the pace plan module items
- Republish
- Verify the modules have new assignment overrides for the new dates

Change-Id: I6ad4fc1669cf069b4edeb313ba07885a36c0a8ee
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/273070
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
QA-Review: Jeremy Stanley <jeremy@instructure.com>
Product-Review: Eric Saupe <eric.saupe@instructure.com>
2021-10-12 22:08:36 +00:00
Jonathan Guardado c8fe6426dd Observer grades touch-ups
The "View feedback" link was fixed, passing the right user as a prop
to the GradeRow component

The discrepancy in the totals was due to the grading period wasn't
being propagated until the observed users score calculation, which
caused the API to return the totals for the complete course instead
of the ones for the grading period, now this parameter is included in
the operation and the totals match with the scores in the student
view

closes LS-2690
flag= k5_parent_support

Test plan:

"View feedback" link:
- Enroll a student to a course
- Link the student to an observer
- As a teacher, create an assignment in the course
- As the student, submit the assignment response
- As the teacher, leave some comments to the student submission
- Log in as the observer and go to the Subject grades tab
- Click on the View feedback link
- Expect to be sent to the observed user submissions

Discrepancy in the totals:
- Log in as the observer and go to the Subject Grades Tab
- Select an Student
- Select a grading period
- Expect to the totals be the same as if you were logged as the
selected student

[pin-commit-multiple_root_accounts=87eb5358ec946ae0c3d9c2d8df9d298a5d51fd89]
[pin-commit-analytics=8980785704bdbf128375dfc7a5beec879d3129e3]

Change-Id: I4c2e33446d9bef24d0de24a7397263f67d229163
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275182
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Nate Armstrong <narmstrong@instructure.com>
QA-Review: Nate Armstrong <narmstrong@instructure.com>
Product-Review: Peyton Craighill <pcraighill@instructure.com>
2021-10-12 20:56:33 +00:00
József Kozma 46f2947903 Store declared_user_type while importing CSV
Closes SOS-1917
flag=none

Test plan:
- import a csv with declared_user_type provided
- verify that the user has declared_user_type set
- import a csv with declared_user_type not provided
- verify that the user still has declared_user_type set previously
- import a csv with declared_user_type=<delete>
- verify that user's declared_user_type is unset

Change-Id: I9a26247b20f65cdb96a5a84e0eb53dd29f391467
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275475
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Kozma Jozsef <jkozma@instructure.com>
Product-Review: Kozma Jozsef <jkozma@instructure.com>
2021-10-12 09:26:28 +00:00
Rob Orton dddd8d8b4c remove group leaders on user deletion via sis
test plan
 - specs should pass

fixes VICE-2068
flag=none

Change-Id: I939895a817d03fb654590d3e3734337704a669d4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275649
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Caleb Guanzon <cguanzon@instructure.com>
QA-Review: Caleb Guanzon <cguanzon@instructure.com>
Product-Review: Caleb Guanzon <cguanzon@instructure.com>
2021-10-12 06:26:00 +00:00
Drake Harper f3355037ec Add student reporting setting to course
refs VICE-2009
flag=discussions_reporting

Test Plan:
 - specs should pass
 - make a get request to
    http://127.0.0.1:3000/api/v1/courses/<insert course id>/settings
 > should see “allow_student_reporting” as true in response unless
    changed in UI

Change-Id: Ie6c999e573e95303a4e1c9dff6917d1576510e03
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275397
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Davis Hyer <dhyer@instructure.com>
QA-Review: Davis Hyer <dhyer@instructure.com>
Product-Review: Davis Hyer <dhyer@instructure.com>
2021-10-11 22:05:22 +00:00
Ethan Vizitei 41daa63d39 rename CSVImporter with zeitwerk inflection
refs FOO-2474
flag=none

TEST PLAN:
  1) specs pass

Change-Id: I3140bf82419458089fd3f6821eb3ae62a7315a3d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275626
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-10-11 21:31:51 +00:00
Ethan Vizitei d08c6f721a rename core_ext/oauth2 for zeitwerk compatibility
refs FOO-2476
flag=none

TEST PLAN:
  1) specs pass

Change-Id: I26892b88a145b7ba95435be125f4ce2387cfc85c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275631
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-10-11 21:31:32 +00:00
Ethan Vizitei 17a887bc53 rename CSVWithI18n to inflect properly for zeitwerk
refs FOO-2474
flag=none

TEST PLAN:
  1) specs pass

Change-Id: If8e9580fbf76a001f5765dcce9080daff66dba38
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275610
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-10-11 18:52:05 +00:00
Ethan Vizitei bb3453ed0f Inflect "IMS" consistently
closes FOO-2467
flag=none
[skip-stages=Flakey]

Since canvas and it's plugins
share an autoloader, they need
to make consistent choices about how to inflect
the same acronyms

TEST PLAN:
  1) tests pass

Change-Id: Icb133f33ed3e719b616e42e497bac1dc65bd9370
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275496
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
QA-Review: Ethan Vizitei <evizitei@instructure.com>
Product-Review: Ethan Vizitei <evizitei@instructure.com>
2021-10-08 20:11:15 +00:00
Jared Crystal 9a28221bee datafix manage_account_bank permission field on Quiz LTI tools
refs QUIZ-8671
flag=none

test plan:
 - contexts missing the canvas_permission field on quiz_lti_tool
   have it populated

Change-Id: I3051f47a00431450347af4315b4c7b715ff52c1f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/271763
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Product-Review: Jared Crystal <jcrystal@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Reviewed-by: Alex Slaughter <aslaughter@instructure.com>
2021-10-08 17:55:00 +00:00
Mysti Lilla 377d4eb438 Add developer key ID to external tool JSON
flags=none

Test plan
- Load up an LTI 1.3 external tool in the API
- See the developer_key_id

Change-Id: I00c277be71c7c1c9056c17a3f6bd3906708c60bb
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/275467
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
QA-Review: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Connor Merchant <cmerchant@instructure.com>
2021-10-08 17:36:52 +00:00