Commit Graph

106 Commits

Author SHA1 Message Date
wdransfield 7464d9fb31 Handle multiple tool on the page when resizing
Closes PLAT-2738

Test Plan:
- Install two lti tools that use the new
  'com.instructure.PostMessageToken' variable expansion.
- Visit a page with two LTI tools launched (this happens when
  launching a tool in a course that has chat enabled).
- Have one tool send a resize post message and verify the correct
  tool is resized. The post message should include the token
  for the value of 'token':

  <script type="text/javascript">
   parent.postMessage({
      subject: 'lti.frameResize',
      height: 12000,
      token: '<%= @wrapper_id %>'
   }, '*');
  </script>

- Verify the proper tool is resized.

Change-Id: Ie7e976c5cd53ef5c61cd86c471ba416045a0fb68
Reviewed-on: https://gerrit.instructure.com/119858
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
Tested-by: Jenkins
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-08-18 16:30:28 +00:00
wdransfield c1e2c199b4 Add com.instructure.Assignment.lti.id variable expansion
Closes PLAT-2715

Test Plan:
- Verify the default tool consumer profile contains
  the com.instructure.Assignment.lti.id capability.
- Install a plagiarism detection tool that uses an
  LTI launch for display originality reports. The
  message in the resource handler associated with
  the originality report launch should have the
  com.instructure.Assignment.lti.id enabled. The
  message associated with the
  `Canvas.placements.similarityDetection` capability
  should also have the the new capability enabled.
- Associated the tool with an assignment. Verify that
  a parameter named com_instructure_assignment_lti_id
  is sent in the launch from the create/edit UI. Its
  value should match the ext_lti_assignment_id param.
- Create an originality report and do the associated
  tool launch.
- Verify a com_instructure_assignment_lti_id parameter
  is sent. The value should match the ext_lti_assignment_id
  sent in the assignment creattion config launch.

Change-Id: I722dd16a6cc5e62a447f76f10e9f0f582a11a33a
Reviewed-on: https://gerrit.instructure.com/119029
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-07-17 15:25:19 +00:00
wdransfield 2c0bfb9efb Add Context.title variable expansion
Closes PLAT-2699

Test Plan:
- Add an LTI2 tool that uses `Context.title` in one of its
  message's enabled_capability array.
- Launch the tool from a course and verify that the `context_title`
  param is set to the name of the course.
- Launch the tool from an account and verify that the `context_title`
  param is set to the name of the account.

Change-Id: I6e734b36022bbd3e7f4ab2dc920271ea8da6df71
Reviewed-on: https://gerrit.instructure.com/117863
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-07-07 21:12:50 +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
wdransfield 683aab7790 Varaible expansions for LTI2 service endpoints
Closes PLAT-2690

Test Plan:
- Test the following variable substitutions. Each should get set
  to their corresponding service URL (the endpoint of the each
  service can be found in the tool consumer profile or in each
  lti api controller).

Change-Id: I37f756cabd0e38e7ea850cdfff7c37e4b8886a85
Reviewed-on: https://gerrit.instructure.com/116480
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-06-29 13:30:27 +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
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
Brad Humphrey 1339a8d126 Merge branch 'dev/platform/content-item' into HEAD
test plan:
This commit adds privacy level contro to content item selection requests
for the following fields:
  lis_person_contact_email_primary, lis_person_name_given,
  lis_person_name_full, lis_person_name_family, lis_person_sourcedid,
  lis_course_offering_sourcedid, and context_label

These fields should appear for the same privacy levels as they do for a
basic lti launch.  If the same tool is used in both a basic lti launch request
and a content item selection request, the above fields should either be
present on both launches or absent on both launches (depending on the
privacy level currently selected for the tool).

This commit also refactors how content item selection launches are
constructed, so it would be good to run a basic regression test on
content item selection launches in general.

fixes PLAT-2447

Change-Id: If55e9c84b3ddd91bdf700a8bbbb02d8f9a7e6e1f
2017-05-15 13:30:25 -06:00
wdransfield d44bc1a82d Add privacy level dependant params to content item
closes PLAT-2447

Test Plan:
Verify the following parameters are sent in all
content item selection requests when the tool is
set to the specified privacy level:

* Privacy Level: 'Name Only'
  - lis_person_name_given
  - lis_person_name_family
  - lis_person_name_full

* Privacy Level: 'Email-only'
  - lis_person_contact_email_primary'

* Privacy Level: 'Public'
  - lis_course_offering_sourcedid (must be LTI course)
  - All params in email only and name only

* Privacy Level: 'Anonymous'
 - None of the above params

