Commit Graph

162 Commits

Author SHA1 Message Date
Alexandre Trindade 549bce4115 allow course-related variable expansions for NRPS
why:
  Course-related variable expansions aren't exposed

flag=none
refs INTEROP-6600

--------------------------------------------------
Test plan
(requires the LTI 1.3 Test Tool)
--------------------------------------------------
* Activate the feature flag "LTI Deep Linking for Module Index
  Menu"

* Install a LTI Tool with the placement "module_index_menu_modal"
  using the message_type "LtiDeepLinkingRequest"

* Go to Course > Module page

* Click on the 3 dots button-menu in the top of the page and
  launch the tool

* the "Deep Linking" page should open

* add the custom variables in the "Custom Params (JSON)" field.
  Example:
```
{
   "canvas_course_endAt":"$Canvas.course.endAt",
   "canvas_course_gradePassbackSetting":"$Canvas.course.gradePassbackSetting",
   "canvas_course_hideDistributionGraphs":"$Canvas.course.hideDistributionGraphs",
   "canvas_course_id":"$Canvas.course.id",
   "canvas_course_name":"$Canvas.course.name",
   "canvas_course_previousContextIds":"$Canvas.course.previousContextIds",
   "canvas_course_previousContextIds_recursive":"$Canvas.course.previousContextIds.recursive",
   "canvas_course_previousCourseIds":"$Canvas.course.previousCourseIds",
   "canvas_course_sectionIds":"$Canvas.course.sectionIds",
   "canvas_course_sectionRestricted":"$Canvas.course.sectionRestricted",
   "canvas_course_sectionSisSourceIds":"$Canvas.course.sectionSisSourceIds",
   "canvas_course_sisSourceId":"$Canvas.course.sisSourceId",
   "canvas_course_startAt":"$Canvas.course.startAt",
   "canvas_course_workflowState":"$Canvas.course.workflowState"
}
```

* click on "Send Deep Link to Platform"

* open the assignment created to launch the tool

* in the "Decoded JWT" field, check in the JSON for the key
  "https://purl.imsglobal.org/spec/lti/claim/custom". There
  should be the requested custom variables



Change-Id: Icbe518b67dc62da7b056af31feb5be85f13b6104
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/294961
Reviewed-by: Tucker Mcknight <tmcknight@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Product-Review: Alexis Nast <alexis.nast@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
2022-07-07 15:35:00 +00:00
Ryan Hawkins 306a08dc58 Add New NRPS Variable Expansions
This commit adds some additional variable expansions to the NRPS
service. According to the LTI 1.3 NRPS 2.0 spec, variable expansions are
only supported for requests that are "queried in the context of a
Resource Link". This means messages that don't send a rlid parameter
will not get any expanded resources.

flag = none

closes INTEROP-7410

test-plan:
- First, ensure you have an installation of the LTI 1.3 test tool that
  has at least the contextmembership.readonly scope. In addition, ensure
  the test tool has the new variables as substitutions and that it is
  installed in a placement that lets it create resource links, typically
  assignment_selection or link_selection. I used the
  assignment_selection placement.
- Create an assignment (or resource link in general). Take note of the
  resource link id. It's a UUID/GUID. You can find it by launching the
  assignment you created and looking for {{.resource_link}}{{.id}}.
- Visit lti13testtool.docker/nrps/new. The context id is the id of the
  course you just created the resource link in, the rlid is the
  resource_link.id you just took note of, and the credential id is the
  credential of the tool inside the LTI 1.3 Test Tool's database.
- Send off the request and you should get some JSON back. Look under the
  custom claims section and you should see the variables you just added
  in their expanded format.

