Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/dev/v3-2-0' into issue/735-fix…
Browse files Browse the repository at this point in the history
…-dockerfile-typo
  • Loading branch information
rob-3 committed Jan 31, 2022
2 parents 5666e73 + abd57fc commit 582d730
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 33 deletions.
2 changes: 1 addition & 1 deletion config/packages/prod/monolog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ monolog:
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
nested:
type: stream
path: "%kernel.logs_dir%/%kernel.environment%.log"
path: "php://stderr"
level: debug
console:
type: console
Expand Down
34 changes: 2 additions & 32 deletions src/Controller/LtiController.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,7 @@ public function ltiAuthorizeCheck(

if (isset($token->{'https://purl.imsglobal.org/spec/lti/claim/target_link_uri'})) {
$redirectUrl = $token->{'https://purl.imsglobal.org/spec/lti/claim/target_link_uri'} . '?auth_token=' . $this->session->getUuid();

// Avoid a never-ending redirect loop
if (strpos($redirectUrl, $this->request->getRequestUri()) === false) {
return $this->redirect($redirectUrl);
}
return $this->redirect($redirectUrl);
}

return $this->redirectToRoute('dashboard',
Expand Down Expand Up @@ -243,14 +239,6 @@ protected function saveTokenToSession($token)
}
}

// Context is optional and contains a unique id, label, title, and type
if (!empty($token->{'https://purl.imsglobal.org/spec/lti/claim/context'})) {
$contextFields = (array) $token->{'https://purl.imsglobal.org/spec/lti/claim/context'};
foreach ($contextFields as $key => $val) {
$this->session->set('lms_course_' . $key, $val);
}
}

$roles = [];
if (!empty($token->{'https://purl.imsglobal.org/spec/lti/claim/roles'})) {
$roleFields = (array) $token->{'https://purl.imsglobal.org/spec/lti/claim/roles'};
Expand All @@ -261,28 +249,10 @@ protected function saveTokenToSession($token)
}
$this->session->set('roles', array_values(array_unique($roles)));

// Full display name including titles and suffixes displayed according to user locale/pref
if (!empty($token->name)) {
if (isset($token->name)) {
$this->session->set('lms_user_name', $token->name);
}

if (!empty($token->given_name)) {
$this->session->set('lms_user_given_name', $token->given_name);
}

if (!empty($token->family_name)) {
$this->session->set('lms_user_family_name', $token->family_name);
}

if (!empty($token->email)) {
$this->session->set('lms_user_email', $token->email);
}

// Required except for anonymous launches; this is stable over time and may not be display friendly
if (!empty($token->sub)) {
$this->session->set('lms_user_id', $token->sub);
}

$lms->saveTokenToSession($token);
}
catch (\Exception $e) {
Expand Down
5 changes: 5 additions & 0 deletions src/Lms/D2l/D2lLms.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ public function saveTokenToSession($token)
{
$session = $this->sessionService->getSession();

$contextFields = (array) $token->{'https://purl.imsglobal.org/spec/lti/claim/context'};
foreach ($contextFields as $key => $val) {
$session->set('lms_course_' . $key, $val);
}

$brightspaceFields = (array) $token->{'http://www.brightspace.com'};
foreach ($brightspaceFields as $key => $val) {
$session->set('lms_' . $key, $val);
Expand Down

0 comments on commit 582d730

Please sign in to comment.