Change-Id: I0794501e8a112fd910f35c1b93606e54fd0d2a19
Reviewed-on: https://gerrit.instructure.com/110966
Tested-by: Jenkins
Reviewed-by: Brad Humphrey <brad@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
QA-Review: Brad Humphrey <brad@instructure.com>
2017-05-12 22:12:31 +00:00
wdransfield 1c406af7b7 Send context_label in content item selection request
closes PLAT-2445

Test Plan:
Do a content item selection request and verify the 'context_label'
param is present and set the the course code.

Change-Id: I2e92aec4605c79a919b73fd164dc6ad9df14df37
Reviewed-on: https://gerrit.instructure.com/110696
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
2017-05-12 22:11:12 +00:00
Han Yan 4479502973 add uuid as custom field as part of lti launch payload
closes QUIZ-1705

test plan:
- we should see custom_canvas_course_uuid field in lauch parameter set

Change-Id: If5385d34003f22c4b9ade63e56aa5adfaf6a93c8
Reviewed-on: https://gerrit.instructure.com/110480
Tested-by: Jenkins
Reviewed-by: John Corrigan <jcorrigan@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: John Corrigan <jcorrigan@instructure.com>
2017-05-11 18:04:05 +00:00
Cody Cutrer 99f5b454ed refactor and unify User#find_pseudonym_for_account and SisPseudonym
fixes CNVS-35919

also, prefer SIS pseudonyms over non-SIS pseudonyms from any given
account

test plan:
 * have a non-SIS pseudonym and a SIS pseudonym on a user
 * do an LTI launch
 * the LTI tool should get the info from the SIS pseudonym

Change-Id: I60a3c48a32eae94db93b0e72f1f0f6c5b6a5f5c2
Reviewed-on: https://gerrit.instructure.com/107785
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Reviewed-by: Tyler Pickett <tpickett@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Tested-by: Jenkins
Product-Review: Cody Cutrer <cody@instructure.com>
2017-05-02 18:50:31 +00:00
Landon Wilkins d198a52517 da licença part 31
add consistent license headers to all source files
(ruby, coffeescript, javascript)

except for vendor files

Change-Id: I7b353d1ec31c36c0b12df7feb09fff743dc8a985
Reviewed-on: https://gerrit.instructure.com/110056
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:59:58 +00:00
wdransfield 825ac340ba Update ToolProxyBinding.memberships.url docs
Closes PLAT-2419

Test Plan:
Generate documentation and verify the
ToolProxyBinding.memberships.url variable substitution
has a note about being for future use.

Change-Id: If380aa043da8249e5d5237e73c24692284d9ca21
Reviewed-on: https://gerrit.instructure.com/106668
Tested-by: Jenkins
Reviewed-by: August Thornton <august@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2017-03-29 14:45:08 +00:00
Brad Horrocks bbfe35b108 update variable expanders
Add docs on how to update them
Update everytime we run doc:api

Change-Id: I3c7aa55d051fa5474e267897138ab01c3c7c3fb8
Reviewed-on: https://gerrit.instructure.com/102177
Reviewed-by: Jesse Poulos <jpoulos@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Product-Review: Brad Horrocks <bhorrocks@instructure.com>
2017-02-27 23:15:19 +00:00
Nathan Mills 4ecc648078 add lti option to prefer sis email
fixes PLAT-2324

test plan:

output to test:
 the lti message parameters :
   `lis_person_contact_email_primary`
  variable expansions:
   `Person.email.primary`
   `vnd.Canvas.Person.email.sis`

- test that the above outputs behaviour hasn't changed
- add <lticm:property name="prefer_sis_email">true</lticm:property>
to the extension settings portion of the xml config
- make sure you don't have an sis email
- the behavior shouldn't change
- set an sis email address
- you should now get the sis email for
`lis_person_contact_email_primary`

- test that the behaviour of `vnd.Canvas.Person.email.sis` hasn't
changed

Change-Id: Iaca2e036170ed1173309fd4596a4d6e1b016b6dd
Reviewed-on: https://gerrit.instructure.com/103195
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2017-02-27 17:57:23 +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
Brad Humphrey 9fad40e8de add variable expansion for getting uuid on root accounts
test plan
 - add a custom variable expansion for $vnd.Canvas.root_account.global_id
  * it should be substituted for root_account.uuid in any LTI launch
 - the capability vnd.Canvas.root_account.global_id should appear in the
   tool consumer profile
 - install an LTI 2 tool that requests the capability
   vnd.Canvas.root_account.global_id
  * launches should come with
    vnd_canvas_root_account_id=<root_account.uuid>

fixes PLAT-2267