Change-Id: I0994733b588912b2edfce2e959413a07f4c9545e
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/292043
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: Alexis Nast <alexis.nast@instructure.com>
2022-05-19 16:44:34 +00:00
Xander Moffatt 270de02abe add endDateTime directly to Lti::LineItem
why:
* to conform to LTI spec by returning endDateTime
in the response of AGS create/update calls
* though the date is now stored twice (once on Assignment, once on
Lti::LineItem), there is a situation where they can be different
(set on line item that's not the primary for the assignment), even
though that wouldn't actually do anything

refs INTEROP-7265
flag=none

test plan:
* run migrations
* follow test plan from parent commit to create/update line item
using AGS API
* note that the endDateTime attribute is present in the response

Change-Id: Id3bbdd5f328476fb02fd96a005a655902fa8dac4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/291045
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Evan Battaglia <ebattaglia@instructure.com>
QA-Review: Evan Battaglia <ebattaglia@instructure.com>
Product-Review: Alexis Nast <alexis.nast@instructure.com>
Migration-Review: Jacob Burroughs <jburroughs@instructure.com>
2022-05-04 16:35:41 +00:00
Ed Schiebel ad827c5198 Show course paces notice on quizzes
https://gerrit.instructure.com/c/canvas-lms/+/289809
is a prereq, since it creates the course pacing
notice react component used here.

    refs LS-3034
    flag=course_paces

    test plan:
      - in a course with course pacing on
      - create a quiz
      > expect a notice about course pacing managing due dates
        in lieu of the due date inputs
      - click the go to course pacing link
      > expect to go to the course pacing page
      - go back and save the quiz
      > expect the notice on the quiz "show" page.

Change-Id: Ifa00021eddb6ad11efa2d3691d02093ce3691193
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/289823
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Robin Kuss <rkuss@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Ed Schiebel <eschiebel@instructure.com>
2022-04-18 21:01:48 +00:00
Xander Moffatt 0e3ddfd48b expose launch url in AGS Line Item API
closes INTEROP-7267
flag=none

why:
* to facilitate 1.1 to 1.3 migration for tools that may only be able to
link line items using the original resource link url

test plan:
* install the LTI 1.3 test tool
* get an LTI token for that tool using
`canvas.docker/api/lti/advantage_token?tool_id=1`,
replacing 1 with the id of your 1.3 test tool
* construct an API request for the AGS Line Items API  for a course
with at least one line item:
`canvas.docker/api/lti/courses/1/line_items`,
and add the LTI token to the Authorization header using
`Bearer: <token>`
* the request should return a list of line items in JSON format
* add `?include[]=launch_url` to the request
* each line item should now have a new canvas extension property that
contains the launch url for that line item and its related assignment
* change the request to request a specific line item (like add `/1` on
the end), still with the query param
* it should return one line item, with the new extension property
* remove the query param or change the value to something else
* it should not return the extension property

Change-Id: I0caa494111fde4093f99fef1398b27799b07a6cf
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/287096
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Mysti Lilla <mysti@instructure.com>
QA-Review: Mysti Lilla <mysti@instructure.com>
Product-Review: Alexis Nast <alexis.nast@instructure.com>
2022-03-15 22:26:05 +00:00
Cody Cutrer c2cba46851 RuboCop: Style/StringLiterals, Style/StringLiteralsInInterpolation
[skip-stages=Flakey]

auto-corrected

Change-Id: I4a0145abfd50f126669b20f3deaeae8377bac24d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279535
Tested-by: Cody Cutrer <cody@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
2021-11-25 14:03:06 +00:00
Cody Cutrer c302dd8bc1 RuboCop: Style/SymbolArray, Style/WordArray
[skip-stages=Flakey]

auto-corrected

Change-Id: Id187ed60c5590025e780d81b85b5212f51368f27
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279196
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>
Migration-Review: Cody Cutrer <cody@instructure.com>
2021-11-23 14:30:08 +00:00
Cody Cutrer c06809173f RuboCop: Style/UnlessElse
[skip-stages=Flakey]

auto-corrected

Change-Id: I1597544a4bdd6ad202cf1fcfc5d50f254479fcf9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279073
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-11-20 21:08:55 +00:00
Cody Cutrer ecd0798aeb RuboCop: Style grab bag
[skip-stages=Flakey]

see .rubocop.common.yml changes for enabled cops

auto-corrected

Change-Id: Ia63a1c597c58646394b251ce81b707f32828bd4c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/279010
Reviewed-by: Jacob Burroughs <jburroughs@instructure.com>
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
Migration-Review: Cody Cutrer <cody@instructure.com>
2021-11-20 03:04:04 +00:00
Cody Cutrer c6b267e12b RuboCop: Rails/Delegate
auto-corrected, with a bit of manual massaging afterwards if there were
multiple delegations to the same object to combine them into a single
call

Change-Id: Ic93ccad26b037e1f89874d36f9759e5c34435892
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278965
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-11-19 22:42:26 +00:00
Cody Cutrer e905d82fb9 RuboCop: Style/StructInheritance
auto-corrected

Change-Id: Id4fa8fb70832f39635aa2bd1196d87f1c4f5cde8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278957
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-11-19 22:38:42 +00:00
Cody Cutrer 185501719c RuboCop: Style/RaiseArgs
auto-corrected

Change-Id: Ie7f1d2e54bbab1636b5d0a6fbf44f359cfcde712
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278677
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-11-19 22:22:51 +00:00
Cody Cutrer 4d43809cae RuboCop: Style/PercentLiteralDelimiters
[skip-stages=Flakey]

auto-corrected, with a post-review looking for multiline strings
to convert to heredocs

Change-Id: I7f7afb11edd63415cde10866822dd2ac5ba0d8be
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278669
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>
Migration-Review: Cody Cutrer <cody@instructure.com>
2021-11-18 23:05:50 +00:00
Cody Cutrer 294d98c6fd RuboCop: Style/MutableConstant
auto-corrected

Change-Id: Ib1b3c85711578a33014ea90f0662bd46f7b2288b
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278214
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-11-16 16:19:54 +00:00
Cody Cutrer 1ccd29b412 RuboCop: Style/PreferredHashMethods
[skip-stages=Flakey]

auto-corrected for the most part, but I went through specs and used
the have_key matcher when possible

Change-Id: I4a2df1cdd536a94f3b493668386883d1148660c9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/278050
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-11-12 16:24:14 +00:00
Cody Cutrer ba1fdaf2a9 RuboCop: Style/ConditionalAssignment
auto-corrected

Change-Id: Ie87e4c1b6c05bc31ce13481a94c413dcf7b20278
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277964
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-11-11 17:39:06 +00:00
Cody Cutrer 649e5b36a2 RuboCop: Lint/ShadowingOuterLocalVariable
[skip-stages=Flakey]

all manual

Change-Id: Ieb74efcd4206426973dd72eb2ca7c5f5af5167f4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/277394
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-11-04 14:02:24 +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
Cody Cutrer d4d27313fb RuboCop: Lint/UnusedMethodArgument partial
app except for app/models, config

all manual. many cases I removed the unused argument entirely, and
updated callers to not send it

there were also a few "override this method and raise an exception so
you don't use it cause rails is changed" methods that were for old
rails versions that I just removed completely

Change-Id: I071a5a8266801427c5c7a157fefe14850495e620
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/276446
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-21 13:39:12 +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
Cody Cutrer dbd8c46655 RuboCop: Lint
[skip-stages=Flakey]

auto corrections applied:
 * Lint/AmbiguousOperator
 * Lint/AmbiguousOperatorPrecedence
 * Lint/AmbiguousRegexpLiteral
 * Lint/DeprecatedClassMethods
 * Lint/DeprecatedOpenSSLConstant
 * Lint/NonDeterministicRequireOrder
 * Lint/ParenthesesAsGroupedExpression
 * Lint/RedundantRequireStatement
 * Lint/RedundantSafeNavigation
 * Lint/RedundantSplatExpansion
 * Lint/RedundantStringCoercion
 * Lint/RedundantWithIndex
 * Lint/SendWithMixinArgument
 * Lint/SymbolConversion

Change-Id: I222ec19978033544513bb99755994d109435abad
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274551
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-09-29 03:38:23 +00:00
Cody Cutrer 4a960b2c36 RuboCop: Lint/AssignmentInCondition app
Change-Id: I5e8f29cf1caeff1cde169d6058b8d781290b760c
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274580
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-09-28 03:42:36 +00:00
Cody Cutrer 5e3e922307 RuboCop: Layout app
Change-Id: I4cf9600c9636a66509f1ab183b936381ea0aefb4
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274156
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-09-22 19:35:01 +00:00
Simon Williams 3a0276cde4 granularize adding and deleting assignments
closes FOO-2226
flag = granular_permissions_manage_assignments

Split manage_assignments_add and manage_assignments_delete off from the
main manage_assignments permission.

These permissions control more granularity for adding and deleting the
following types of content:
- Assignments
- Assignment Groups
- Quizzes
- Question Banks
- Questions within Question Banks
- Live Assessments

test plan:

[ with the flag off ]
- Smoke test creating, editing and deleting assignments, assignment
  groups, quizzes, and question banks.
- It should all work as before.

[ with the flag on ]
- Create roles that have only the add permission, only the manage
  permission, and only the delete permission.
- With those three roles, as well as with a role with all permission,
  try creating, editing, and deleting assignments, assignment groups,
  quizzes, and quesiton banks.
- It should make sense with the role.

Change-Id: I06505509e55e7ac6c3b5ef1c688ef1353e2045d8
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/271290
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: August Thornton <august@instructure.com>
2021-08-18 22:39:15 +00:00
Eric Saupe edb78a6ced Add important dates checkbox to assignment overrides form
fixes LS-2307, LS-2308, LS-2309
flag=important_dates

test plan:
- Enable important dates site admin flag
- Create or find a C4E subject course
- Create an assignment
- Verify there is a checkbox for important dates under due date form
- Verify the checkbox is disabled if no due dates are set
- Verify the checkbox is enabled if a due date is set on any date
- Save the assignment and verify the checkbox is still checked
- Verify this behavior works in the other places this component is used.
 For example, quizzes, graded discussions, etc.

Change-Id: If2e806a8de764f467bf9ca086740260f2df015d1
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/268061
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Jackson Howe <jackson.howe@instructure.com>
QA-Review: Jackson Howe <jackson.howe@instructure.com>
Product-Review: Eric Saupe <eric.saupe@instructure.com>
2021-07-06 17:36:02 +00:00
Cody Cutrer 0c0e8fac31 add frozen_string_literal_comment to remaining app files
Change-Id: Ib9a170d264ca3ac5acee5147baae9385c9a693f9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/261811
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Rob Orton <rob@instructure.com>
QA-Review: Rob Orton <rob@instructure.com>
Product-Review: Rob Orton <rob@instructure.com>
2021-03-30 17:51:08 +00:00
Wagner Gonçalves 005e90871c part 3: change lookup_id and resource_link_id to UUID datatype
This is part 3 of changing the datatype from varchar to UUID of
lookup_id and resource_link_id from lti_resource_links.

We start to read from the new columns created lookup_uuid and
resource_link_uuid.

Adding a migration to remove the not-null constraint of lookup_id and
resource_link_id columns. As part 3.1 we'll stop writing into these
columns, we need to execute this postdeploy migration at this point.

refs INTEROP-6488
flag=none

test-plan:
* specs should pass;
* you should check if LTI is launching as expected, and if the custom
  params was expanded as expected in all records that were created in the
  part 1 and 2;
* you should be able to new persist custom params, for example you can
  use the RCE editor placement;
* you can follow the test-plan:
    * https://gerrit.instructure.com/c/canvas-lms/+/256029
    * https://gerrit.instructure.com/c/canvas-lms/+/254453

[fsc-timeout=30]

Change-Id: I401f53a82f4dbef66c45932eb2eed8727488313d
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/258246
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Tucker Mcknight <tmcknight@instructure.com>
Reviewed-by: Xander Moffatt <xmoffatt@instructure.com>
Product-Review: Wagner Goncalves <wagner.goncalves@instructure.com>
2021-02-11 18:02:20 +00:00
Mark Neuburger 1d1994eff1 Add disable_timer_autosubmission to Quiz model
Test plan:

1. Ensure that the new migration has run.
    1. Because of 2 existing migrations with future dates, you may need
       to rollback 3 steps before you can run the new migration.
    2. Run `rake db:rollback STEP=3` followed by `rake db:migrate` in
       the web container.
2. Create a new Quiz in the Canvas UI.
3. In the Rails console, verify that the `disable_timer_autosubmission`
   value for this quiz is equal to false:
`Assignment.last.quiz.disable_timer_autosubmission`
4. Update the value to true:
   `Assignment.last.quiz.update_attribute(:disable_timer_autosubmission,
true)`
5. Verify that the value is now equal to `true` using the command in
   step 3.
6. A new Quiz attribute `timer_autosubmit_disabled?` is exposed that
   factors in the feature flag as well. Verify that this value returns
as expected with different combinations of the feature flag and
`disable_timer_autosubmission`.
    1. Read this flag in the Rails console with:
       `Assignment.last.quiz.timer_autosubmit_disabled?`

Refs PFS-15510
Refs PFS-15511
flag=timer_without_autosubmission

Change-Id: I4749bdd46dd06a425141636c41e0f30c0dfc88a9
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/233860
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: James Williams <jamesw@instructure.com>
Reviewed-by: Stephen Kacsmark <skacsmark@instructure.com>
Product-Review: Chad McGuire <cmcguire@instructure.com>
QA-Review: Petra Ashment <pashment@instructure.com>
2020-05-06 14:31:16 +00:00
Han Yan ebbd9ebd63 a new endpoint to return both NQ and Old quiz json
(for N.Q mobile and N.Q Respondus)

closes QUIZ-6788

test plan:
- create old quizzes and new quizzes in Canvas
- /api/v1/course/:course_id/all_quizzes will return json for both
  old quizzes and new quizzes

Change-Id: I98c9a40b4075566a1945e3c46ef7b5dcb1c7dcac
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/218090
Tested-by: Jenkins
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Product-Review: Kevin Dougherty <jdougherty@instructure.com>
Reviewed-by: Stephen Kacsmark <skacsmark@instructure.com>
2019-12-16 19:36:38 +00:00
Han Yan 2706a2af1c align quiz migration behaviors with quiz duplication
closes QUIZ-6791

test plan:
- test the ps with quiz_lti patch
- make sure quiz migration works
  - quiz shell is created
  - quiz shell status is updated when quiz migration is done

Change-Id: Ia002ceb48ded582849301e3efd8631396d9ffe95
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/210548
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Stephen Kacsmark <skacsmark@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Kevin Dougherty <jdougherty@instructure.com>
2019-10-22 22:18:35 +00:00
Marc Phillips 156f742bd8 Add lti11_legacy_user_id to names and roles
closes PLAT-4918

Test Plan:
 - do a nrps launch and see that the response now has the
   lti11_legacy_user_id set to the old user.lti_context_id and,
   if the user was not launched with a 1.1 tool before, has the
   new lti_id as the user_id
 - do a launch with a 1.1 tool before launching with the 1.3 tool
   - note that the user_id and the lti_id are the same

Change-Id: I5aa2229a2ad983989929dfd83f1b7abc3519b002
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/214072
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Jesse Poulos <jpoulos@instructure.com>
2019-10-21 22:27:27 +00:00
Han Yan 6e65e2ef31 move N.Q to Quizzes Page
(flag=newquizzes_on_quiz_page)

- populate N.Q quizzes to assignment quizzes list
- display kebab menu based on quiz types (old quizze and new quizzes)
- items in kebab menu are functional

closes QUIZ-6790, QUIZ-6792, QUIZ-6789, QUIZ-6786

test plan:
- With the newquizzes_on_quiz_page flag disabled
  everything should behave like in production
- With the newquizzes_on_quiz_page flag enabled
  1) N.Q quizzes show up on Quizzes Page
  2) N.Q quiz shells have correct kebab menu
  3) each menu items (delete, duplicate) should work

