@ -227,7 +227,10 @@ class AzureActiveDirectory extends Plugin
if (empty($userId)) {
// If we didn't find the user
if ($this->get(self::SETTING_PROVISION_USERS) === 'true') {
if ($this->get(self::SETTING_PROVISION_USERS) !== 'true') {
throw new Exception('User not found when checking the extra fields from ' . $azureUserInfo['mail'] . ' or ' . $azureUserInfo['mailNickname'] . ' or ' . $azureUserInfo[$azureUidKey] . '.');
}
[
$firstNme,
$lastName,
@ -262,13 +265,14 @@ class AzureActiveDirectory extends Plugin
null,
$isAdmin
);
if (!$userId) {
throw new Exception(get_lang('UserNotAdded').' '.$azureUserInfo['userPrincipalName']);
throw new Exception(get_lang('UserNotAdded').' '.$azureUserInfo['userPrincipalName']);
}
} else {
throw new Exception('User not found when checking the extra fields from '.$azureUserInfo['mail'].'or '.$azureUserInfo['mailNickname'].' or '.$azureUserInfo[$azureUidKey].'.');
return $userId;
}
} else {
if ($this->get(self::SETTING_UPDATE_USERS) === 'true') {
[
$firstNme,
@ -306,25 +310,33 @@ class AzureActiveDirectory extends Plugin
throw new Exception(get_lang('CouldNotUpdateUser').' '.$azureUserInfo['userPrincipalName']);