Skip to content

Commit

Permalink
Merge branch 'release-15.18.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Mar 19, 2024
2 parents 8168f6e + 1fa41ff commit 97aeffc
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"oat-sa/lib-lti1p3-ags": "^1.2",
"oat-sa/lib-lti1p3-core": "^6.0.0",
"oat-sa/generis" : ">=15.22",
"oat-sa/tao-core" : ">=50.24.6"
"oat-sa/tao-core" : ">=54.8.0"
},
"autoload" : {
"psr-4" : {
Expand Down
21 changes: 20 additions & 1 deletion models/classes/LtiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
use oat\oatbox\service\ConfigurableService;
use oat\oatbox\service\ServiceManager;
use oat\oatbox\session\SessionService;
use oat\tao\model\session\Context\TenantDataSessionContext;
use oat\tao\model\session\Context\UserDataSessionContext;
use oat\tao\model\TaoOntology;
use oat\taoLti\models\classes\LtiMessages\LtiErrorMessage;
use oat\taoLti\models\classes\user\Lti1p3User;
Expand Down Expand Up @@ -111,10 +113,27 @@ public function createLti1p3Session(

$ltiUser->setRegistrationId($registration->getIdentifier());

$session = TaoLtiSession::fromVersion1p3($ltiUser);
$contexts = [];
if ($clientId) {
$userId = $messagePayload->getUserIdentity();
$clientIdParts = explode('-', $clientId);
$contexts = [
new UserDataSessionContext(
$userId->getIdentifier(),
$userId->getIdentifier(),
$userId->getName(),
$userId->getEmail(),
$userId->getLocale()
),
new TenantDataSessionContext(end($clientIdParts))
];
}

$session = TaoLtiSession::fromVersion1p3($ltiUser, $contexts);

$this->getServiceLocator()->propagate($session);


return $session;
} catch (LtiInvalidVariableException $e) {
$this->logInfo($e->getMessage());
Expand Down
8 changes: 4 additions & 4 deletions models/classes/TaoLtiSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ class TaoLtiSession extends common_session_DefaultSession
/** @var string */
private $version = self::VERSION_LTI_1P1;

public function __construct(LtiUserInterface $user)
public function __construct(LtiUserInterface $user, array $contexts = [])
{
parent::__construct($user);
parent::__construct($user, $contexts);
}

public static function fromVersion1p3(LtiUserInterface $user): self
public static function fromVersion1p3(LtiUserInterface $user, array $contexts = []): self
{
$session = new self($user);
$session = new self($user, $contexts);

$session->version = self::VERSION_LTI_1P3;

Expand Down

0 comments on commit 97aeffc

Please sign in to comment.