Change-Id: Ie4a78bb0f0a69f4d6e248135d1c486f1ca0ffe7f
Reviewed-on: https://gerrit.instructure.com/209993
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Stephen Kacsmark <skacsmark@instructure.com>
Reviewed-by: Jon Willesen <jonw+gerrit@instructure.com>
QA-Review: Robin Kuss <rkuss@instructure.com>
Product-Review: Kevin Dougherty III <jdougherty@instructure.com>
2019-10-16 18:20:14 +00:00
Drake Harper 88e41e069a Add asset_name property to asset_accessed event type
Fixes PLAT-4718

Test Plan:
-create an event
-verify asset_name is in body of event

-create a context external tool
-verify asset name is not in body of event

Change-Id: I96d38dfc74b1888aae962e62ee06d025f83ff35b
Reviewed-on: https://gerrit.instructure.com/204268
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Oxana Jurosevic
2019-08-20 15:28:14 +00:00
cfurse 64e5d5c113 Add filename to the asset_accessed payload
Closes PLAT-3849

Test Plan:
- Trigger a live event by download a file from 1 of a few places including:
  1. Your account > Files
  2. Course > Files
- Verify an asset_accessed event is created and includes 2 new fields:
  (filename & display_name)

Change-Id: I9c0ca7c21b373250ed69c025da59d6057a598c87
Reviewed-on: https://gerrit.instructure.com/197857
Tested-by: Jenkins
QA-Review: Marc Phillips <mphillips@instructure.com>
Product-Review: Oxana Jurosevic
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Marc Phillips <mphillips@instructure.com>
2019-06-25 16:17:25 +00:00
Marc Phillips f0089b2346 Add line_item extensions to line_item json
refs PLAT-4486

