Commit Graph

16 Commits

Author SHA1 Message Date
Andrew Butterfield 11e63cf644 Add LTI Assignments API
fixes PLAT-2919

Test plan:
* Validate API documentation at /doc/api/plagiarism_detection_platform_assignments.html
* Using an LTI 2.0 AccessToken access the /api/lti/assignments/:assignment_id
  endpoint
* You can also test differentiated assignments by supplying a user_id
  query parameter
* You should be able to use both native canvas ids and lti ids for both
  the assignment_id url parameter and the user_id query parameter

Change-Id: I37d1951a528e9c484f9a7e3030ae9b767a247876
Reviewed-on: https://gerrit.instructure.com/133276
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Tested-by: Jenkins
Product-Review: Andrew Butterfield <abutterfield@instructure.com>
2017-11-20 18:14:36 +00:00
Andrew Butterfield 6d9aae54b0 Change references to grade_changed event to grade_change event
fixes PLAT-2867

Test plan:
* Ensure documentation is correct for both live events and lti
  capabilities
* Ensure grade_change capability works for LTI 2 tools

Change-Id: I68c381883a9feb50f2f3705f1aa0f122db766e61
Reviewed-on: https://gerrit.instructure.com/130067
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Andrew Butterfield <abutterfield@instructure.com>
2017-10-19 14:28:17 +00:00
wdransfield 4820e9f8fb LTI User show endpoint
Closes PLAT-2819

Test Plan:
- Create a tool consumer profile associated with a
  developer key that uses the newly added `vnd.Cavnas.User`
  service.
- Install a plagiarism detection tool that uses the
  new `vnd.Cavnas.User` service.
- Create an assignment in a course with students and
  associate it with the tool.
- Make a request to `/api/lti/users/:user_id` with
  the id of one of the students and no access token.
  verify that you get a 401
- Make the same request but this time include an
  access token. Verify the student details is returned.
- Make the same request but use the user's `lti_context_id`.
  Verify that the user details is still returned.
- Remove the tool from the assignment and save the change.
- Make the same request and verify a 401 is returned.
- Verify the behaviors outlined above work when the tool
  is installed in a course, account, and root account.

Change-Id: I81bd1446729d194f7f3910bca05638e57e5091d1
Reviewed-on: https://gerrit.instructure.com/126931
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: August Thornton <august@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-09-28 15:41:12 +00:00
wdransfield 55fce28b93 Add submisson, attachment, and report id variable expansions
Closes PLAT-2688

Test Plan:
- Install an plagiarism detection tool that uses
  LTI launches for displaying originality reports.
  The message handler for these launches should have
  com.instructure.OriginalityReport.id,
  com.instructure.Submission.id,
  and com.instructure.File.id in it's enabled
  capability array.
- Create an originality report with the tool and
  launch the originality report.
- Verify that parameters for each of these three
  capabilities are send and set correctly.

Change-Id: I2cb246e3a48f5e63a60ff6a0d90a003aaf9c8d62
Reviewed-on: https://gerrit.instructure.com/116377
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-07-05 18:49:40 +00:00
Nathan Mills 31acbd956a lti2 cert fixes
refs PLAT-2640

test plan:
we should be able to pass certification

Change-Id: I4508af544e1dcacec42180d96865e7ef841c8ff8
Reviewed-on: https://gerrit.instructure.com/116171
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2017-06-22 17:27:38 +00:00
August Thornton 46aba8f91e remove enabled capabilities assignment_submitted from TCP
closes PLAT-2636

test plan:
• request TCP from Canvas tool consumer during LTI 2
  registration.
• verify enabled capabilities "assignment_submitted"
  is not advertised for course or account context.

Change-Id: I113b3b0f2a7e77230539247644b446f112a55039
Reviewed-on: https://gerrit.instructure.com/115260
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Product-Review: August Thornton <august@instructure.com>
QA-Review: August Thornton <august@instructure.com>
2017-06-13 17:39:37 +00:00
wdransfield 233d53dcc0 Send all available variable substitutions in TCP
Closes PLAT-2606

