Skip to content

Commit

Permalink
Merge branch 'release-15.19.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Jun 25, 2024
2 parents 0cc1dc6 + a30202e commit d54d525
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion models/classes/LtiService.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
use core_kernel_classes_Property;
use core_kernel_classes_Resource;
use oat\generis\model\GenerisRdf;
use OAT\Library\Lti1p3Core\Message\Payload\Claim\LaunchPresentationClaim;
use OAT\Library\Lti1p3Core\Message\Payload\LtiMessagePayloadInterface;
use OAT\Library\Lti1p3Core\Message\Payload\MessagePayloadInterface;
use OAT\Library\Lti1p3Core\Registration\RegistrationRepositoryInterface;
Expand Down Expand Up @@ -105,6 +106,7 @@ public function createLti1p3Session(
$ltiUser->setUserFirstTimeUri(GenerisRdf::GENERIS_FALSE);
$ltiUser->setUserLatestExtension(self::DEFAULT_USER_EXTENSION);


$userLatestExtensionValue = (string)$user->getOnePropertyValue($userLatestExtension);
if (!empty($userLatestExtensionValue)) {
$ltiUser->setUserLatestExtension($userLatestExtensionValue);
Expand All @@ -123,7 +125,7 @@ public function createLti1p3Session(
$userId->getIdentifier(),
$userId->getName(),
$userId->getEmail(),
$userId->getLocale()
$userId->getLocale() ?? $this->getLocaleFromMessagePayload($messagePayload)
),
new TenantDataSessionContext(end($clientIdParts))
];
Expand Down Expand Up @@ -231,4 +233,13 @@ public static function singleton()
{
return ServiceManager::getServiceManager()->get(static::class);
}

private function getLocaleFromMessagePayload(LtiMessagePayloadInterface $messagePayload): ?string
{
if ($messagePayload && $messagePayload->getLaunchPresentation() instanceof LaunchPresentationClaim) {
return $messagePayload->getLaunchPresentation()->getLocale();
}

return null;
}
}
1 change: 1 addition & 0 deletions models/classes/ServiceProvider/LtiServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public function __invoke(ContainerConfigurator $configurator): void
[
'help' => self::PORTAL_ACCESS_ROLES,
'settings_my_password' => self::PORTAL_ACCESS_ROLES,
'settings_my_settings' => self::PORTAL_ACCESS_ROLES
]
);

Expand Down

0 comments on commit d54d525

Please sign in to comment.