Test Plan:
 - create a line_item with the extension defined, should show up
   in the retrieval of that line_item

Change-Id: Ia379329dc3509c4d91b81d6e218afb9add7d9dc7
Reviewed-on: https://gerrit.instructure.com/198547
Tested-by: Jenkins
QA-Review: Marc Phillips <mphillips@instructure.com>
Product-Review: Marc Phillips <mphillips@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
2019-06-21 19:26:43 +00:00
Clint Furse 4e2c4c6572 Add Submission URL when creating submission via AGS
closes PLAT-4486

Test Plan:
- Update a Score on a LineItem via an LTI tool
  and include a submissionUrl
- make sure both the Submission and Result reflect the new URL
- also try to submit URL without a grade

Change-Id: I4c92fc86bee28a9ffc2599108a417c46a20cf532
Reviewed-on: https://gerrit.instructure.com/198401
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Marc Phillips <mphillips@instructure.com>
2019-06-21 15:45:41 +00:00
wdransfield 1d7b8de179 Add LTI tool data to external tool asset accessed events
Closes PLAT-4442

Test Plan:
- Launch an external tool that has a url, domain, and name
- Verify these fields are included in the asset accessed
  event that is sent
- Verify other asset accessed event bodies remain unchanged

Change-Id: Ia728a784b01cc640a8619fa05ca01acae2e918b7
Reviewed-on: https://gerrit.instructure.com/197694
Tested-by: Jenkins
Reviewed-by: Drake Harper <dharper@instructure.com>
Reviewed-by: Clint Furse <cfurse@instructure.com>
Reviewed-by: Marc Phillips <mphillips@instructure.com>
QA-Review: Brent Burgoyne <bburgoyne@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2019-06-18 16:11:20 +00:00
Marc Phillips 273889d6f3 Remove N+1 on NRPS calls
Variable Expansion for sis_ids was causing an n+1 because
the lookup for the pseudonym didn't take into account if
the pseudonyms were preloaded.