Test Plan:
- Install an LTI2 tool and verify
  that the tool consumer profile now contains
  all variable expansions in the enabled capability
  section.
- Include these capabilities as parameters, do a
  launch, and verify that the applicable expansions
  are replaced.

Change-Id: Ia97f0184c94eeeb33c5851c715770f209a21c3c2
Reviewed-on: https://gerrit.instructure.com/113014
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-06-12 19:13:03 +00:00
wdransfield 23f9078ec9 Set assignment for message handler lookup launches
Closes PLAT-2583

Test Plan
- Create an originality report that uses an LTI
  launch for viewing reports. The message handler
  that is launched for this purpose should use the
  'Canvas.assignment.id' custom parameter
  subsitution.
- view the originality report and verify that
  the assignment id is sent in the launch.

Change-Id: I2356189747d5a49567430f7190c2a4c53659425f
Reviewed-on: https://gerrit.instructure.com/112806
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-06-12 19:01:42 +00:00
Andrew Butterfield 4680a3aa0b Allow subscriptions on root_account
fixes PLAT-2570, PLAT-2571

Test plan:
* Using the LTI api, attempt to create a subscription for a root account
* Verify that it lets you
* Using the LTI api, attempt to create a subscription for an assignment
* Verify that it lets you
* Using the LTI api, attempt to create a subscription for a course
* Verify that it does not let you
* Also verify that the webhook grant all capability looks like this
  vnd.instructure.webhooks.root_account.all

Change-Id: Iac665b0c998e5817c57c21e7e4f5cca9303204f2
Reviewed-on: https://gerrit.instructure.com/111126
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Andrew Butterfield <abutterfield@instructure.com>
2017-05-09 22:28:55 +00:00
Landon Wilkins ba2daaf158 da licença part 13
add consistent license headers to all source files
(ruby, coffeescript, javascript)

except for vendor files

Change-Id: I120ddb74d7f2a34153334b01d3ce2fb77000a631
Reviewed-on: https://gerrit.instructure.com/110034
Tested-by: Jenkins
Reviewed-by: Jon Jensen <jon@instructure.com>
Product-Review: Jon Jensen <jon@instructure.com>
QA-Review: Jon Jensen <jon@instructure.com>
2017-04-27 21:51:17 +00:00
wdransfield 9680612d46 Add submisison lti api to restricted capabilities
Closes PLAT-2510

Test Plan:
Verify Lti::ToolConsumerProfile::RESTRICTED_SERVICES includes
the submision services from the lti submission api controller.

Change-Id: I4012f7fedbf2cf37dbbd207341eb23bce55374b7
Reviewed-on: https://gerrit.instructure.com/108856
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-04-19 18:01:36 +00:00
wdransfield 3a78258abf Auto subscribe to submission_updated subscription
Closes PLAT-2343

Test Plan:
- Associate a similarity detection tool with an assignment
- Verify the subscription created includes the
  'submission_updated' event type

Change-Id: I337c0c57747aa4b465acc7dbe6640618435a12b1
Reviewed-on: https://gerrit.instructure.com/106498
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-03-28 20:49:41 +00:00
wdransfield d6f4a9dec1 Plagiarism resubmit event type
Closes PLAT-2404, PLAT-1910

Test Plan:
- Create an assignment associated with a similarity
  detection tool.
- Verify that a subscription with the
  'submission_created' and 'plagiarism_resubmit'
  event types is created in Dynamo.
- Create an assignment of type online upload
- As a student submit a document for the assignment
  submission.
- Create an originality report for the submission with
  the workflow state set to 'error'
- Navigate to the submission in speed grader and
  click the resubmit to TII button.
- Verify canvas emits a 'plagiarism_resubmit'
  event
- Verify you can create/manage subscriptions of this new
  type via the subscriptions api (See https://docs.google.com/
  document/d/12x6Peif-I-0zvl2uMv2JVbQdZumGGqMtspWKYTqlL9o/edit)

