Currently, if a tool is launched in the context of a Group, all
all Course-related LTI variable expansions will not be expanded, even if
the Group's context is a Course.
This commit:
1. Expands all COURSE_GUARD, TERM_*_GUARD, ENROLLMENT_GUARD,
and STUDENT_ASSIGNMENT_GUARD lti variable expansions, which previously
required a Course context, to work with a Group with a Course context.
Namely, if @context is a course, they will use @context.context as the
Course. Examples: Canvas.course.{id, name, startAt...}
2. Expands ROLES_GUARD permissions to work when context is a Group.
These previously only worked when context was a Course or Group. For
the first two (com.Instructure.membership.roles and
Canvas.membership.roles) we simply use the enrollments from the
Group's Account (or Group's Course and Account, if Group has a
course). For `Canvas.membership.permissions` we check grants_right?
directly on the @context (Group)
3. Also fixes the following expansions to be consistent for groups (give
account, not root account):
- Canvas.account.id
- Canvas.account.name
- Canvas.account.sisSourceId
4. Incidentally, due to the change of helper functions, the following
expansions were also affected in that they now include roles from the
Course if the @context is a Group with a Course context:
- Membership.role
- Canvas.xuser.allRoles
- com.instructure.User.allRoles
See comments in ticket for full list of expansions affected.
Test plan:
- create a course in a subaccount
- make a Group in that course
- make an LTI tool in the account level that has variable expansions in
custom fields -- at least one for each of the types of changes
enumerated above. The tool should have the editor_button placement. (I
couldn't seen to find any other placements shown in a page with a
Group context...)
- launch the tool and check the custom variable expansions.
- turn the lti_variable_expansions_use_group_course_as_course flag off
and relaunch the tool. The variable expansions should be as they were
before this commit (likely unexpanded).
closes INTEROP-8737
flag = lti_variable_expansions_use_group_course_as_course
[fsc-max-nodes=18]
[fsc-timeout=40]
Change-Id: I4fffc6b5f91f8578a1e8b13907523e1372050f7f
Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/352964
Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com>
Reviewed-by: Ryan Hawkins <ryan.hawkins@instructure.com>
QA-Review: Paul Gray <paul.gray@instructure.com>
Product-Review: Alexis Nast <alexis.nast@instructure.com>