Because of this, several other expansions would have produced
n+1s, so all known n+1 scenarios have been fixed.

fixes PLAT-4241

Test Plan:
 tests pass

Change-Id: Ib39068e8e5f1e17a0963443148438b1d16287526
Reviewed-on: https://gerrit.instructure.com/195731
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Marc Phillips <mphillips@instructure.com>
Product-Review: Marc Phillips <mphillips@instructure.com>
2019-05-30 19:04:14 +00:00
Drake Harper fbdfc2c859 Use past lti id if present
fixes PLAT-4481

Test Plan:
-Create 3 courses
-Create 2 users
-Enroll user 1 in courses 1 and 2
-Merge users
-Enroll user 2 in course 3
-Check to see user ids are different

Change-Id: I9da709285f8fdbaab238f1f1c8ceb127a748de11
Reviewed-on: https://gerrit.instructure.com/193535
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Jesse Poulos <jpoulos@instructure.com>
2019-05-15 17:05:13 +00:00
Marc Phillips 18d9d2be9e Fix user_id in nrps calls
NRPS calls were sending the wrong user_id, now
will send the lti_id instead of the lti_context_id.

fixes PLAT-4402

Test Plan:

- Do a nrps call, note that the user_id is the lti_id of the users

Change-Id: I32950c7b73ff4448426ff0c0a38ecd60e410eebf
Reviewed-on: https://gerrit.instructure.com/191728
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Marc Phillips <mphillips@instructure.com>
2019-05-02 21:54:37 +00:00
Marc Phillips fa3dfcb3d6 Add lti-advantage gem validation
Call the message validations on the lti messages
before we send the launch.