Change-Id: Ia9eff1c61bf0b5662e0b6bc1d088026afd03e8af
Reviewed-on: https://gerrit.instructure.com/106187
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-03-28 19:13:55 +00:00
wdransfield 0d32c11ceb Auto create subscription for tools associated with assignment
Test Plan:
- Verify the 'Canvas.placements.similarityDetection' capability
  no longer appears on the default TCP.
- Verify adding the 'restricted_capabilities' to a custom TCP
  allows you to see this placement.
- Install two LTI2 tools with the similarity detection
  placement and a service offered with an endpoint specified
  and an @id that ends with 'SubmissionEvent' (see
  github.com/westonkd/lti-test-tool/blob/master/config/toolProxy.js
  for an example.
- Create a new assignment using one of the two tools
  as the associated plagiarism detection tool.
- Verify a subscription is created for the tool with
  the following values set:
      ContextType: 'assignment'
      Format: 'live-event'
      ContextId: <id of assignment>
      EventTypes: ['submission_created']
      TransportType: 'https'
      TransportMetadata:{Url: <endpoint of the
                         submission event servce>}
- Edit the assignment just created and only change the name
- Verify another subscription is not created
- Edit the assignment and switch the plagiarism tool to the
  second tool.
- Verify a subscription is created
- Create an assignment with no plagiarism tool
- Verify a subscription is not created
- Install a tool with the same 'SubmissionEvent' service in
  the tool profile, but change the 'action' array to only
  inlcude a 'GET'.
- Attempt to associate an assignment with this newly installed
  tool and verify a error flash message is displayed

Closes PLAT-2287

Change-Id: Ic20afbdb52c6b70d341a7b987345b4768bd0ab45
Reviewed-on: https://gerrit.instructure.com/103851
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Reviewed-by: Cody Cutrer <cody@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-03-10 13:45:51 +00:00
wdransfield dbcc163759 LTI2 API webhook subscription service
Fixes: PLAT-2129 PLAT-2126

Test Plan:
- Verify you can create and retrieve a TCP
  with the new subscription service and
  capabilities.
- Install an LTI2 tool using the split secret
  capability. The tool's security contract
  should use the new webhook service.

   Example security contract:
   "tp_half_shared_secret"=>
	"873f5...",
   "tool_service"=>
	[{"@type"=>"RestServiceProfile",
    	 "service"=>"vnd.Canvas.webhooksSubscription",
    	 "action"=>["GET", "POST"]}]}

- Do a POST request to /api/lti/subscriptions with the
  following body:

  {
   "subscription":{
      "EventTypes":[
         "submission_created"
      ],
      "ContextType":"course",
      "ContextId":<valid course id here>,
      "Format":"live-event",
      "TransportType":"sqs",
      "TransportMetadata":{
         "Url":"http://sqs.docker"
      }
    }
   }
- Verify a 401 is returned
- Using https://docs.google.com/document/d
  /12x6Peif-I-0zvl2uMv2JVbQdZumGGqMtspWKYTqlL9o/edit
  attempt to create each subscription type (in bold)
  and verify 401s are returned in each case.
- Using the same document, verify that adding one of
  the capabilities listed under a subscription types
  allows you to create the subscription
- Verify that using the vnd.instructure.webhooks.root_account.all
  capability allows you to create any subscription.
- Install an LTI2 tool in a course
- Attempt to create a subscription in another course and
  verify a 401 is given.

Change-Id: I322e4bb2c49209afdc6f0a3c3a8b5c73e339996e
Reviewed-on: https://gerrit.instructure.com/102272
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-03-02 16:01:10 +00:00
Nathan Mills b5b157bd34 add tool_consumer_profile table
fixes PLAT-2243 PLAT-2244 PLAT-2224

test plan:

-from a rails console create a ToolConsumerProfile associated to a
developer key with custom capabilites and services
-request the TCP using the developer key
-it should include the custom capabilites and services

-request a TCP without dev credentials
- it should work as before

-install a LTI2 tool using custom services and capabilities
-it should install

-install an LTI2 tool the normal way
-it should still work

Change-Id: Icbbab37737ba1b4c621caadb15fec79ad8ac5776
Reviewed-on: https://gerrit.instructure.com/101673
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2017-02-22 23:08:38 +00:00