Change-Id: I23be140c22c0edd8e20460f648c51cc570a45e80
Reviewed-on: https://gerrit.instructure.com/102077
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
2017-02-15 19:19:31 +00:00
wdransfield 5304c98661 LTI2 only send Context.id when requested
Fixes PLAT-2246

Test Plan:
- Install an lti2 tool without
  the 'Context.id' capability
  enabled.
- Launch the tool and verify that
  the context_id param is absent.
- Install an lti2 tool with the
  'Context.id' capability
- Launch the tool and verify that
  the context_id param is present.
- Verify the Context.id capability
  is preseint in the TCP.

Change-Id: I164f2ca675d77c9ad743d0dad0f8d4ee7364444c
Reviewed-on: https://gerrit.instructure.com/101478
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-02-13 20:11:27 +00:00
wdransfield adff709f9d Add variable substitution capabilities to TCP
Fixes PLAT-2235

Test Plan:
- Get the Canvas TCP and verify it contains all
  capabilities listed in lib/lti/capabilities_helper.rb:3
  in its capability_offered section.
- Install an LTI2 tool, launch it, and verify
  none of the following parameters are sent in
  the launch:
  * launch_presentation_document_target
  * launch_presentation_locale
  * tool_consumer_instance_guid
  * lis_course_section_sourcedid
  * roles
  * lis_person_sourcedid
 - Each of the above params now have an associated
   capability offered by Canvas. If a TP wants
   one of the above parameters sent in their
   tool launch they must include the associated
   capability in their enabled_capability section
   of the tool proxy.

   Verify adding the associated capability in the
   tool profile causes the paramter to be sent
   in the tool launch. See variable_expander.rb
   docs for a mapping of capabilities to
   variable names

Change-Id: I027d079d9d3cf53715fcf8ca4d9d8759af02cb88
Reviewed-on: https://gerrit.instructure.com/101336
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-02-13 17:33:17 +00:00
Anti Revoluzzer 139fcc1949 Add Canvas.course.name LTI substitution
Fixes: SIS-2719

Test Plan:

1. Tests pass

2. Install a tool that has a placement in the context of a course

3. Include the following custom variable in the xml config
   course_name=$Canvas.course.name

4. Ensure that on launch the variable is properly expanded to the
   name of the course

Change-Id: I0bea24f4986aa9985f4c4f2117ca985b1ac3da15
Reviewed-on: https://gerrit.instructure.com/100812
Tested-by: Jenkins
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: Mark McDermott <mmcdermott@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
2017-02-09 03:59:42 +00:00
Jesse Poulos f8119abfe9 add custom variable for institution assigned (i.e. sis) email
Before this fix, there was not a way to determine the launching users sis
added email address without accessing API. This causes pain for some
integrations that relied on the lis_person_sourced_id since that value can
change if the user changes their default email (i.e. stars a different email).
This update adds a way to send the users institution assigned email during an
LTI launch.

Test plan:
1) create a course
2) create a user and enroll them in the course
3) create another user via SIS and enroll them in the course
4) install a tool with the $Person.email.sis custom field
5) launch the tool as each user added in 2 and 3
6) verify that
      1) the default value of "$Person.email.sis" is passed in
      the launch parameters for the user that *was not* added via SIS and
      2) the value of the email assigned to the user that *was* added via SIS is
      passed in the launch

Fixes PLAT-2164

Change-Id: Ibbc15c8a3108d51aac680f7b4cd778e2677927b9
Reviewed-on: https://gerrit.instructure.com/99503
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Jesse Poulos <jpoulos@instructure.com>
2017-01-16 21:02:51 +00:00
Jesse Poulos 2ef7a5191e add custom variable for course workflow_state
Before this fix, there was not a way to determine the workflow_state of the
course without accessing API. This fix adds a way to send the course
workflow_state during an LTI launch.

Test plan:
1) create a course
2) install a tool with the $Canvas.course.workflowState custom field
3) launch the tool and verify that the course workflow_state is passed in
the launch parameters

Fixes PLAT-1956

Change-Id: I933ddcd45c689ecd054e692c7e4dc993874dc995
Reviewed-on: https://gerrit.instructure.com/94987
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Jesse Poulos <jpoulos@instructure.com>
2017-01-13 19:56:20 +00:00
Jesse Poulos 4ec3f40825 Updates the variable expansion documentation
The variable expansion documentation has instances of information being
outright incorrect, or just confusing. Furthermore, there are no examples
of how to invoke custom fields via variable expansion. For everything
(except the `Canvas.file` type variables), I've documented what is actually
returned as well as an example of what the data might look like. I've also
added examples of how tools can be configured to use custom fields (via
API, UI, or XML).