closes PLAT-4117

Test Plan:
 - do a launch, it should still work

Change-Id: I34d20c328173158c76b11aacf7028f7eb152f87b
Reviewed-on: https://gerrit.instructure.com/185216
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: Marc Phillips <mphillips@instructure.com>
Product-Review: Marc Phillips <mphillips@instructure.com>
2019-03-15 15:56:34 +00:00
James Williams 2b2fb98cfc change how context is called in quiz serializer
i can't reproduce the errors but maybe changing it from
the def_delegators weirdness will magically fix it or
at least make it easier to track down

refs #QO-435

Change-Id: Ia286fc3a4556715048dfe5620afd154fff18fcfe
Reviewed-on: https://gerrit.instructure.com/184154
Reviewed-by: Cody Cutrer <cody@instructure.com>
Reviewed-by: Aaron Griffin <agriffin@instructure.com>
Tested-by: Jenkins
QA-Review: Cody Cutrer <cody@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2019-03-07 17:39:53 +00:00
wdransfield 219bb96d45 Send lti_id in serialized AGS result
Closes PLAT-4158

Test Plan:
Use the index and show endpoint of the result service to
verify the result contains the lti_id of the user rather
than the Canvas id.

Change-Id: I0ab8fc2d8b3923a6a11d2a88f3a6cea127a94f0b
Reviewed-on: https://gerrit.instructure.com/178486
Tested-by: Jenkins
Reviewed-by: Marc Phillips <mphillips@instructure.com>
QA-Review: Marc Phillips <mphillips@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2019-01-18 18:29:46 +00:00
Marc Phillips ed6dffe18c Fix ags service bugs
refs PLAT-4082

