Skip to content

Commit

Permalink
Merge pull request #92 from oat-sa/release-3.4.3
Browse files Browse the repository at this point in the history
Release 3.4.3
  • Loading branch information
Aleh Hutnikau authored Oct 23, 2017
2 parents a954967 + 261e260 commit 6d462ed
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
2 changes: 1 addition & 1 deletion manifest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
'label' => 'LTI library',
'description' => 'TAO LTI library and helpers',
'license' => 'GPL-2.0',
'version' => '3.4.2',
'version' => '3.4.3',
'author' => 'Open Assessment Technologies SA',
'requires' => array(
'tao' => '>=10.8.0'
Expand Down
17 changes: 13 additions & 4 deletions models/classes/user/OntologyLtiUserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,23 @@ public function findUser(\taoLti_models_classes_LtiLaunchData $ltiContext)
);

$roles = $this->determineTaoRoles($ltiContext);

$ltiUser = new LtiUser($ltiContext, $instance->getUri(), $properties[PROPERTY_USER_ROLES], (string)current($properties[PROPERTY_USER_UILG]), (string)current($properties[PROPERTY_USER_FIRSTNAME]), (string)current($properties[PROPERTY_USER_LASTNAME]), (string)current($properties[PROPERTY_USER_MAIL]));
$lang = current($properties[PROPERTY_USER_UILG]);

// In case of the language is a Language Resource in Ontology, get its code.
if ($lang instanceof \core_kernel_classes_Resource) {
$lang = \tao_models_classes_LanguageService::singleton()->getCode($lang);
} elseif (empty($lang)) {
$lang = DEFAULT_LANG;
}

$ltiUser = new LtiUser($ltiContext, $instance->getUri(), $properties[PROPERTY_USER_ROLES], $lang, (string)current($properties[PROPERTY_USER_FIRSTNAME]), (string)current($properties[PROPERTY_USER_LASTNAME]), (string)current($properties[PROPERTY_USER_MAIL]));

if($roles !== array(INSTANCE_ROLE_LTI_BASE)){
$ltiUser->setRoles($roles);
$instance->editPropertyValues(new \core_kernel_classes_Property(PROPERTY_USER_ROLES), $roles);
}

\common_Logger::t("LTI User '" . $ltiUser->getIdentifier() . "' found.");
return $ltiUser;
} else {
return null;
Expand Down Expand Up @@ -131,7 +140,6 @@ public function getUserIdentifier($userId, $ltiConsumer)
public function spawnUser(\taoLti_models_classes_LtiLaunchData $ltiContext)
{
$class = new \core_kernel_classes_Class(self::CLASS_LTI_USER);
//$lang = tao_models_classes_LanguageService::singleton()->getLanguageByCode(DEFAULT_LANG);

$props = array(
self::PROPERTY_USER_LTIKEY => $ltiContext->getUserID(),
Expand All @@ -149,7 +157,8 @@ public function spawnUser(\taoLti_models_classes_LtiLaunchData $ltiContext)
$uiLanguage = DEFAULT_LANG;
}

$props[PROPERTY_USER_UILG] = $uiLanguage;
$languageResource = \tao_models_classes_LanguageService::singleton()->getLanguageByCode($uiLanguage);
$props[PROPERTY_USER_UILG] = $languageResource->getUri();

if ($ltiContext->hasVariable(\taoLti_models_classes_LtiLaunchData::LIS_PERSON_NAME_FULL)) {
$label = $ltiContext->getUserFullName();
Expand Down
2 changes: 1 addition & 1 deletion scripts/update/class.Updater.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function update($initialVersion)

$this->setVersion('3.4.0');
}
$this->skip('3.4.0', '3.4.2');
$this->skip('3.4.0', '3.4.3');

}
}

0 comments on commit 6d462ed

Please sign in to comment.