Test Plan:
Test plan:
1) run localhost Canvas
2) build the API docs (docker-compose run --rm web bundle exec rake
doc:api)
3) navigate to the following:
<your host url>/doc/api/file.tools_variable_substitutions.html
4) check for spelling, grammar, accuracy of information and that any links
work

Fixes PLAT-2022

Change-Id: I754bc2c5e48d4cdd4738c6d03d4d7e3c12a621b1
Reviewed-on: https://gerrit.instructure.com/96801
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Jesse Poulos <jpoulos@instructure.com>
2017-01-10 17:24:31 +00:00
Matthew Sessions cf5981fa89 Add isRootAccountAdmin variable expansion
Fixes MBL-6967

Test Plan:
 - Set up an lti tool with the custom expansion of
   Canvas.user.isRootAccountAdmin
 - On LTI launch it should be true for root account
   admins and false for non root account admins

Change-Id: I96b12a1f7eb3b7819a9040895216cf222d53c133
Reviewed-on: https://gerrit.instructure.com/95499
Reviewed-by: August Thornton <august@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Product-Review: Matthew Sessions <msessions@instructure.com>
2016-11-17 20:21:54 +00:00
Tyler Pickett 8898927e25 Establish LTI content migration plugin
This gets some of the infrastructure in place to handle this process
along with the start export method.

Change-Id: Id757a111aeb64c307021eb621e0624b0b3d8b7eb
Fixes: PLAT-1755 PLAT-1758
Reviewed-on: https://gerrit.instructure.com/93853
Tested-by: Jenkins
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Tyler Pickett <tpickett@instructure.com>
2016-11-08 20:18:07 +00:00
Nathan Mills 3d925feb90 fix incorrect canvas.externaltool.url substitution
Fixes #880  Github issue

fixes PLAT-1770

test plan:
add a tool installed at the account level with the
"Canvas.externalTool.url" variable expansion

the substituted value should be the tools context not the launch
context i.e. if the tool is launched from a course below the
account it is installed on it should be a url for the account.

also the returned url should be the correct api endpoint for the
tool

Change-Id: Ibb166240c96fb01b31bc2d5055b67f16e107878c
Reviewed-on: https://gerrit.instructure.com/88539
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2016-08-25 17:58:48 +00:00
Andrew Butterfield 7d94939784 Add variable substitution for collaboration members
fixes PLAT-1621

Test plan:
* Install a tool with collaboration placement and
  $Canvas.api.collaborationMembers.url custom variable
* Ensure that the variable is substituted for the collaboration update
  launch but not for collaboration create or show

Change-Id: I5826ed51d4d4a6a1099cb8077cd9748333e7417e
Reviewed-on: https://gerrit.instructure.com/83544
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Andrew Butterfield <abutterfield@instructure.com>
2016-06-24 19:32:41 +00:00
Ryan Taylor 6b57f5e76c Add documentation to LTI Assignment workflow state variable
Refs CNVS-30048

Test Plan:
 - Pretty much good

Change-Id: Ia3b93b987b84b233c33891011db7995cae07c8b5
Reviewed-on: https://gerrit.instructure.com/83140
Tested-by: Jenkins
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Chris Wang <cwang@instructure.com>
2016-06-23 21:06:25 +00:00
Ryan Taylor b0958b2321 Add workflow_state of assignment to LTI payload var options
Aids us in Quizzes 2.0 to make it easier to show context to teachers

Closes CNVS-30048

Change-Id: I8f551c98fff3bdc3c753d4e72bf91ad5971fcc63
Reviewed-on: https://gerrit.instructure.com/82740
Tested-by: Jenkins
Reviewed-by: Chris Wang <cwang@instructure.com>
Reviewed-by: Mike Nomitch <mnomitch@instructure.com>
QA-Review: Michael Hargiss <mhargiss@instructure.com>
Product-Review: Chris Wang <cwang@instructure.com>
2016-06-20 20:34:57 +00:00
Andrew Butterfield 602d502f5d Add variable substitution for user groups
fixes PLAT-1606

Test plan:
* Create some groups in a course and add a user to them
* Install a tool that has a collaboration and course navigation
  placement
* Include the following custom variable in the xml config
  user_group_ids=$Canvas.user.courseGroupOpaqueIds
* Ensure that on launches where the context is a course the variable is
  properly expanded to include a list of context ids for the groups the
  user launching is a part of in the course
* The variable substitution for membership service changed to
  $ToolProxyBinding.memberships.url
* Ensure that the membership service variable expansion still works in
  both the group and course context

Change-Id: I31a2a56e8d3b0c528f2cebe82c63148afdc80722
Reviewed-on: https://gerrit.instructure.com/82633
Tested-by: Jenkins
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Andrew Butterfield <abutterfield@instructure.com>
2016-06-17 16:58:49 +00:00
Nathan Mills e737bd9715 only send the tc profile url for lti2
refs PLAT-1571