Test Plan:
 - Run through creation of lineitems, retrieving them, making
   scores, and retrieving results. They should all work now.

Change-Id: I2b045ddcfd11092509a51af2cd2b0d43819e709f
Reviewed-on: https://gerrit.instructure.com/177115
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Marc Phillips <mphillips@instructure.com>
2019-01-08 21:41:25 +00:00
Marc Phillips f2f369c768 Fixup ags to work with spec and original design
closes PLAT-4030

Test Plan:
 - AGS should work with test tool
  - install the test tool and make an assignment
    out of it
  - use the tool to return a line item and scores
    and results and such
  - also, from teh tool, create a new line item
    and do the results and scores and such

Change-Id: I4f1a6bab561e10d38158748626cf94ec61d8916f
Reviewed-on: https://gerrit.instructure.com/174095
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: Weston Dransfield <wdransfield@instructure.com>
Tested-by: Jenkins
Product-Review: Marc Phillips <mphillips@instructure.com>
2018-12-11 21:21:30 +00:00
wdransfield ae2c958676 Fix first-time render issues with LTI keys
Fixes PLAT-3924

Test Plan:
- Create a new LTI key
- Without refreshing the page verify the following:
  * toggling the "on/off" switch works
  * the global id of the key is displayed
  * the key's secret is available

Change-Id: I1cde9db31ecf8315a7814633d398364acea0a45f
Reviewed-on: https://gerrit.instructure.com/170184
Tested-by: Jenkins
QA-Review: Marc Phillips <mphillips@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Marc Phillips <mphillips@instructure.com>
2018-10-30 21:50:35 +00:00
Dan McCallum 811d30a96f Render top-level `message` claims in NRPS v2 responses
- Adds support for outputting two top-level claims
  in the NRPS v2 per-member `message` array element:
    - `https://www.instructure.com/canvas_user_id`
    - `https://www.instructure.com/canvas_user_login_id`
  - While the `picture` claim is not included here, it
  _is_ normally included in a LTI 1.3 launch request, but
  with a different lookup mechanims than what NRPS v2 had
  been using prevously (`User.avatar_url` rather than
  `User.avatar_image_url`). So for launch<->NRPS parity,
  the latter has been changed to match the former.
  - Since we now need to whitelist the "public" claim
  group, we needed a way to exclude the `role_scope_mentor`
  claimn because it results in a N+1. So that claim was promoted
  to its own group.
  - Since claim groups were being re-organized, took the
  opportunity to expanded claim group tests to verify
  `privacy_level` enforcement.

References LTIA-41

Test Plan

  - Place a LTI 1.3-enabled tool in a `Course` with several
  active members.
  - Invoke the NRPS v2 service for that tool and `Course`.
  - Verify correct rendering of the `picture` field in `members`
  elements.
  - Verify correct rendering of
  `https://www.instructure.com/canvas_user_id` and
  `https://www.instructure.com/canvas_user_login_id` top-level
  claims in each `member`'s `message` array element.
  - Adjust the tool's `privacy_policy` to be non-`public`, verify
  that neither `https://www.instructure.com/canvas_user_id` and
  `https://www.instructure.com/canvas_user_login_id` claim
  renders.

Change-Id: Ic3f306591214dd25815e8e4acc6f5c8d3d3aafac
Reviewed-on: https://gerrit.instructure.com/169525
Tested-by: Jenkins
Product-Review: Karl Lloyd <karl@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Marc Phillips <mphillips@instructure.com>
QA-Review: Bill Smith <bsmith@instructure.com>
2018-10-26 21:44:00 +00:00
Dan McCallum 9b44f895f7 Consolidate NRPS `message` serialization rules
- Previously custom param rules were in `MembershipsProvider`
  and claim group rules were in `NamesAndRolesSerializer`. Now
  they're all in the latter.
  - Also moved `privacy_level` enforcement into
  `NamesAndRolesSerializer` since that involves rendering of
  one special custom param and all custom param config had
  been moved into that class. This obviated the need for
  `UserDecorator`, which is now completely removed.
  - Simplified LTI message matchers significantly by accepting
  an `opts` hash. So now we're back to just two top-level
  code paths through those matchers... one for groups and one
  for courses. Previously each of those had an alternate path
  for `rlid` matching rules.

