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>
This commit is contained in:
parent
1670427781
commit
bbfe35b108
|
@ -1,3 +1,12 @@
|
|||
<!--
|
||||
DONT EDIT THIS FILE DIRECTLY
|
||||
Update:
|
||||
- doc/api/tools_variable_substitutions.head.md
|
||||
- lib/lti/variable_expander.rb
|
||||
|
||||
then run `script/generate_lti_variable_substitution_markdown`
|
||||
-->
|
||||
|
||||
LTI Variable Substitutions
|
||||
==========================
|
||||
|
||||
|
@ -8,19 +17,94 @@ it detects requested variable substitutions and sends the appropriate data where
|
|||
Adding variable substitutions is exactly the same as adding custom variables, except the values
|
||||
are variables instead of constants. This is denoted by prefixing the value with a $. If the
|
||||
tool consumer doesn't recognize, or can't substitute, the value it will just send the variable
|
||||
as if it were are regular custom variable.
|
||||
as if it were are regular custom variable (i.e. the name of the substitution variable will be
|
||||
sent rather than the value).
|
||||
|
||||
This is a fairly new addition to our LTI feature set, but has allowed us to expose a lot of
|
||||
data to LTI tools without asking them to go back to the Canvas API, which can be expensive
|
||||
for us and them. It allows tool providers to be much more surgical when requesting user
|
||||
data, and it paves the way for us to be more transparent to tool installers, by showing them
|
||||
exactly what data the LTI tool will be given access to. On top of all that, variable
|
||||
substitutions are generally simple to add to Canvas.
|
||||
This allows Canvas to expose data as LTI launch parameters during the LTI launch rather than
|
||||
requiring access to the Canvas API, which can be expensive for Canvas and the tool. It allows
|
||||
tool providers to be much more surgical when requesting user data, and it paves the way for us
|
||||
to be more transparent to tool installers, by showing them exactly what data the LTI tool will
|
||||
be given access to. Additionally, variable substitutions are generally simple to add to Canvas
|
||||
relative to gaining API access.
|
||||
|
||||
There are currently over 45 substitutions available. Many of the substitutions simply
|
||||
There are currently over 80 substitutions available. Many of the substitutions simply
|
||||
give access to additional user and context information. An LTI tool can request things
|
||||
like SIS ids, names, an avatar image, and an email address. Other variable substitutions
|
||||
assist tools with accessibility (prefersHighContrast), course copy (previousCourseIds), and
|
||||
masquerading users. Additionally, when we don't provide enough information or customizability
|
||||
masquerading users. Additionally, when we don't provide enough information or customization
|
||||
directly through LTI, tools can request everything they need to use the Canvas API for an even
|
||||
richer experience.
|
||||
|
||||
Some substitutions may be used as 'enabled_capabilities' for LTI2 tools. These substitutions have a
|
||||
'Launch Parameter' label indicating the parameter name that will be sent in the tool launch if enabled.
|
||||
|
||||
For more information on variable substitution, see the [https://www.imsglobal.org/specs/ltiv1p1p1/implementation-guide#toc-9](IMS LTI specification).
|
||||
|
||||
# Usage/Configuration
|
||||
Variable substitutions can be configured for a tool in 3 ways:
|
||||
|
||||
## Via UI
|
||||
Custom fields can be <a href="https://community.canvaslms.com/docs/DOC-3033">configured via UI</a> by editing the tool configuration and adding the
|
||||
desired variable to the Custom Fields text box.
|
||||
|
||||
The following would add the domain as a launch parameter called custom_arbitrary_name:
|
||||
|
||||
```
|
||||
arbitrary_name=$Canvas.api.domain
|
||||
```
|
||||
|
||||
## Via API
|
||||
Custom fields can also be <a href="/doc/api/external_tools.html#method.external_tools.create">configured via API</a>.
|
||||
|
||||
This would install a course-level tool with domain as a custom field:
|
||||
```
|
||||
curl 'https://<domain>.instructure.com/api/v1/courses/<course_id>/external_tools' \
|
||||
-X POST \
|
||||
-H "Authorization: Bearer <token>;" \
|
||||
-F 'name=LTI Example' \
|
||||
-F 'consumer_key=some_key' \
|
||||
-F 'shared_secret=some_secret' \
|
||||
-F 'url=https://example.com/ims/lti' \
|
||||
-F 'privacy_level=name_only' \
|
||||
-F 'custom_fields[domain]=$Canvas.api.domain'
|
||||
```
|
||||
|
||||
## Via XML Configuration
|
||||
Custom fields can also be <a href="http://canvas.docker/doc/api/file.tools_xml.html">configured via XML</a>.
|
||||
|
||||
This would create a tool in a course with custom fields, some of which are specific for a
|
||||
particular placement:
|
||||
```
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<cartridge_basiclti_link xmlns="http://www.imsglobal.org/xsd/imslticc_v1p0"
|
||||
xmlns:blti = "http://www.imsglobal.org/xsd/imsbasiclti_v1p0"
|
||||
xmlns:lticm ="http://www.imsglobal.org/xsd/imslticm_v1p0"
|
||||
xmlns:lticp ="http://www.imsglobal.org/xsd/imslticp_v1p0"
|
||||
xmlns:xsi = "http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation = "http://www.imsglobal.org/xsd/imslticc_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticc_v1p0.xsd
|
||||
http://www.imsglobal.org/xsd/imsbasiclti_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imsbasiclti_v1p0.xsd
|
||||
http://www.imsglobal.org/xsd/imslticm_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticm_v1p0.xsd
|
||||
http://www.imsglobal.org/xsd/imslticp_v1p0 http://www.imsglobal.org/xsd/lti/ltiv1p0/imslticp_v1p0.xsd">
|
||||
<blti:title>Wikipedia</blti:title>
|
||||
<blti:launch_url>https://www.wikipedia.org/</blti:launch_url>
|
||||
<blti:custom>
|
||||
<lticm:property name="user_sis_id">$Person.sourcedId</lticm:property>
|
||||
</blti:custom>
|
||||
<blti:extensions platform="canvas.instructure.com">
|
||||
<lticm:property name="domain">wikipedia.org</lticm:property>
|
||||
<lticm:options name="custom_fields">
|
||||
<lticm:property name="canvas_api_domain">$Canvas.api.domain</lticm:property>
|
||||
<lticm:property name="canvas_user_id">$Canvas.user.id</lticm:property>
|
||||
</lticm:options>
|
||||
<lticm:options name="course_navigation">
|
||||
<lticm:property name="url">https://en.wikipedia.org/wiki/Wikipedia:Unusual_articles#mediaviewer/File:Cow-on_pole,_with_antlers.jpeg</lticm:property>
|
||||
<lticm:property name="text">Cow With Antlers</lticm:property>
|
||||
<lticm:options name="custom_fields">
|
||||
<lticm:property name="concluded_roles">$Canvas.membership.concludedRoles</lticm:property>
|
||||
</lticm:options>
|
||||
</lticm:options>
|
||||
</blti:extensions>
|
||||
</cartridge_basiclti_link>
|
||||
```
|
||||
|
||||
# Supported Substitutions
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
<!--
|
||||
DONT EDIT THIS FILE DIRECTLY
|
||||
Update:
|
||||
- doc/api/tools_variable_substitutions.head.md
|
||||
- lib/lti/variable_expander.rb
|
||||
|
||||
then run `script/generate_lti_variable_substitution_markdown`
|
||||
-->
|
||||
|
||||
LTI Variable Substitutions
|
||||
==========================
|
||||
|
||||
|
@ -29,7 +38,7 @@ richer experience.
|
|||
Some substitutions may be used as 'enabled_capabilities' for LTI2 tools. These substitutions have a
|
||||
'Launch Parameter' label indicating the parameter name that will be sent in the tool launch if enabled.
|
||||
|
||||
For more information on variable substitution, see the <a href="https://www.imsglobal.org/specs/ltiv1p1p1/implementation-guide#toc-9" target="_blank">IMS LTI specification.</a>
|
||||
For more information on variable substitution, see the [https://www.imsglobal.org/specs/ltiv1p1p1/implementation-guide#toc-9](IMS LTI specification).
|
||||
|
||||
# Usage/Configuration
|
||||
Variable substitutions can be configured for a tool in 3 ways:
|
||||
|
@ -100,544 +109,749 @@ particular placement:
|
|||
|
||||
# Supported Substitutions
|
||||
## Context.id
|
||||
an opaque identifier that uniquely identifies the context of the tool launch
|
||||
an opaque identifier that uniquely identifies the context of the tool launch.
|
||||
|
||||
Launch Parameter: *context_id*
|
||||
**Availability**: *always*
|
||||
**Launch Parameter**: *context_id*
|
||||
|
||||
```
|
||||
cdca1fe2c392a208bd8a657f8865ddb9ca359534
|
||||
```
|
||||
|
||||
## ToolConsumerInstance.guid
|
||||
returns a unique identifier for the Tool Consumer (Canvas)
|
||||
|
||||
Launch Parameter: *tool_consumer_instance_guid*
|
||||
|
||||
```
|
||||
0dWtgJjjFWRNT41WdQMvrleejGgv7AynCVm3lmZ2:canvas-lms
|
||||
```
|
||||
|
||||
## Message.locale
|
||||
returns the current locale
|
||||
|
||||
Launch Parameter: *launch_presentation_locale*
|
||||
|
||||
```
|
||||
de
|
||||
```
|
||||
|
||||
## Message.documentTarget
|
||||
communicates the kind of browser window/frame where the Canvas has launched a tool
|
||||
communicates the kind of browser window/frame where the Canvas has launched a tool.
|
||||
|
||||
Launch Parameter: *launch_presentation_document_target*
|
||||
**Availability**: *always*
|
||||
**Launch Parameter**: *launch_presentation_document_target*
|
||||
|
||||
```
|
||||
iframe
|
||||
```
|
||||
## Message.locale
|
||||
returns the current locale.
|
||||
|
||||
**Availability**: *always*
|
||||
**Launch Parameter**: *launch_presentation_locale*
|
||||
|
||||
```
|
||||
de
|
||||
```
|
||||
## ToolConsumerInstance.guid
|
||||
returns a unique identifier for the Tool Consumer (Canvas).
|
||||
|
||||
**Availability**: *always*
|
||||
**Launch Parameter**: *tool_consumer_instance_guid*
|
||||
|
||||
```
|
||||
0dWtgJjjFWRNT41WdQMvrleejGgv7AynCVm3lmZ2:canvas-lms
|
||||
```
|
||||
## Canvas.api.domain
|
||||
returns the canvas domain for the current context. Should always be available.
|
||||
returns the canvas domain for the current context.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
canvas.instructure.com
|
||||
```
|
||||
|
||||
## Canvas.api.collaborationMembers.url
|
||||
returns the api url for the members of the collaboration.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
https://canvas.instructure.com/api/v1/collaborations/1/members
|
||||
```
|
||||
|
||||
## Canvas.api.baseUrl
|
||||
returns the base URL for the current context. Should always be available.
|
||||
returns the base URL for the current context.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
https://canvas.instructure.com
|
||||
```
|
||||
|
||||
## ToolProxyBinding.memberships.url
|
||||
returns the URL for the membership service associated with the current context.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
https://canvas.instructure.com/api/lti/courses/1/membership_service
|
||||
```
|
||||
|
||||
## Canvas.account.id
|
||||
returns the account id for the current context. Should always be available.
|
||||
returns the account id for the current context.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
1234
|
||||
```
|
||||
|
||||
## Canvas.account.name
|
||||
returns the account name for the current context. Should always be available.
|
||||
returns the account name for the current context.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
School Name
|
||||
```
|
||||
|
||||
## Canvas.account.sisSourceId
|
||||
returns the account's sis source id for the current context. Only available if sis_account_id is specified.
|
||||
returns the account's sis source id for the current context.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
sis_account_id_1234
|
||||
```
|
||||
|
||||
## Canvas.rootAccount.id
|
||||
returns the Root Account ID for the current context. Should always be available.
|
||||
returns the Root Account ID for the current context.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
1234
|
||||
```
|
||||
|
||||
## Canvas.rootAccount.sisSourceId
|
||||
returns the root account's sis source id for the current context. Only available if sis_account_id is specified.
|
||||
returns the root account's sis source id for the current context.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
sis_account_id_1234
|
||||
```
|
||||
|
||||
## Canvas.externalTool.url
|
||||
returns the URL for the external tool that was launched. Only available for LTI 1.
|
||||
|
||||
**Availability**: *always and when in an LTI 1*
|
||||
|
||||
|
||||
```
|
||||
http://example.url/path
|
||||
```
|
||||
|
||||
## Canvas.css.common
|
||||
returns the URL for the common CSS file. Should always be available.
|
||||
returns the URL for the common css file.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
http://example.url/path.css
|
||||
```
|
||||
|
||||
## Canvas.shard.id
|
||||
returns the shard id for the current context. Should always be available.
|
||||
returns the shard id for the current context.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
1234
|
||||
```
|
||||
## Canvas.root_account.global_id [duplicates Canvas.user.globalId]
|
||||
returns the root account's global id for the current context.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
## Canvas.root_account.global_id
|
||||
returns the root account's global id for the current context. Should always be available.
|
||||
|
||||
```
|
||||
123400000000123
|
||||
```
|
||||
|
||||
## Canvas.root_account.id *[deprecated]*
|
||||
returns the root account id for the current context. Should always be available.
|
||||
returns the root account id for the current context.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
1234
|
||||
```
|
||||
## vnd.Canvas.root_account.uuid
|
||||
returns the account uuid for the current context.
|
||||
|
||||
**Availability**: *always*
|
||||
**Launch Parameter**: *vnd_canvas_root_account_uuid*
|
||||
|
||||
```
|
||||
Ioe3sJPt0KZp9Pw6xAvcHuLCl0z4TvPKP0iIOLbo
|
||||
```
|
||||
## Canvas.root_account.sisSourceId *[deprecated]*
|
||||
returns the root account sis source id for the current context. Should always be available.
|
||||
returns the root account sis source id for the current context.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
1234
|
||||
```
|
||||
|
||||
## Canvas.course.id
|
||||
returns the current course id. Only available when launched in a course.
|
||||
returns the current course id.
|
||||
|
||||
**Availability**: *when launched in a course*
|
||||
|
||||
|
||||
```
|
||||
1234
|
||||
```
|
||||
## Canvas.course.name
|
||||
returns the current course name.
|
||||
|
||||
**Availability**: *when launched in a course*
|
||||
|
||||
## Canvas.course.workflowState
|
||||
returns the current course workflow state. Workflow states of "claimed" or "created" indicate an unpublished course.
|
||||
|
||||
```
|
||||
available
|
||||
Course Name
|
||||
```
|
||||
|
||||
## Canvas.course.sisSourceId
|
||||
returns the current course sis source id. Only available when launched in a course.
|
||||
returns the current course sis source id.
|
||||
|
||||
**Availability**: *when launched in a course*
|
||||
|
||||
|
||||
```
|
||||
1234
|
||||
```
|
||||
|
||||
## Canvas.course.startAt
|
||||
returns the current course start date. Only available when launched in a course.
|
||||
returns the current course start date.
|
||||
|
||||
**Availability**: *when launched in a course*
|
||||
|
||||
|
||||
```
|
||||
YYY-MM-DD HH:MM:SS -0700
|
||||
```
|
||||
## Canvas.course.workflowState
|
||||
returns the current course workflow state. Workflow states of "claimed" or "created"
|
||||
indicate an unpublished course.
|
||||
|
||||
## Canvas.term.startAt
|
||||
returns the current course's term start date. Only available when launched in a course that has a term with a start date.
|
||||
**Availability**: *when launched in a course*
|
||||
|
||||
```
|
||||
YYY-MM-DD HH:MM:SS -0700
|
||||
```
|
||||
|
||||
## CourseSection.sourcedId
|
||||
returns the current course sis source id. Only available when launched in a course.
|
||||
to return the section source id use Canvas.course.sectionIds
|
||||
|
||||
Launch Parameter: *lis_course_section_sourcedid*
|
||||
|
||||
```
|
||||
1234
|
||||
```
|
||||
|
||||
## Canvas.enrollment.enrollmentState
|
||||
returns the current course enrollment state. Only available when launched in a course.
|
||||
|
||||
```
|
||||
active
|
||||
```
|
||||
## Canvas.term.startAt
|
||||
returns the current course's term start date.
|
||||
|
||||
**Availability**: *when launched in a course that has a term with a start date*
|
||||
|
||||
|
||||
```
|
||||
YYY-MM-DD HH:MM:SS -0700
|
||||
```
|
||||
## CourseSection.sourcedId
|
||||
returns the current course sis source id
|
||||
to return the section source id use Canvas.course.sectionIds.
|
||||
|
||||
**Availability**: *when launched in a course*
|
||||
**Launch Parameter**: *lis_course_section_sourcedid*
|
||||
|
||||
```
|
||||
1234
|
||||
```
|
||||
## Canvas.enrollment.enrollmentState
|
||||
returns the current course enrollment state.
|
||||
|
||||
**Availability**: *when launched in a course*
|
||||
|
||||
|
||||
```
|
||||
active
|
||||
```
|
||||
## Canvas.membership.roles
|
||||
returns the current course membership roles. Only available when launched from a course or an account.
|
||||
returns the current course membership roles.
|
||||
|
||||
**Availability**: *when launched from a course or an account*
|
||||
|
||||
|
||||
```
|
||||
StudentEnrollment
|
||||
```
|
||||
|
||||
## Canvas.membership.concludedRoles
|
||||
This is a list of IMS LIS roles should have a different key. Only available when launched in a course.
|
||||
This is a list of IMS LIS roles should have a different key.
|
||||
|
||||
**Availability**: *when launched in a course*
|
||||
|
||||
|
||||
```
|
||||
urn:lti:sysrole:ims/lis/None
|
||||
```
|
||||
|
||||
## Canvas.course.previousContextIds
|
||||
Returns the context ids from the course that the current course was copied from.
|
||||
Only available when launched in a course that was copied (excludes cartridge imports).
|
||||
Returns the context ids from the course that the current course was copied from (excludes cartridge imports).
|
||||
|
||||
**Availability**: *when launched in a course*
|
||||
|
||||
|
||||
```
|
||||
1234
|
||||
```
|
||||
|
||||
## Canvas.course.previousCourseIds
|
||||
Returns the course ids of the course that the current course was copied from.
|
||||
Only available when launched in a course that was copied (excludes cartridge imports).
|
||||
Returns the course ids of the course that the current course was copied from (excludes cartridge imports).
|
||||
|
||||
**Availability**: *when launched in a course*
|
||||
|
||||
|
||||
```
|
||||
1234
|
||||
```
|
||||
|
||||
## Person.name.full
|
||||
Returns the full name of the launching user. Only available when launched by a logged in user.
|
||||
Returns the full name of the launching user.
|
||||
|
||||
Launch Parameter: *lis_person_name_full*
|
||||
**Availability**: *when launched by a logged in user*
|
||||
**Launch Parameter**: *lis_person_name_full*
|
||||
|
||||
```
|
||||
John Doe
|
||||
```
|
||||
## Person.name.family
|
||||
Returns the last name of the launching user. Only available when launched by a logged in user.
|
||||
Returns the last name of the launching user.
|
||||
|
||||
Launch Parameter: *lis_person_name_family*
|
||||
**Availability**: *when launched by a logged in user*
|
||||
**Launch Parameter**: *lis_person_name_family*
|
||||
|
||||
```
|
||||
Doe
|
||||
```
|
||||
|
||||
## Person.name.given
|
||||
Returns the last name of the launching user. Only available when launched by a logged in user.
|
||||
Returns the first name of the launching user.
|
||||
|
||||
Launch Parameter: *lis_person_name_given*
|
||||
**Availability**: *when launched by a logged in user*
|
||||
**Launch Parameter**: *lis_person_name_given*
|
||||
|
||||
```
|
||||
John
|
||||
```
|
||||
|
||||
## Person.email.primary
|
||||
Returns the primary email of the launching user. Only available when launched by a logged in user.
|
||||
Returns the primary email of the launching user.
|
||||
|
||||
Launch Parameter: *lis_person_contact_email_primary*
|
||||
**Availability**: *when launched by a logged in user*
|
||||
**Launch Parameter**: *lis_person_contact_email_primary*
|
||||
|
||||
```
|
||||
john.doe@example.com
|
||||
```
|
||||
|
||||
## vnd.Canvas.Person.email.sis
|
||||
Returns the institution assigned email of the launching user. Only available when launched by a logged in user that was added via SIS.
|
||||
Returns the institution assigned email of the launching user.
|
||||
|
||||
**Availability**: *when launched by a logged in user that was added via SIS*
|
||||
|
||||
|
||||
```
|
||||
john.doe@example.com
|
||||
```
|
||||
|
||||
## Person.address.timezone
|
||||
Returns the name of the timezone of the launching user. Only available when launched by a logged in user.
|
||||
Returns the name of the timezone of the launching user.
|
||||
|
||||
**Availability**: *when launched by a logged in user*
|
||||
|
||||
|
||||
```
|
||||
America/Denver
|
||||
```
|
||||
|
||||
## User.image
|
||||
Returns the profile picture URL of the launching user. Only available when launched by a logged in user.
|
||||
Returns the profile picture URL of the launching user.
|
||||
|
||||
Launch Parameter: *user_image*
|
||||
**Availability**: *when launched by a logged in user*
|
||||
**Launch Parameter**: *user_image*
|
||||
|
||||
```
|
||||
https://example.com/picture.jpg
|
||||
```
|
||||
## User.id [duplicates Canvas.user.id]
|
||||
Returns the Canvas user_id of the launching user.
|
||||
|
||||
## User.id [duplicates Canvas.user.id and Canvas.user.loginId]
|
||||
Returns the Canvas user_id of the launching user. Only available when launched by a logged in user.
|
||||
|
||||
Launch Parameter: *user_id*
|
||||
**Availability**: *when launched by a logged in user*
|
||||
**Launch Parameter**: *user_id*
|
||||
|
||||
```
|
||||
420000000000042
|
||||
```
|
||||
## Canvas.user.id [duplicates User.id]
|
||||
Returns the Canvas user_id of the launching user.
|
||||
|
||||
**Availability**: *when launched by a logged in user*
|
||||
|
||||
|
||||
## Canvas.user.id [duplicates User.id and Canvas.user.loginId]
|
||||
Returns the Canvas user_id of the launching user. Only available when launched by a logged in user.
|
||||
```
|
||||
420000000000042
|
||||
```
|
||||
|
||||
## Canvas.user.prefersHighContrast
|
||||
Returns the users preference for high contrast colors (an accessibility feature). Only available when launched by a logged in user.
|
||||
Returns the users preference for high contrast colors (an accessibility feature).
|
||||
|
||||
**Availability**: *when launched by a logged in user*
|
||||
|
||||
|
||||
```
|
||||
false
|
||||
```
|
||||
|
||||
## Canvas.group.contextIds
|
||||
returns the context ids for the groups the user belongs to in the course.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
1c16f0de65a080803785ecb3097da99872616f0d,d4d8d6ae1611e2c7581ce1b2f5c58019d928b79d,...
|
||||
```
|
||||
|
||||
## Membership.role
|
||||
Returns the <a href="https://www.imsglobal.org/specs/ltimemv1p0/specification-3">IMS LTI membership service</a> roles for filtering via query parameters. Only available when launched by a logged in user.
|
||||
Returns the [IMS LTI membership service](https://www.imsglobal.org/specs/ltimemv1p0/specification-3) roles for filtering via query parameters.
|
||||
|
||||
Launch Parameter: *roles*
|
||||
**Availability**: *when launched by a logged in user*
|
||||
**Launch Parameter**: *roles*
|
||||
|
||||
```
|
||||
http://purl.imsglobal.org/vocab/lis/v2/institution/person#Administrator
|
||||
```
|
||||
|
||||
## Canvas.xuser.allRoles [duplicates ext_roles which is sent by default]
|
||||
Returns list of <a href="https://www.imsglobal.org/specs/ltiv1p0/implementation-guide#toc-16" target ="_blank">LIS role full URNs</a>.
|
||||
Should always be available.
|
||||
Returns list of [LIS role full URNs](https://www.imsglobal.org/specs/ltiv1p0/implementation-guide#toc-16).
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
urn:lti:instrole:ims/lis/Administrator,urn:lti:instrole:ims/lis/Instructor,urn:lti:sysrole:ims/lis/SysAdmin,urn:lti:sysrole:ims/lis/User
|
||||
```
|
||||
## Canvas.user.globalId [duplicates Canvas.root_account.global_id]
|
||||
Returns the Canvas global user_id of the launching user.
|
||||
|
||||
**Availability**: *when launched by a logged in user*
|
||||
|
||||
|
||||
## Canvas.user.globalId [duplicates Canvas.user.id and User.id]
|
||||
Returns the canvas user_id of the launching user. Only available when launched by a logged in user.
|
||||
```
|
||||
420000000000042
|
||||
```
|
||||
|
||||
## Canvas.user.isRootAccountAdmin
|
||||
Returns true for root account admins and false for all other roles. Only available when launched by a logged in user.
|
||||
Returns true for root account admins and false for all other roles.
|
||||
|
||||
**Availability**: *when launched by a logged in user*
|
||||
|
||||
|
||||
```
|
||||
true
|
||||
```
|
||||
|
||||
## User.username [duplicates Canvas.user.loginId]
|
||||
Username/Login ID for the primary pseudonym for the user for the account.
|
||||
This may not be the pseudonym the user is actually logged in with. Only available when pseudonym is in use.
|
||||
This may not be the pseudonym the user is actually logged in with.
|
||||
|
||||
**Availability**: *when pseudonym is in use*
|
||||
|
||||
|
||||
```
|
||||
jdoe
|
||||
```
|
||||
|
||||
## Canvas.user.loginId [duplicates User.username]
|
||||
Returns the username/Login ID for the primary pseudonym for the user for the account.
|
||||
This may not be the pseudonym the user is actually logged in with. Only available when pseudonym is in use.
|
||||
Username/Login ID for the primary pseudonym for the user for the account.
|
||||
This may not be the pseudonym the user is actually logged in with.
|
||||
|
||||
**Availability**: *when pseudonym is in use*
|
||||
|
||||
|
||||
```
|
||||
jdoe
|
||||
```
|
||||
## Canvas.user.sisSourceId [duplicates Person.sourcedId]
|
||||
Returns the sis source id for the primary pseudonym for the user for the account
|
||||
This may not be the pseudonym the user is actually logged in with.
|
||||
|
||||
**Availability**: *when pseudonym is in use*
|
||||
|
||||
|
||||
## Canvas.user.sisSourceId [duplicates Person.sourceId]
|
||||
Returns the sis source id for the primary pseudonym for the user for the account.
|
||||
This may not be the pseudonym the user is actually logged in with. Only available when pseudonym is in use.
|
||||
```
|
||||
sis_user_42
|
||||
```
|
||||
|
||||
## Canvas.user.sisIntegrationId
|
||||
Returns the integration id for the primary pseudonym for the user for the account.
|
||||
This may not be the pseudonym the user is actually logged in with. Only available when pseudonym is in use.
|
||||
Returns the integration id for the primary pseudonym for the user for the account
|
||||
This may not be the pseudonym the user is actually logged in with.
|
||||
|
||||
**Availability**: *when pseudonym is in use*
|
||||
|
||||
|
||||
```
|
||||
integration_user_42
|
||||
```
|
||||
|
||||
## Person.sourcedId [duplicates Canvas.user.sisSourceId]
|
||||
Returns the sis source id for the primary pseudonym for the user for the account.
|
||||
This may not be the pseudonym the user is actually logged in with. Only available when pseudonym is in use.
|
||||
Returns the sis source id for the primary pseudonym for the user for the account
|
||||
This may not be the pseudonym the user is actually logged in with.
|
||||
|
||||
**Availability**: *when pseudonym is in use*
|
||||
**Launch Parameter**: *lis_person_sourcedid*
|
||||
|
||||
```
|
||||
sis_user_42
|
||||
```
|
||||
|
||||
## Canvas.logoutService.url
|
||||
Returns the logout service url for the user.
|
||||
This is the pseudonym the user is actually logged in as.
|
||||
it may not hold all the sis info needed in other launch substitutions.
|
||||
It may not hold all the sis info needed in other launch substitutions.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
https://<domain>.instructure.com/api/lti/v1/logout_service/<external_tool_id>-<user_id>-<current_unix_timestamp>-<opaque_string>
|
||||
```
|
||||
|
||||
## Canvas.masqueradingUser.id
|
||||
Returns the Canvas user_id for the masquerading user.
|
||||
Only available when the user is being masqueraded.
|
||||
This is the pseudonym the user is actually logged in as.
|
||||
It may not hold all the sis info needed in other launch substitutions.
|
||||
|
||||
**Availability**: *when the user is being masqueraded*
|
||||
|
||||
|
||||
```
|
||||
420000000000042
|
||||
```
|
||||
|
||||
|
||||
## Canvas.masqueradingUser.userId
|
||||
Returns the 40 character opaque user_id for masquerading user.
|
||||
Only available when the user is being masqueraded.
|
||||
This is the pseudonym the user is actually logged in as.
|
||||
It may not hold all the sis info needed in other launch substitutions.
|
||||
|
||||
**Availability**: *when the user is being masqueraded*
|
||||
|
||||
|
||||
```
|
||||
da12345678cb37ba1e522fc7c5ef086b7704eff9
|
||||
```
|
||||
|
||||
## Canvas.xapi.url
|
||||
Returns the xapi url for the user.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
https://<domain>.instructure.com/api/lti/v1/xapi/<external_tool_id>-<user_id>-<course_id>-<current_unix_timestamp>-<opaque_id>
|
||||
```
|
||||
|
||||
## Caliper.url
|
||||
Returns the caliper url for the user.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
https://<domain>.instructure.com/api/lti/v1/caliper/<external_tool_id>-<user_id>-<course_id>-<current_unix_timestamp>-<opaque_id>
|
||||
```
|
||||
|
||||
## Canvas.course.sectionIds
|
||||
Returns a comma separated list of section_id's that the user is enrolled in.
|
||||
Only available when launched from a course as an enrolled user.
|
||||
|
||||
**Availability**: *when launched from a course*
|
||||
|
||||
|
||||
```
|
||||
42, 43
|
||||
```
|
||||
|
||||
## Canvas.course.sectionSisSourceIds
|
||||
Returns a comma separated list of section sis_id's that the user is enrolled in.
|
||||
Only available when launched from a course as an enrolled user.
|
||||
|
||||
**Availability**: *when launched from a course*
|
||||
|
||||
|
||||
```
|
||||
section_sis_id_1, section_sis_id_2
|
||||
```
|
||||
|
||||
## Canvas.module.id
|
||||
Returns the module_id that the module item was launched from.
|
||||
Only available when content tag is present.
|
||||
|
||||
**Availability**: *when content tag is present*
|
||||
|
||||
|
||||
```
|
||||
1234
|
||||
```
|
||||
|
||||
## Canvas.moduleItem.id
|
||||
Returns the module_item_id of the module item that was launched.
|
||||
Only available when content tag is present.
|
||||
|
||||
**Availability**: *when content tag is present*
|
||||
|
||||
|
||||
```
|
||||
1234
|
||||
```
|
||||
|
||||
## Canvas.assignment.id
|
||||
Returns the assignment_id of the assignment that was launched.
|
||||
Only available when launched as an assignment.
|
||||
|
||||
**Availability**: *when launched as an assignment*
|
||||
|
||||
|
||||
```
|
||||
1234
|
||||
```
|
||||
|
||||
## Canvas.assignment.title
|
||||
Returns the title of the assignment that was launched.
|
||||
Only available when launched as an assignment.
|
||||
|
||||
**Availability**: *when launched as an assignment*
|
||||
|
||||
|
||||
```
|
||||
Deep thought experiment
|
||||
```
|
||||
|
||||
## Canvas.assignment.pointsPossible
|
||||
Returns the points possible of the assignment that was launched.
|
||||
Only available when launched as an assignment.
|
||||
|
||||
**Availability**: *when launched as an assignment*
|
||||
|
||||
|
||||
```
|
||||
100
|
||||
```
|
||||
|
||||
## Canvas.assignment.unlockAt *[deprecated]*
|
||||
deprecated in favor of ISO8601. Only available when launched as an assignment.
|
||||
deprecated in favor of ISO8601.
|
||||
|
||||
**Availability**: *when launched as an assignment*
|
||||
|
||||
|
||||
|
||||
## Canvas.assignment.lockAt *[deprecated]*
|
||||
deprecated in favor of ISO8601. Only available when launched as an assignment.
|
||||
deprecated in favor of ISO8601.
|
||||
|
||||
**Availability**: *when launched as an assignment*
|
||||
|
||||
|
||||
|
||||
## Canvas.assignment.dueAt *[deprecated]*
|
||||
deprecated in favor of ISO8601. Only available when launched as an assignment.
|
||||
deprecated in favor of ISO8601.
|
||||
|
||||
**Availability**: *when launched as an assignment*
|
||||
|
||||
|
||||
|
||||
## Canvas.assignment.unlockAt.iso8601
|
||||
Returns the unlock_at date of the assignment that was launched.
|
||||
Only available when launched as an assignment.
|
||||
Returns the `unlock_at` date of the assignment that was launched.
|
||||
Only available when launched as an assignment with an `unlock_at` set.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
YYYY-MM-DDT07:00:00Z
|
||||
```
|
||||
|
||||
## Canvas.assignment.lockAt.iso8601
|
||||
Returns the lock_at date of the assignment that was launched.
|
||||
Only available when launched as an assignment.
|
||||
Returns the `lock_at` date of the assignment that was launched.
|
||||
Only available when launched as an assignment with a `lock_at` set.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
YYYY-MM-DDT07:00:00Z
|
||||
```
|
||||
|
||||
## Canvas.assignment.dueAt.iso8601
|
||||
Returns the due_at date of the assignment that was launched.
|
||||
Only available when launched as an assignment.
|
||||
Returns the `due_at` date of the assignment that was launched.
|
||||
Only available when launched as an assignment with a `due_at` set.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
YYYY-MM-DDT07:00:00Z
|
||||
```
|
||||
|
||||
## Canvas.assignment.published
|
||||
Returns true if the assignment that was launched is published.
|
||||
Only available when launched as an assignment.
|
||||
|
||||
**Availability**: *when launched as an assignment*
|
||||
|
||||
|
||||
```
|
||||
true
|
||||
```
|
||||
|
||||
## LtiLink.custom.url
|
||||
Returns the endpoint url for accessing link-level tool settings
|
||||
Only available for LTI 2.0
|
||||
Only available for LTI 2.0.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
https://<domain>.instructure.com/api/lti/tool_settings/<link_id>
|
||||
```
|
||||
|
||||
## ToolProxyBinding.custom.url
|
||||
Returns the endpoint url for accessing context-level tool settings
|
||||
Only available for LTI 2.0
|
||||
Only available for LTI 2.0.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
https://<domain>.instructure.com/api/lti/tool_settings/<binding_id>
|
||||
```
|
||||
|
||||
## ToolProxy.custom.url
|
||||
Returns the endpoint url for accessing system-wide tool settings
|
||||
Only available for LTI 2.0
|
||||
Only available for LTI 2.0.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
https://<domain>.instructure.com/api/lti/tool_settings/<proxy_id>
|
||||
```
|
||||
|
||||
## ToolConsumerProfile.url
|
||||
Returns the <a href="https://www.imsglobal.org/specs/ltiv2p0/implementation-guide#toc-46" target="_blank">Tool Consumer Profile</a> url for the tool.
|
||||
Only available for LTI 2.0
|
||||
Returns the [Tool Consumer Profile](https://www.imsglobal.org/specs/ltiv2p0/implementation-guide#toc-46) url for the tool.
|
||||
Only available for LTI 2.0.
|
||||
|
||||
**Availability**: *always*
|
||||
|
||||
|
||||
```
|
||||
https://<domain>.instructure.com/api/lti/courses/<course_id>/tool_consumer_profile/<opaque_id>
|
||||
https://<domain>.instructure.com/api/lti/accounts/<account_id>/tool_consumer_profile/<opaque_id>
|
||||
```
|
||||
|
||||
|
||||
## Canvas.file.media.id
|
||||
Only available when an attachment is present and it has either a media object or media entry id defined.
|
||||
|
||||
|
||||
**Availability**: *when an attachment is present and it has either a media object or media entry id defined*
|
||||
|
||||
|
||||
|
||||
## Canvas.file.media.type
|
||||
Only available when an attachment is present and has a media object defined.
|
||||
|
||||
|
||||
**Availability**: *when an attachment is present and has a media object defined*
|
||||
|
||||
|
||||
|
||||
## Canvas.file.media.duration
|
||||
Only available when an attachment is present and has a media object defined.
|
||||
|
||||
|
||||
**Availability**: *when an attachment is present and has a media object defined*
|
||||
|
||||
|
||||
|
||||
## Canvas.file.media.size
|
||||
Only available when an attachment is present and has a media object defined.
|
||||
|
||||
|
||||
**Availability**: *when an attachment is present and has a media object defined*
|
||||
|
||||
|
||||
|
||||
## Canvas.file.media.title
|
||||
Only available when an attachment is present and has a media object defined.
|
||||
|
||||
|
||||
**Availability**: *when an attachment is present and has a media object defined*
|
||||
|
||||
|
||||
|
||||
## Canvas.file.usageRights.name
|
||||
Only available when an attachment is present and has usage rights defined.
|
||||
|
||||
|
||||
**Availability**: *when an attachment is present and has usage rights defined*
|
||||
|
||||
|
||||
|
||||
## Canvas.file.usageRights.url
|
||||
Only available when an attachment is present and has usage rights defined.
|
||||
|
||||
|
||||
**Availability**: *when an attachment is present and has usage rights defined*
|
||||
|
||||
|
||||
|
||||
## Canvas.file.usageRights.copyrightText
|
||||
Only available when an attachment is present and has usage rights defined.
|
||||
|
||||
|
||||
**Availability**: *when an attachment is present and has usage rights defined*
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -6,9 +6,6 @@ class RegisterExpansionHandler < YARD::Handlers::Ruby::Base
|
|||
|
||||
def process
|
||||
variable_substitution = statement.parameters.first.jump(:tstring_content, :ident).source
|
||||
guard = (
|
||||
statement.parameters[3] && statement.parameters[3].jump(:tstring_content, :ident).source.to_s
|
||||
) || 'ALWAYS'
|
||||
|
||||
object = register YARD::CodeObjects::MethodObject.new(namespace, variable_substitution)
|
||||
parse_block(statement, :owner => object)
|
||||
|
@ -17,10 +14,22 @@ class RegisterExpansionHandler < YARD::Handlers::Ruby::Base
|
|||
deprecated_str = ' *[deprecated]*' if object.tags(:deprecated).count > 0
|
||||
|
||||
example_tags = object.tags(:example)
|
||||
example = example_tags.count > 0 && object.tags(:example).first
|
||||
example = example_tags.count > 0 && example_tags.first
|
||||
|
||||
example_text = ''
|
||||
example_text = "\n\n#{example.text}" if example
|
||||
example_text = "#{example.text}" if example
|
||||
|
||||
# launch_param_tags = object.tags(:launch_parameter)
|
||||
# launch_param = launch_param_tags.count > 0 && launch_param_tags.first
|
||||
#
|
||||
# launch_param_text = ''
|
||||
# launch_param_text = "Launch Parameter: *#{launch_param.text}*" if launch_param
|
||||
|
||||
duplicates_tags = object.tags(:duplicates)
|
||||
duplicates = duplicates_tags.count > 0 && duplicates_tags.first
|
||||
|
||||
duplicates_text = ''
|
||||
duplicates_text = " [duplicates #{duplicates.text}]" if duplicates
|
||||
|
||||
description = if statement.comments
|
||||
d = statement.comments.match(/([^@]+)@?/m)[1].strip
|
||||
|
@ -30,47 +39,74 @@ class RegisterExpansionHandler < YARD::Handlers::Ruby::Base
|
|||
else
|
||||
''
|
||||
end
|
||||
description = case guard
|
||||
when 'ALWAYS'
|
||||
"#{description}Should always be available."
|
||||
when 'USER_GUARD'
|
||||
"#{description}Only available when launched by a logged in user."
|
||||
when 'USAGE_RIGHTS_GUARD'
|
||||
"#{description}Only available when an attachment is present and has usage rights defined."
|
||||
when 'MEDIA_OBJECT_GUARD'
|
||||
"#{description}Only available when an attachment is present and has a media object defined."
|
||||
when 'PSEUDONYM_GUARD'
|
||||
"#{description}Only available when pseudonym is in use."
|
||||
when 'ENROLLMENT_GUARD'
|
||||
"#{description}Only available when launched from a course."
|
||||
when 'ROLES_GUARD'
|
||||
"#{description}Only available when launched from a course or an account."
|
||||
when 'CONTENT_TAG_GUARD'
|
||||
"#{description}Only available when content tag is present."
|
||||
when 'ASSIGNMENT_GUARD'
|
||||
"#{description}Only available when launched as an assignment."
|
||||
when 'MEDIA_OBJECT_ID_GUARD'
|
||||
"#{description}Only available when an attachment is present and it has either a media object or media entry id defined."
|
||||
when 'LTI1_GUARD'
|
||||
"#{description}Only available for LTI 1."
|
||||
when 'MASQUERADING_GUARD'
|
||||
"#{description}Only available when the user is being masqueraded."
|
||||
when 'COURSE_GUARD'
|
||||
"#{description}Only available when launched in a course."
|
||||
when 'TERM_START_DATE_GUARD'
|
||||
"#{description}Only available when launched in a course that has a term with a start date."
|
||||
else
|
||||
"#{description}"
|
||||
end
|
||||
DocWriter.append_md <<~HEREDOC
|
||||
## #{variable_substitution}#{deprecated_str}#{duplicates_text}
|
||||
#{description.strip}
|
||||
|
||||
DocWriter.append_md "## #{variable_substitution}#{deprecated_str}\n#{description}#{example_text}\n\n"
|
||||
#{availability}
|
||||
#{launch_param_text}
|
||||
|
||||
#{example_text}
|
||||
HEREDOC
|
||||
end
|
||||
|
||||
private
|
||||
def object
|
||||
@object ||= YARD::CodeObjects::ClassVariableObject.new(namespace, "LTI_Substitutions")
|
||||
|
||||
def launch_param_text
|
||||
m = /default_name: '?"?([^'"]+)/.match(statement.parameters[statement.parameters.length - 2].source.to_s)
|
||||
return "**Launch Parameter**: *#{m[1]}* " if m
|
||||
end
|
||||
|
||||
def all_guards
|
||||
guards = []
|
||||
for i in 3..8
|
||||
param = statement.parameters[i]
|
||||
next unless param
|
||||
text = param.jump(:tstring_content, :ident).source.to_s
|
||||
guards.push(text) if /_GUARD$/.match text
|
||||
end
|
||||
|
||||
guards.push('ALWAYS') if guards.size == 0
|
||||
guards
|
||||
end
|
||||
|
||||
def availability
|
||||
all_availabilities = all_guards.map do |guard|
|
||||
case guard
|
||||
when 'ALWAYS', 'CONTROLLER_GUARD'
|
||||
"always"
|
||||
when 'USER_GUARD'
|
||||
"when launched by a logged in user"
|
||||
when 'SIS_USER_GUARD'
|
||||
"when launched by a logged in user that was added via SIS"
|
||||
when 'USAGE_RIGHTS_GUARD'
|
||||
"when an attachment is present and has usage rights defined"
|
||||
when 'MEDIA_OBJECT_GUARD'
|
||||
"when an attachment is present and has a media object defined"
|
||||
when 'PSEUDONYM_GUARD'
|
||||
"when pseudonym is in use"
|
||||
when 'ENROLLMENT_GUARD'
|
||||
"when launched from a course"
|
||||
when 'ROLES_GUARD'
|
||||
"when launched from a course or an account"
|
||||
when 'CONTENT_TAG_GUARD'
|
||||
"when content tag is present"
|
||||
when 'ASSIGNMENT_GUARD'
|
||||
"when launched as an assignment"
|
||||
when 'MEDIA_OBJECT_ID_GUARD'
|
||||
"when an attachment is present and it has either a media object or media entry id defined"
|
||||
when 'LTI1_GUARD'
|
||||
"when in an LTI 1"
|
||||
when 'MASQUERADING_GUARD'
|
||||
"when the user is being masqueraded"
|
||||
when 'COURSE_GUARD'
|
||||
"when launched in a course"
|
||||
when 'TERM_START_DATE_GUARD'
|
||||
"when launched in a course that has a term with a start date"
|
||||
end
|
||||
end.compact
|
||||
"**Availability**: *#{all_availabilities.join(' and ')}* " if all_availabilities.size
|
||||
end
|
||||
end
|
||||
|
||||
module DocWriter
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
# Filters added to this controller apply to all controllers in the application.
|
||||
# Likewise, all the methods added will be available for all controllers.
|
||||
# NOTE: To update the VariableExpansion docs run `script/generate_lti_variable_substitution_markdown`
|
||||
|
||||
module Lti
|
||||
class VariableExpander
|
||||
|
@ -101,7 +102,8 @@ module Lti
|
|||
end
|
||||
end
|
||||
|
||||
# an opaque identifier that uniquely identifies the context that contains the link being launched
|
||||
# an opaque identifier that uniquely identifies the context of the tool launch
|
||||
# @launch_parameter context_id
|
||||
# @example
|
||||
# ```
|
||||
# cdca1fe2c392a208bd8a657f8865ddb9ca359534
|
||||
|
@ -111,17 +113,17 @@ module Lti
|
|||
default_name: 'context_id'
|
||||
|
||||
# communicates the kind of browser window/frame where the Canvas has launched a tool
|
||||
# associated launch param name: launch_presentation_document_target
|
||||
# @launch_parameter launch_presentation_document_target
|
||||
# @example
|
||||
# ```
|
||||
# ifame
|
||||
# iframe
|
||||
# ```
|
||||
register_expansion 'Message.documentTarget', [],
|
||||
-> { IMS::LTI::Models::Messages::Message::LAUNCH_TARGET_IFRAME },
|
||||
default_name: 'launch_presentation_document_target'
|
||||
|
||||
# returns the current locale
|
||||
# associated launch param name: launch_presentation_locale
|
||||
# @launch_parameter launch_presentation_locale
|
||||
# @example
|
||||
# ```
|
||||
# de
|
||||
|
@ -131,7 +133,7 @@ module Lti
|
|||
default_name: 'launch_presentation_locale'
|
||||
|
||||
# returns a unique identifier for the Tool Consumer (Canvas)
|
||||
# associated launch param name: 'tool_consumer_instance_guid'
|
||||
# @launch_parameter tool_consumer_instance_guid
|
||||
# @example
|
||||
# ```
|
||||
# 0dWtgJjjFWRNT41WdQMvrleejGgv7AynCVm3lmZ2:canvas-lms
|
||||
|
@ -193,7 +195,7 @@ module Lti
|
|||
register_expansion 'Canvas.account.name', [],
|
||||
-> { lti_helper.account.name }
|
||||
|
||||
# returns the account's sis source id for the current context. Only available if sis_account_id is specified.
|
||||
# returns the account's sis source id for the current context.
|
||||
# @example
|
||||
# ```
|
||||
# sis_account_id_1234
|
||||
|
@ -209,7 +211,7 @@ module Lti
|
|||
register_expansion 'Canvas.rootAccount.id', [],
|
||||
-> { @root_account.id }
|
||||
|
||||
# returns the root account's sis source id for the current context. Only available if sis_account_id is specified.
|
||||
# returns the root account's sis source id for the current context.
|
||||
# @example
|
||||
# ```
|
||||
# sis_account_id_1234
|
||||
|
@ -217,7 +219,7 @@ module Lti
|
|||
register_expansion 'Canvas.rootAccount.sisSourceId', [],
|
||||
-> { @root_account.sis_source_id }
|
||||
|
||||
# returns the API URL for the external tool that was launched. Only available for LTI 1.
|
||||
# returns the URL for the external tool that was launched. Only available for LTI 1.
|
||||
# @example
|
||||
# ```
|
||||
# http://example.url/path
|
||||
|
@ -228,7 +230,7 @@ module Lti
|
|||
CONTROLLER_GUARD,
|
||||
LTI1_GUARD
|
||||
|
||||
# returns the URL for the common css file. Should always be available.
|
||||
# returns the URL for the common css file.
|
||||
# @example
|
||||
# ```
|
||||
# http://example.url/path.css
|
||||
|
@ -247,6 +249,7 @@ module Lti
|
|||
-> { Shard.current.id }
|
||||
|
||||
# returns the root account's global id for the current context.
|
||||
# @duplicates Canvas.user.globalId
|
||||
# @example
|
||||
# ```
|
||||
# 123400000000123
|
||||
|
@ -338,7 +341,7 @@ module Lti
|
|||
|
||||
# returns the current course sis source id
|
||||
# to return the section source id use Canvas.course.sectionIds
|
||||
# associated launch param name: 'lis_course_section_sourcedid'
|
||||
# @launch_parameter lis_course_section_sourcedid
|
||||
# @example
|
||||
# ```
|
||||
# 1234
|
||||
|
@ -375,8 +378,8 @@ module Lti
|
|||
-> { lti_helper.concluded_lis_roles },
|
||||
COURSE_GUARD
|
||||
|
||||
# Returns the context ids from the course that the current course was copied from.
|
||||
# Only available when launched in a course that was copied (excludes cartridge imports).
|
||||
# Returns the context ids from the course that the current course was copied from (excludes cartridge imports).
|
||||
#
|
||||
# @example
|
||||
# ```
|
||||
# 1234
|
||||
|
@ -385,8 +388,8 @@ module Lti
|
|||
-> { lti_helper.previous_lti_context_ids },
|
||||
COURSE_GUARD
|
||||
|
||||
# Returns the course ids of the course that the current course was copied from.
|
||||
# Only available when launched in a course that was copied (excludes cartridge imports).
|
||||
# Returns the course ids of the course that the current course was copied from (excludes cartridge imports).
|
||||
#
|
||||
# @example
|
||||
# ```
|
||||
# 1234
|
||||
|
@ -395,8 +398,8 @@ module Lti
|
|||
-> { lti_helper.previous_course_ids },
|
||||
COURSE_GUARD
|
||||
|
||||
# Returns the full name of the launching user. Only available when launched by a logged in user.
|
||||
# associated launch param name: lis_person_name_full
|
||||
# Returns the full name of the launching user.
|
||||
# @launch_parameter lis_person_name_full
|
||||
# @example
|
||||
# ```
|
||||
# John Doe
|
||||
|
@ -406,8 +409,8 @@ module Lti
|
|||
USER_GUARD,
|
||||
default_name: 'lis_person_name_full'
|
||||
|
||||
# Returns the last name of the launching user. Only available when launched by a logged in user.
|
||||
# associated launch param name: 'lis_person_name_family'
|
||||
# Returns the last name of the launching user.
|
||||
# @launch_parameter lis_person_name_family
|
||||
# @example
|
||||
# ```
|
||||
# Doe
|
||||
|
@ -417,8 +420,8 @@ module Lti
|
|||
USER_GUARD,
|
||||
default_name: 'lis_person_name_family'
|
||||
|
||||
# Returns the first name of the launching user. Only available when launched by a logged in user.
|
||||
# associated launch param name: 'lis_person_name_given'
|
||||
# Returns the first name of the launching user.
|
||||
# @launch_parameter lis_person_name_given
|
||||
# @example
|
||||
# ```
|
||||
# John
|
||||
|
@ -428,8 +431,8 @@ module Lti
|
|||
USER_GUARD,
|
||||
default_name: 'lis_person_name_given'
|
||||
|
||||
# Returns the primary email of the launching user. Only available when launched by a logged in user.
|
||||
# associated launch param name: 'lis_person_contact_email_primary'
|
||||
# Returns the primary email of the launching user.
|
||||
# @launch_parameter lis_person_contact_email_primary
|
||||
# @example
|
||||
# ```
|
||||
# john.doe@example.com
|
||||
|
@ -440,7 +443,7 @@ module Lti
|
|||
default_name: 'lis_person_contact_email_primary'
|
||||
|
||||
|
||||
# Returns the institution assigned email of the launching user. Only available when launched by a logged in user that was added via SIS.
|
||||
# Returns the institution assigned email of the launching user.
|
||||
# @example
|
||||
# ```
|
||||
# john.doe@example.com
|
||||
|
@ -448,7 +451,7 @@ module Lti
|
|||
register_expansion 'vnd.Canvas.Person.email.sis', [],
|
||||
-> {lti_helper.sis_email}, SIS_USER_GUARD
|
||||
|
||||
# Returns the name of the timezone of the launching user. Only available when launched by a logged in user.
|
||||
# Returns the name of the timezone of the launching user.
|
||||
# @example
|
||||
# ```
|
||||
# America/Denver
|
||||
|
@ -457,8 +460,8 @@ module Lti
|
|||
-> { Time.zone.tzinfo.name },
|
||||
USER_GUARD
|
||||
|
||||
# Returns the profile picture URL of the launching user. Only available when launched by a logged in user.
|
||||
# associated launch param name: 'user_image'
|
||||
# Returns the profile picture URL of the launching user.
|
||||
# @launch_parameter user_image
|
||||
# @example
|
||||
# ```
|
||||
# https://example.com/picture.jpg
|
||||
|
@ -468,8 +471,9 @@ module Lti
|
|||
USER_GUARD,
|
||||
default_name: 'user_image'
|
||||
|
||||
# Returns the Canvas user_id of the launching user. Only available when launched by a logged in user.
|
||||
# associated launch param name: 'user_id'
|
||||
# Returns the Canvas user_id of the launching user.
|
||||
# @duplicates Canvas.user.id
|
||||
# @launch_parameter user_id
|
||||
# @example
|
||||
# ```
|
||||
# 420000000000042
|
||||
|
@ -479,7 +483,8 @@ module Lti
|
|||
USER_GUARD,
|
||||
default_name: 'user_id'
|
||||
|
||||
# Returns the Canvas user_id of the launching user. Only available when launched by a logged in user.
|
||||
# Returns the Canvas user_id of the launching user.
|
||||
# @duplicates User.id
|
||||
# @example
|
||||
# ```
|
||||
# 420000000000042
|
||||
|
@ -488,7 +493,7 @@ module Lti
|
|||
-> { @current_user.id },
|
||||
USER_GUARD
|
||||
|
||||
# Returns the users preference for high contrast colors (an accessibility feature). Only available when launched by a logged in user.
|
||||
# Returns the users preference for high contrast colors (an accessibility feature).
|
||||
# @example
|
||||
# ```
|
||||
# false
|
||||
|
@ -508,9 +513,8 @@ module Lti
|
|||
end.join(',') },
|
||||
-> { @current_user && @context.is_a?(Course) }
|
||||
|
||||
# Returns the <a href="https://www.imsglobal.org/specs/ltimemv1p0/specification-3">IMS LTI membership service</a> roles for filtering via query parameters.
|
||||
# Only available when launched by a logged in user.
|
||||
# associated launch param name: 'roles'
|
||||
# Returns the [IMS LTI membership service](https://www.imsglobal.org/specs/ltimemv1p0/specification-3) roles for filtering via query parameters.
|
||||
# @launch_parameter roles
|
||||
# @example
|
||||
# ```
|
||||
# http://purl.imsglobal.org/vocab/lis/v2/institution/person#Administrator
|
||||
|
@ -520,16 +524,17 @@ module Lti
|
|||
USER_GUARD,
|
||||
default_name: 'roles'
|
||||
|
||||
# Returns list of <a href="https://www.imsglobal.org/specs/ltiv1p0/implementation-guide#toc-16" target ="_blank">LIS role full URNs</a>.
|
||||
# Should always be available.
|
||||
# Returns list of [LIS role full URNs](https://www.imsglobal.org/specs/ltiv1p0/implementation-guide#toc-16).
|
||||
# @duplicates ext_roles which is sent by default
|
||||
# @example
|
||||
# ```
|
||||
# http://purl.imsglobal.org/vocab/lis/v2/institution/person#Administrator
|
||||
# urn:lti:instrole:ims/lis/Administrator,urn:lti:instrole:ims/lis/Instructor,urn:lti:sysrole:ims/lis/SysAdmin,urn:lti:sysrole:ims/lis/User
|
||||
# ```
|
||||
register_expansion 'Canvas.xuser.allRoles', [],
|
||||
-> { lti_helper.all_roles }
|
||||
|
||||
# Returns the Canvas user_id of the launching user. Only available when launched by a logged in user.
|
||||
# Returns the Canvas global user_id of the launching user.
|
||||
# @duplicates Canvas.root_account.global_id
|
||||
# @example
|
||||
# ```
|
||||
# 420000000000042
|
||||
|
@ -538,7 +543,7 @@ module Lti
|
|||
-> { @current_user.global_id},
|
||||
USER_GUARD
|
||||
|
||||
# Returns true for root account admins and false for all other roles. Only available when launched by a logged in user.
|
||||
# Returns true for root account admins and false for all other roles.
|
||||
# @example
|
||||
# ```
|
||||
# true
|
||||
|
@ -547,8 +552,10 @@ module Lti
|
|||
-> { @current_user.roles(@root_account).include? 'root_admin' },
|
||||
USER_GUARD
|
||||
|
||||
# Returns the username/Login ID for the primary pseudonym for the user for the account
|
||||
# This may not be the pseudonym the user is actually logged in with. Only available when pseudonym is in use.
|
||||
# Username/Login ID for the primary pseudonym for the user for the account.
|
||||
# This may not be the pseudonym the user is actually logged in with.
|
||||
# @duplicates Canvas.user.loginId
|
||||
# @example
|
||||
# ```
|
||||
# jdoe
|
||||
# ```
|
||||
|
@ -556,8 +563,10 @@ module Lti
|
|||
-> { sis_pseudonym.unique_id },
|
||||
PSEUDONYM_GUARD
|
||||
|
||||
# Returns the username/Login ID for the primary pseudonym for the user for the account
|
||||
# This may not be the pseudonym the user is actually logged in with. Only available when pseudonym is in use.
|
||||
# Username/Login ID for the primary pseudonym for the user for the account.
|
||||
# This may not be the pseudonym the user is actually logged in with.
|
||||
# @duplicates User.username
|
||||
# @example
|
||||
# ```
|
||||
# jdoe
|
||||
# ```
|
||||
|
@ -566,7 +575,9 @@ module Lti
|
|||
PSEUDONYM_GUARD
|
||||
|
||||
# Returns the sis source id for the primary pseudonym for the user for the account
|
||||
# This may not be the pseudonym the user is actually logged in with. Only available when pseudonym is in use.
|
||||
# This may not be the pseudonym the user is actually logged in with.
|
||||
# @duplicates Person.sourcedId
|
||||
# @example
|
||||
# ```
|
||||
# sis_user_42
|
||||
# ```
|
||||
|
@ -575,7 +586,8 @@ module Lti
|
|||
PSEUDONYM_GUARD
|
||||
|
||||
# Returns the integration id for the primary pseudonym for the user for the account
|
||||
# This may not be the pseudonym the user is actually logged in with. Only available when pseudonym is in use.
|
||||
# This may not be the pseudonym the user is actually logged in with.
|
||||
# @example
|
||||
# ```
|
||||
# integration_user_42
|
||||
# ```
|
||||
|
@ -584,7 +596,9 @@ module Lti
|
|||
PSEUDONYM_GUARD
|
||||
|
||||
# Returns the sis source id for the primary pseudonym for the user for the account
|
||||
# This may not be the pseudonym the user is actually logged in with. Only available when pseudonym is in use.
|
||||
# This may not be the pseudonym the user is actually logged in with.
|
||||
# @duplicates Canvas.user.sisSourceId
|
||||
# @example
|
||||
# ```
|
||||
# sis_user_42
|
||||
# ```
|
||||
|
@ -596,8 +610,9 @@ module Lti
|
|||
# Returns the logout service url for the user.
|
||||
# This is the pseudonym the user is actually logged in as.
|
||||
# It may not hold all the sis info needed in other launch substitutions.
|
||||
# @example
|
||||
# ```
|
||||
# https://<domain>.instructure.com/api/lti/v1/logout_service/<external_tool_id>-<user_id>-<current_unix_timestamp>-<opaque_id>
|
||||
# https://<domain>.instructure.com/api/lti/v1/logout_service/<external_tool_id>-<user_id>-<current_unix_timestamp>-<opaque_string>
|
||||
# ```
|
||||
register_expansion 'Canvas.logoutService.url', [],
|
||||
-> { @controller.lti_logout_service_url(Lti::LogoutService.create_token(@tool, @current_pseudonym)) },
|
||||
|
@ -607,7 +622,8 @@ module Lti
|
|||
# Returns the Canvas user_id for the masquerading user.
|
||||
# This is the pseudonym the user is actually logged in as.
|
||||
# It may not hold all the sis info needed in other launch substitutions.
|
||||
# Only available when the user is being masqueraded.
|
||||
#
|
||||
# @example
|
||||
# ```
|
||||
# 420000000000042
|
||||
# ```
|
||||
|
@ -618,7 +634,8 @@ module Lti
|
|||
# Returns the 40 character opaque user_id for masquerading user.
|
||||
# This is the pseudonym the user is actually logged in as.
|
||||
# It may not hold all the sis info needed in other launch substitutions.
|
||||
# Only available when the user is being masqueraded.
|
||||
#
|
||||
# @example
|
||||
# ```
|
||||
# da12345678cb37ba1e522fc7c5ef086b7704eff9
|
||||
# ```
|
||||
|
@ -627,6 +644,7 @@ module Lti
|
|||
MASQUERADING_GUARD
|
||||
|
||||
# Returns the xapi url for the user.
|
||||
# @example
|
||||
# ```
|
||||
# https://<domain>.instructure.com/api/lti/v1/xapi/<external_tool_id>-<user_id>-<course_id>-<current_unix_timestamp>-<opaque_id>
|
||||
# ```
|
||||
|
@ -635,6 +653,7 @@ module Lti
|
|||
-> { @current_user && @context.is_a?(Course) && @tool }
|
||||
|
||||
# Returns the caliper url for the user.
|
||||
# @example
|
||||
# ```
|
||||
# https://<domain>.instructure.com/api/lti/v1/caliper/<external_tool_id>-<user_id>-<course_id>-<current_unix_timestamp>-<opaque_id>
|
||||
# ```
|
||||
|
@ -644,7 +663,8 @@ module Lti
|
|||
-> { @current_user && @context.is_a?(Course) && @tool }
|
||||
|
||||
# Returns a comma separated list of section_id's that the user is enrolled in.
|
||||
# Only available when launched from a course as an enrolled user.
|
||||
#
|
||||
# @example
|
||||
# ```
|
||||
# 42, 43
|
||||
# ```
|
||||
|
@ -653,7 +673,8 @@ module Lti
|
|||
ENROLLMENT_GUARD
|
||||
|
||||
# Returns a comma separated list of section sis_id's that the user is enrolled in.
|
||||
# Only available when launched from a course as an enrolled user.
|
||||
#
|
||||
# @example
|
||||
# ```
|
||||
# section_sis_id_1, section_sis_id_2
|
||||
# ```
|
||||
|
@ -662,7 +683,8 @@ module Lti
|
|||
ENROLLMENT_GUARD
|
||||
|
||||
# Returns the module_id that the module item was launched from.
|
||||
# Only available when content tag is present.
|
||||
#
|
||||
# @example
|
||||
# ```
|
||||
# 1234
|
||||
# ```
|
||||
|
@ -673,7 +695,8 @@ module Lti
|
|||
CONTENT_TAG_GUARD
|
||||
|
||||
# Returns the module_item_id of the module item that was launched.
|
||||
# Only available when content tag is present.
|
||||
#
|
||||
# @example
|
||||
# ```
|
||||
# 1234
|
||||
# ```
|
||||
|
@ -684,7 +707,8 @@ module Lti
|
|||
CONTENT_TAG_GUARD
|
||||
|
||||
# Returns the assignment_id of the assignment that was launched.
|
||||
# Only available when launched as an assignment.
|
||||
#
|
||||
# @example
|
||||
# ```
|
||||
# 1234
|
||||
# ```
|
||||
|
@ -693,7 +717,8 @@ module Lti
|
|||
ASSIGNMENT_GUARD
|
||||
|
||||
# Returns the title of the assignment that was launched.
|
||||
# Only available when launched as an assignment.
|
||||
#
|
||||
# @example
|
||||
# ```
|
||||
# Deep thought experiment
|
||||
# ```
|
||||
|
@ -702,7 +727,8 @@ module Lti
|
|||
ASSIGNMENT_GUARD
|
||||
|
||||
# Returns the points possible of the assignment that was launched.
|
||||
# Only available when launched as an assignment.
|
||||
#
|
||||
# @example
|
||||
# ```
|
||||
# 100
|
||||
# ```
|
||||
|
@ -725,8 +751,9 @@ module Lti
|
|||
-> { @assignment.due_at },
|
||||
ASSIGNMENT_GUARD
|
||||
|
||||
# Returns the unlock_at date of the assignment that was launched.
|
||||
# Only available when launched as an assignment.
|
||||
# Returns the `unlock_at` date of the assignment that was launched.
|
||||
# Only available when launched as an assignment with an `unlock_at` set.
|
||||
# @example
|
||||
# ```
|
||||
# YYYY-MM-DDT07:00:00Z
|
||||
# ```
|
||||
|
@ -734,8 +761,10 @@ module Lti
|
|||
-> { @assignment.unlock_at.utc.iso8601 },
|
||||
-> {@assignment && @assignment.unlock_at.present?}
|
||||
|
||||
# Returns the lock_at date of the assignment that was launched.
|
||||
# Only available when launched as an assignment.
|
||||
# Returns the `lock_at` date of the assignment that was launched.
|
||||
# Only available when launched as an assignment with a `lock_at` set.
|
||||
#
|
||||
# @example
|
||||
# ```
|
||||
# YYYY-MM-DDT07:00:00Z
|
||||
# ```
|
||||
|
@ -743,8 +772,10 @@ module Lti
|
|||
-> { @assignment.lock_at.utc.iso8601 },
|
||||
-> {@assignment && @assignment.lock_at.present?}
|
||||
|
||||
# Returns the due_at date of the assignment that was launched.
|
||||
# Only available when launched as an assignment.
|
||||
# Returns the `due_at` date of the assignment that was launched.
|
||||
# Only available when launched as an assignment with a `due_at` set.
|
||||
#
|
||||
# @example
|
||||
# ```
|
||||
# YYYY-MM-DDT07:00:00Z
|
||||
# ```
|
||||
|
@ -752,8 +783,9 @@ module Lti
|
|||
-> { @assignment.due_at.utc.iso8601 },
|
||||
-> {@assignment && @assignment.due_at.present?}
|
||||
|
||||
# Returns the true if the assignment that was launched is published.
|
||||
# Returns true if the assignment that was launched is published.
|
||||
# Only available when launched as an assignment.
|
||||
# @example
|
||||
# ```
|
||||
# true
|
||||
# ```
|
||||
|
@ -763,6 +795,7 @@ module Lti
|
|||
|
||||
# Returns the endpoint url for accessing link-level tool settings
|
||||
# Only available for LTI 2.0
|
||||
# @example
|
||||
# ```
|
||||
# https://<domain>.instructure.com/api/lti/tool_settings/<link_id>
|
||||
# ```
|
||||
|
@ -773,6 +806,7 @@ module Lti
|
|||
|
||||
# Returns the endpoint url for accessing context-level tool settings
|
||||
# Only available for LTI 2.0
|
||||
# @example
|
||||
# ```
|
||||
# https://<domain>.instructure.com/api/lti/tool_settings/<binding_id>
|
||||
# ```
|
||||
|
@ -783,6 +817,7 @@ module Lti
|
|||
|
||||
# Returns the endpoint url for accessing system-wide tool settings
|
||||
# Only available for LTI 2.0
|
||||
# @example
|
||||
# ```
|
||||
# https://<domain>.instructure.com/api/lti/tool_settings/<proxy_id>
|
||||
# ```
|
||||
|
@ -790,8 +825,9 @@ module Lti
|
|||
-> { @controller.show_lti_tool_settings_url(@tool_setting_proxy_id) },
|
||||
-> { !!@controller && @tool_setting_proxy_id }
|
||||
|
||||
# Returns the <a href="https://www.imsglobal.org/specs/ltiv2p0/implementation-guide#toc-46" target="_blank">Tool Consumer Profile</a> url for the tool.
|
||||
# Returns the [Tool Consumer Profile](https://www.imsglobal.org/specs/ltiv2p0/implementation-guide#toc-46) url for the tool.
|
||||
# Only available for LTI 2.0
|
||||
# @example
|
||||
# ```
|
||||
# https://<domain>.instructure.com/api/lti/courses/<course_id>/tool_consumer_profile/<opaque_id>
|
||||
# https://<domain>.instructure.com/api/lti/accounts/<account_id>/tool_consumer_profile/<opaque_id>
|
||||
|
|
|
@ -14,6 +14,7 @@ namespace :doc do
|
|||
YARD::Tags::Library.define_tag("A Data Model", :model)
|
||||
YARD::Rake::YardocTask.new(:api) do |t|
|
||||
t.before = proc { FileUtils.rm_rf(API_DOC_DIR) }
|
||||
t.before = proc { sh('script/generate_lti_variable_substitution_markdown') }
|
||||
t.files = %w[
|
||||
app/controllers/**/*.rb
|
||||
{gems,vendor}/plugins/*/app/controllers/*.rb
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
#! /bin/sh
|
||||
|
||||
bundle exec yardoc -n -e doc/yard_plugins/lti_variable_expansion_plugin.rb lib/lti/variable_expander.rb
|
||||
bundle exec yardoc --verbose --tag launch_parameter:"Launch Parameter" --tag duplicates:"Duplicates" -n -e doc/yard_plugins/lti_variable_expansion_plugin.rb lib/lti/variable_expander.rb
|
||||
|
|
Loading…
Reference in New Issue