test plan:
lti 1 launches shouldn't include the tool_consumer_profile_url
lti 2 launches should still include it
Change-Id: I72dd2d1eff13e015510c8c20bc73ab9ab961f561
Reviewed-on: https://gerrit.instructure.com/81862
Tested-by: Jenkins
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2016-06-15 15:28:49 +00:00
Matthew Wheeler d06cf7bc69 Round pointsPossible variable substitution if a whole number
Fixes PLAT-1498

Test Plan:

With the test tool, create a new assignment with
100 points possible. The value posted to the tool 
for the points_possible variable expansion should
be "100" not "100.0". A assignment with 100.5 points
possible should post as "100.5".

Change-Id: I5eaf29817a7a71626f1407cda4c75a3853c816d3
Reviewed-on: https://gerrit.instructure.com/79297
Reviewed-by: Jeremy Stanley <jeremy@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Karl Lloyd <karl@instructure.com>
2016-05-11 16:27:36 +00:00
Andrew Butterfield bee6437f5a Adjust variable substitution for membership service
fixes PLAT-1450

Test plan:
* Using the test tool https://lti-tool-provider-example.herokuapp.com/
  set up some XML for a tool that has a 'collaboration' placement and
  custom variable with the following variable substitution
    $Canvas.api.membershipServiceUrl
* Ensure that on a course collaboration launch the membership service
  url is of the following form
    /api/lti/courses/:course_id/membership_service
* Ensure that on an account group collaboration or course group
  collaboration launch the membership service url is of the following
  form
    /api/lti/groups/:group_id/membership_service

Change-Id: I38ce63ba0d95a12963e99251c2abf660573e9c7b
Reviewed-on: https://gerrit.instructure.com/78276
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Andrew Butterfield <abutterfield@instructure.com>
2016-05-04 18:57:04 +00:00
Brad Horrocks f51cefcc67 Better LTI Variable Substitution Docs
Generate LTI Variable Substitution Docs from the code
Uses YARD's plugin hooks to generate the markdown.

I couldn't find a good way to do this with YARDs builtin generation
stuff. So I hacked together. No pretty, but gets the job done.

You can update the generated markdown by running this
```
script/generate_lti_variable_subustition_markdown
```

Our yard templates, dont process markdown files like YARD is supposed
to.i Not sure why? 🤷

Fixes https://github.com/instructure/canvas-lms/issues/592

Change-Id: If0728d357dc745d81381e818ed62d087d76f0e66
Reviewed-on: https://gerrit.instructure.com/74312
Reviewed-by: Andrew Butterfield <abutterfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Product-Review: Brad Horrocks <bhorrocks@instructure.com>
2016-05-02 19:15:46 +00:00
Andrew Butterfield 754c5d58f2 Add variable substitution for membership service url
fixes PLAT-1387

Test plan:
* Using the lti test tool create a tool that can launch from an account
  context and a course context
* Add a custom param with the following key: value pair

  $Canvas.api.membershipServiceUrl

* Ensure that in the course context the variable substitution occurs but
  that in the account context it does not.

Change-Id: If2bf3b2c1b91229021b8d0f8cf3e7b83366eafcf
Reviewed-on: https://gerrit.instructure.com/75907
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Tested-by: Jenkins
Reviewed-by: Matthew Wheeler <mwheeler@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Andrew Butterfield <abutterfield@instructure.com>
2016-04-01 19:17:31 +00:00
Cody Cutrer b7f00ab032 document and extend usage of integration_id for users
refs CNVS-26735

test plan:
 * create a user, pseudonym, and update a pseudonym via API
   setting integration_id
 * it should work
 * with a user with an integration id set, launch an LTI tool
   with the Canvas.user.sisIntegrationId variable being sent;
   ensure it gets sent

Change-Id: I549ba6e64e993c4867acfe33577722c1118b8988
Reviewed-on: https://gerrit.instructure.com/70874
Reviewed-by: Rob Orton <rob@instructure.com>
Tested-by: Jenkins
Reviewed-by: Brad Humphrey <brad@instructure.com>
Reviewed-by: Simon Williams <simon@instructure.com>
QA-Review: Jeremy Putnam <jeremyp@instructure.com>
Product-Review: Cody Cutrer <cody@instructure.com>
2016-02-18 20:11:01 +00:00
Brad Horrocks cf1adc2978 LTI Reregistration
add support for reregistration launches
Allow tool providers to send updated tool proxies

Saves the payload and acknowledgment url in the update_payload field
Show an update indicator, and options to update or dismiss the update
basic UI functionality

