Enable Person.name.display as an option

Allows for lti launch where you can expand the display name of
a user in lti tools for use.

closes PLAT-2776

Test Plan:
 - Create an lti config that uses Person.name.display
 - Do an lti launch and verify that the expanded value as a param
 - For LTI 2, create a tool proxy that includes the Personl.name.display
  capability
 - Repeat step 2

Change-Id: I7f919bb9af2bb1efb42d8a3bd76cfb3b69378152
Reviewed-on: https://gerrit.instructure.com/134518
Tested-by: Jenkins
Reviewed-by: Weston Dransfield <wdransfield@instructure.com>
QA-Review: August Thornton <august@instructure.com>
Product-Review: Marc Alan Phillips <mphillips@instructure.com>
This commit is contained in:
Marc Alan Phillips 2017-12-04 12:32:53 -07:00
parent e57fbf3b9c
commit 08b1df3440
4 changed files with 35 additions and 0 deletions

View File

@ -550,6 +550,15 @@ Returns the full name of the launching user.
**Availability**: *when launched by a logged in user*
**Launch Parameter**: *lis_person_name_full*
```
John Doe
```
## Person.name.display
Returns the display name of the launching user.
**Availability**: *when launched by a logged in user*
**Launch Parameter**: *person_name_display*
```
John Doe
```

View File

@ -597,6 +597,17 @@ module Lti
USER_GUARD,
default_name: 'lis_person_name_full'
# Returns the display name of the launching user.
# @launch_parameter lis_person_name_full
# @example
# ```
# John Doe
# ```
register_expansion 'Person.name.display', [],
-> { @current_user.short_name },
USER_GUARD,
default_name: 'person_name_display'
# Returns the last name of the launching user.
# @launch_parameter lis_person_name_family
# @example

View File

@ -81,6 +81,7 @@ module Lti
Person.name.given
Person.name.family
Person.name.full
Person.name.display
Person.sourcedId
User.id
User.image

View File

@ -174,6 +174,7 @@ module Lti
Person.name.given
Person.name.family
Person.name.full
Person.name.display
Person.sourcedId
User.id
User.image
@ -267,6 +268,11 @@ module Lti
expanded = variable_expander.enabled_capability_params(enabled_capability)
expect(expanded.keys).to include 'lis_person_name_full'
end
it 'includes Person.name.display when in enabled capability' do
expanded = variable_expander.enabled_capability_params(enabled_capability)
expect(expanded.keys).to include 'person_name_display'
end
end
end
@ -966,6 +972,14 @@ module Lti
expect(exp_hash[:test]).to eq 'Uncle Jake'
end
it 'has substitution for $Person.name.display' do
user.name = 'Uncle Jake'
user.short_name = 'Unc J'
exp_hash = {test: '$Person.name.display'}
variable_expander.expand_variables!(exp_hash)
expect(exp_hash[:test]).to eq 'Unc J'
end
it 'has substitution for $Person.name.family' do
user.name = 'Uncle Jake'
exp_hash = {test: '$Person.name.family'}