References LTIA-41

Test Plan:

  - This is purely a technical refactoring. No behavioral difference
  should be observable.
  - To guard against regressions, repeat selections from:
    - LTIA-41 tests to verify correct rendering of custom params when
    the `rlid` query param is present
    - LTIA-13/19 tests to verify correct enforcement of tool
    `privacy_level`
    - LTIA-24/34 tests to verify correct rendering of the
    `lis_person_sourcedid` field.

Change-Id: If07e3886eeb069379b01282686133517446f9f4b
Reviewed-on: https://gerrit.instructure.com/169495
Tested-by: Jenkins
Product-Review: Karl Lloyd <karl@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Marc Phillips <mphillips@instructure.com>
QA-Review: Bill Smith <bsmith@instructure.com>
2018-10-26 21:43:47 +00:00
Dan McCallum bf7ec2080e Render 'analytics' URLs in NRPS v2 responses
- Expands the `Canvas.xapi.url` and `Caliper.url` custom params into
  the per-`member` `message` array in NRPS v2 responses.
  - The custom param expansion itself was already present and did not
  introduce any N+1s so patch is relatively simple. Biggest change
  is that the `VariableExpander` needs to be given 'unwrapped'
  AR entities since it does `is_a?` checks, especially on the context.

Refs LTIA-41

Test Plan:

  - Confgure a LTI 1.3/Advantage tool with the
  `$Canvas.xapi.url` and `$Caliper.url` custom params.
  - Place that tool into a `Course` with active members
  - Request NRPS v2 for that `Course`, specifying the course's LTI ID
  as the value of the `rlid` query parameter.
  - Verify that, for all active `Course` members, the expanded
  `$Canvas.xapi.url` and `$Caliper.url` params have the following form:
    - xAPI: `<base>/api/lti/v1/xapi/:tool_id-:user_id-:course_id-:timestamp-:nonce-:signature`
    - Caliper: `<base>/api/lti/v1/caliper/:tool_id-:user_id-:course_id-:timestamp-:nonce-:signature`

Change-Id: I50f1e0470db29edba919cb48342d1b0d6ba0162d
Reviewed-on: https://gerrit.instructure.com/169381
Tested-by: Jenkins
Product-Review: Karl Lloyd <karl@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Marc Phillips <mphillips@instructure.com>
QA-Review: Bill Smith <bsmith@instructure.com>
2018-10-26 21:43:30 +00:00
Dan McCallum 479090b947 Render user timezone preference in NRPS v2 responses
- Expands the `Person.address.timezone` custom param into
  the per-`member` `message` array in NRPS v2 responses.
  - The custom param expansion itself was already present but,
  since we're rendering multiple users, the implementation
  required the same trick as `$Message.locale` where we
  temporarily set the time zone to match the current user,
  then un-set back to the previous value after the user finishes
  rendering.
  - Also fix an typo in the nearby `$vnd.Canvas.Person.email.sis`
  test setup.

Refs LTIA-41

Test Plan:

  - Confgure a LTI 1.3/Advantage tool with the
  `$Person.address.timezone` custom param.
  - Place that tool into a `Course` with active members where at least
  one member has a non-standard time zone preference.
  - Request NRPS v2 for that `Course`, specifying the course's LTI ID
  as the value of the `rlid` query parameter.
  - Verify that, for all active `Course` members, the expanded
  `$Person.address.timezone` custom param in the per-`member` NRPS v2
  `message` array has the same value as the `member`'s time zone
  preference or else the account default.

Change-Id: Ia701e5aa9021b54d42b830da61f41dd977db6b87
Reviewed-on: https://gerrit.instructure.com/169332
Tested-by: Jenkins
Product-Review: Karl Lloyd <karl@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Marc Phillips <mphillips@instructure.com>
QA-Review: Bill Smith <bsmith@instructure.com>
2018-10-26 21:42:48 +00:00