fixes: PLAT-1247
Fixes PLAT-1276
Fixes PLAT-1248

Test Plans:

using the test tool you should be able to install it,
then from the gear context menu you should be able to do a reregistration
launch the tool and canvas only support the launch right now, and not the
rest of the process

Populate update payload on a tool proxy (LTI2 tool)
make sure a badge is displayed indicating there is an update available
make sure you the options to update or dismiss are displayed
make sure when you update it actually updates, and no longer shows an
update is available
make sure when you dismiss it no longer show an update

Change-Id: I93e2db40f81523e9518e529460ea2b16f5de103a
Reviewed-on: https://gerrit.instructure.com/68004
Reviewed-by: Brad Horrocks <bhorrocks@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Tested-by: Jenkins
Product-Review: Brad Horrocks <bhorrocks@instructure.com>
2015-12-17 23:26:05 +00:00
Nathan Mills 95569f5ef3 add variable expansion for user.global_id
fixes PLAT-1275

test plan:

request the `Canvas.user.globalId` custom variable expansion
you should get back a global id for the user

Change-Id: I5b34e0f266519b0cad9e5dbdf9ac206f9eab08ee
Reviewed-on: https://gerrit.instructure.com/65578
Tested-by: Jenkins
Reviewed-by: Brad Horrocks <bhorrocks@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2015-10-22 19:57:18 +00:00
Nathan Mills f4a2787ec1 handle missing assignment date values for variable subs
fixes PLAT-1272

test plan:

use the $Canvas.assignment.(dueAt|lockAt|unlockAt).iso8601 
varaible expansions

set up an assignment with blank values for all the dates

you should not get a 500 on an lti launch for the assignment

Change-Id: I7e4ffab74ea8b2aef6ba921c372ada9260805da0
Reviewed-on: https://gerrit.instructure.com/65354
Tested-by: Jenkins
Reviewed-by: Brad Horrocks <bhorrocks@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2015-10-22 19:15:02 +00:00
Josh Orr f30e329d8c Add a variable expansions iso8601
Canvas.assignment.unlockAt.iso8601 Canvas.assignment.lockAt.iso8601 Canvas.assignment.dueAt.iso8601

fixes PLAT-1211

test-plan:
install the test tool with Canvas.assignment.unlockAt.iso8601 Canvas.assignment.lockAt.iso8601 Canvas.assignment.dueAt.iso8601 setup as a custom variable
launch the tool
it should return back the above date varibles in iso8601 format.

Change-Id: I6a816e8318cb70d50a0cf39f2138f4e395f39676
Reviewed-on: https://gerrit.instructure.com/61806
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Josh Orr <jgorr@instructure.com>
2015-08-31 15:57:11 +00:00
Weston Dransfield 284c502f6d Make membership.roles variable expansion available in the account context
Fixes PLAT-1184

Test Plan
 - Install the test tool at the account level with the account navigation and course navigation placements
 - Once installed edit the app and add the custom field 'role_test=$Canvas.membership.roles'
 - launch the app from the account navigation and make sure the variable was expanded
 - launch the app from the course navigation and make sure the variable was expanded

Change-Id: I840c537de5ec1fa8fc1f1f94d2b8beef1aed2abb
Reviewed-on: https://gerrit.instructure.com/59859
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2015-08-05 23:07:32 +00:00
Addison Higham 665c7f2127 Add root_account.global_id and shard LTI expansions
For the Canvas Data product, we have an LTI app that we use to give customers access
to a flat file download or manage credentials for accessing a Redshift
database.

Since this is basically a huge amount of access, we want to be double
extra sure that we are properly linking up accounts with the canvas data
portal and only giving authorized users access.

For the LTI app, we are currently using per account oauth keys/secrets
and user whitelisting to ensure that only authorized users can access
the data. However, we currently have a gap where if a shard_id (which we
need for driving the ETL process) is not entered correctly, we would
process data for the wrong customer. With the shard_id being passed
by the LTI app, we can at least ensure that this data can't be accessed
by not allowing authentication if we are passed a shard_id we don't
expect.

This commit adds an expansion for the globalized account_id (which we
may use later) and the shard_id.

Test Plan:
  - Create an LTI app that expands $Canvas.root_account.global_id and $Canvas.shard
  - Ensure that the globalized root_account_id and shard_id are passed

Change-Id: I5315320c4920e258032a08f424b9a83a6f7a8744
Reviewed-on: https://gerrit.instructure.com/59895
Reviewed-by: Nathan Mills <nathanm@instructure.com>
Tested-by: Jenkins
QA-Review: August Thornton <august@instructure.com>
Product-Review: Addison Higham <ahigham@instructure.com>
2015-08-05 22:38:28 +00:00
Andrew Butterfield e6368a1828 Adds a custom param with css info for lti launch
fixes CNVS-21837

Test plan:
* Set up sis_app
  * If you don't have it already, clone sis_app from gerrit
  * Then pull down g/58166
  * Run bundle, rake db:migrate, grunt webpack:build
  * Start the server with rails s -p 9292
  * Create a Skyward Agent if you haven't already (there are a lot of
    steps with this so just ping me if you have trouble)
* Canvas
  * Delete any existing Skyward GPB LTI tool you have installed
  * Reinstall the Skyward GPB tool
* Verifications
  * Go to post grades
  * Open up the javascript console in the browser
  * Monitor network traffic
  * Click the Skyward LTI tool in the Post Grades
    drop down menu
  * In the network traffic look for /post_grades
  * Click on that request and look through the form data sent with the
    post request
  * Ensure that there is a url to the common.css stylesheet under the
    key: custom_common_css_url
  * Verify that the url listed under that key matches the url for the
    common.css stylesheet in the Canvas grades page

Change-Id: I48e0aa74d498770513bcfa08f95537b922096b05
Reviewed-on: https://gerrit.instructure.com/58167
Tested-by: Jenkins
Reviewed-by: Ryan Shaw <ryan@instructure.com>
Reviewed-by: Mark Severson <markse@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
QA-Review: Ben Bolton <bbolton@instructure.com>
Product-Review: Matthew Wheeler <mwheeler@instructure.com>
2015-07-17 15:58:06 +00:00
Weston Dransfield 25243983e8 Fix $Canvas.module.id and $Canvas.moduleItem.id not coming through on LTI launches from assignments
Fixes PLAT-1116

Test Plan
 - Add a tool to a course that has the 'Assignment Selection' placement enabled
 - Edit the tool and in the 'custom fields' area add 'module_id=$Canvas.module.id' and 'module_item_id=$Canvas.moduleItem.id'
 - Create a new assignment with 'Submission Type' set to 'External Tool' and select the tool you just installed.
 - Go to the course modules page and add the new assignment to a module.
 - note the id of the module and the moduleItem (The module item id is passed as a get param when you click on the link).
 - Make sure the custom fields (module_id and module_item_id) have the expected values

Change-Id: Ibc6c6342cf3493b8c81382f460c1af3a365130c0
Reviewed-on: https://gerrit.instructure.com/57235
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: Clare Strong <clare@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2015-07-16 19:37:50 +00:00
Nathan Mills 6b68f45eea add string interpolation variable expansion
fixes PLAT-955

test-plan:

interpolate a custom param value with a variable subsitutions,
i.e. 'my variable is buried in here ${Canvas.api.domain} can you find it?'
the interpolated variable should be expanded on lti1 & 2 launches

Change-Id: I23818756213831f1e0a52487b3d003183cc849e1
Reviewed-on: https://gerrit.instructure.com/54177
Tested-by: Jenkins
Reviewed-by: Brad Horrocks <bhorrocks@instructure.com>
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2015-05-20 17:41:03 +00:00
Nathan Mills 00bcaf5d95 fix the masquerading user id variable substitution
fixes: PLAT-1023

test-plan:
add the variable substitution $Canvas.masqueradingUser.id to an lti tool
launch the tool without masquerading, the variable should not be replaced.
launch the tool masquerading as a different user, the variable should be replaced with the real logged in users user id

Change-Id: Iea23054fc5856260d5f0c8e9756df7b6000ea329
Reviewed-on: https://gerrit.instructure.com/53867
Tested-by: Jenkins
Reviewed-by: Brad Horrocks <bhorrocks@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2015-05-15 16:25:41 +00:00
Weston Dransfield 8d42c9bc8e add variable substitution for masquerading user's LTI id
fixes PLAT-976

test plan:
- create an external app within a course
- add MasqUserID=$Canvas.masqueradingUser.userId as a custom field
- make sure the value of MasqUserID is set to the logged in user's LTI id
- masquerade as a user who has access to the external app
- make sure the value of MasqUserID is set to the lagged in user's LTI id, not the id of the user being impersonated

Change-Id: I80bd6dbf38d66937b86e1f636db2fafc219c6ef7
Reviewed-on: https://gerrit.instructure.com/52929
Tested-by: Jenkins
Reviewed-by: Nathan Mills <nathanm@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Weston Dransfield <wdransfield@instructure.com>
2015-04-29 18:21:43 +00:00
Weston Dransfield 9d39456652 add a canvas.externalToo.url to variable expansions
test plan:
- create an external app within a course
- add the custom field 'ExternalToolURL=$Canvas.externalTool.url'
- make sure the value of ExternalToolURL is the url to the tool

fixes PLAT-998

Change-Id: I5da603d094f64b9cccd77cce47b5f60e468c2226
Reviewed-on: https://gerrit.instructure.com/52805
QA-Review: August Thornton <august@instructure.com>
Tested-by: Jenkins
Reviewed-by: Brad Humphrey <brad@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
2015-04-24 22:00:39 +00:00
Weston Dransfield 28195523f8 add new variable substitutions - term and cousre start date
fixes PLAT-832

test plan:
Add the custom field CourseStartDate=$Canvas.course.startAt to an external app
make sure the value of CourseStartDate resolves to the start date of the class (if a start date is set)
Add the custom field TermStart=$Canvas.term.startAt to an external app
make sure the value of TermStart resovles to the start date of the term (if a start date is set)

Change-Id: Ie205497a544bdeabd72ca1f37981dcd343f34ed1
Reviewed-on: https://gerrit.instructure.com/52726
Reviewed-by: Brad Horrocks <bhorrocks@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>
2015-04-24 19:46:06 +00:00
Brayden Lopez e01e46fbaf Adding in assignment variable substitutions.
Fixes PLAT-907
Fixes PLAT-908

test plan
- Make sure those variables are substituted correctly when in an assignment context.

Change-Id: I56f3ba62dc53d9b8a39c5567588d68554092a842
Reviewed-on: https://gerrit.instructure.com/50275
Tested-by: Jenkins
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
2015-03-24 20:30:01 +00:00
Bracken Mosbacker e30146bc8f switch to proper variable substitution for caliper
updating the undocumented variable substitution for
caliper to what the standard says it should be

Test Plan:
 * do an LTI launch with the variable $Caliper.url
 * that should sub to a url

Change-Id: I5f4a32cdf3b410f9a653138b2362b9522c6e114b
Reviewed-on: https://gerrit.instructure.com/49291
Tested-by: Jenkins
Reviewed-by: Brad Humphrey <brad@instructure.com>
Product-Review: Brad Humphrey <brad@instructure.com>
QA-Review: August Thornton <august@instructure.com>
2015-03-06 22:31:44 +00:00
Nathan Mills ede725358f add new variable expansions for attachments
fixes PLAT-931

test-plan:
file_menu lti launches should now expand the following variables:
$Canvas.file.media.id
$Canvas.file.media.type
$Canvas.file.media.duration
$Canvas.file.media.size
$Canvas.file.media.title
$Canvas.file.usageRights.name
$Canvas.file.usageRights.url
$Canvas.file.usageRights.copyright_text

Change-Id: Ia358e8535aa31ad43c685323f38b26d9c3bce16b
Reviewed-on: https://gerrit.instructure.com/48606
Tested-by: Jenkins
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2015-02-19 17:12:38 +00:00
Bracken Mosbacker c64b15f7e7 add simple caliper endpoint for logging a page view
LTI tools will be able to request a caliper url to send
view events to. The duration will be used to log a page
view within canvas.

Test Plan:
* Install the test lti app http://lti-tool-provider.herokuapp.com/
* launch it and click the caliper link in the app
* the "total activity" time on the people page for that user
  should increase by 5 minutes.

Change-Id: I1032b9e5cbb007c326e539d9e53c92e83d83b80d
Reviewed-on: https://gerrit.instructure.com/47851
Tested-by: Jenkins
Reviewed-by: Braden Anderson <braden@instructure.com>
Product-Review: Braden Anderson <braden@instructure.com>
QA-Review: Braden Anderson <braden@instructure.com>
2015-02-02 22:31:36 +00:00
Nathan Mills 8781949693 add tool consumer profile variable substitution
fixes PLAT-828

test-plan:
specs should pass

Change-Id: Id00395609939ce51bbbb7f17f38398bc48a95bb9
Reviewed-on: https://gerrit.instructure.com/47252
Reviewed-by: Brad Humphrey <brad@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
QA-Review: Nathan Mills <nathanm@instructure.com>
Tested-by: Jenkins <jenkins@instructure.com>
2015-01-19 22:29:47 +00:00
Nathan Mills 571d9d1771 refactor variable substitutions
fixes PLAT-815

test-plan
regressions test lti1 variable substitutions
regression test lti1 sessionless varialbe substitutions

Change-Id: I6b57bff184b79a2b47b4d828aadfbf1831e11b1c
Reviewed-on: https://gerrit.instructure.com/46667
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brad Humphrey <brad@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Nathan Mills <nathanm@instructure.com>
2015-01-19 21:02:39 +00:00