diff --git a/app/Resources/public/css/scorm.css b/app/Resources/public/css/scorm.css index d10ab38c94..3d3e491ffa 100644 --- a/app/Resources/public/css/scorm.css +++ b/app/Resources/public/css/scorm.css @@ -703,6 +703,51 @@ See https://support.chamilo.org/issues/6976 .tabs-right{ text-align: right; } +#learning_path_toc .panel-default{ + border: none; + box-shadow: none; +} +.status-heading .panel-heading{ + padding: 0; +} +.status-heading .panel-heading .item-header{ + padding: 10px 15px 10px 30px; + display: inline-block; + width: 100%; + color: #333333; + font-weight: bold; + background: url("../../main/img/scorm/folder-item-open.png") #f5f5f5 no-repeat 10px center; +} +#learning_path_toc .child_item.lp_item_type_document.scorm_completed{ + background: url(../../main/img/icons/svg/check-completed.svg) #FFFFFF right center no-repeat; +} +#learning_path_toc .child_item.lp_item_type_document.scorm_not_attempted{ + background: url(../../main/img/icons/svg/check-not-attempted.svg) #FFFFFF right center no-repeat; +} +#learning_path_toc .root_item.lp_item_type_document.scorm_completed{ + background: url(../../main/img/icons/svg/check-completed.svg) #FFFFFF right center no-repeat; +} +#learning_path_toc .root_item.lp_item_type_document.scorm_not_attempted{ + background: url(../../main/img/icons/svg/check-not-attempted.svg) #FFFFFF right center no-repeat; +} +#learning_path_toc .root_item.lp_item_type_document.current_item{ + background-color: #f1f4f9; +} +#learning_path_toc .child_item.lp_item_type_document.current_item{ + background-color: #f1f4f9; +} +.status-heading .panel-heading .item-action{ + padding: 10px 15px; + display: inline-block; + width: 100%; + background-color: transparent; + color: #525252; + border-left: 1px solid #cdcdcd; +} +#learning_path_toc .panel-collapse .panel-body{ + padding: 10px 0 10px 10px; +} + /* END LP VIEW COLLAPSE */ /* Small devices (tablets, 768px and up) */ @media (min-width: 768px) { diff --git a/main/auth/external_login/login.azure.php b/main/auth/external_login/login.azure.php new file mode 100644 index 0000000000..cdd12b0990 --- /dev/null +++ b/main/auth/external_login/login.azure.php @@ -0,0 +1,41 @@ +get(AzureActiveDirectory::SETTING_ENABLE)) { + api_not_allowed(true); +} + +$azureIdField = new ExtraFieldValue('user'); +$azureIdValue = $azureIdField->get_values_by_handler_and_field_variable( + $uData['user_id'], + AzureActiveDirectory::EXTRA_FIELD_AZURE_ID +); + +if (empty($azureIdValue) || empty($azureIdValue['value'])) { + api_not_allowed(true); +} + +$organsationEmailField = new ExtraFieldValue('user'); +$organsationEmailValue = $organsationEmailField->get_values_by_handler_and_field_variable( + $uData['user_id'], + AzureActiveDirectory::EXTRA_FIELD_ORGANISATION_EMAIL +); + +if (empty($organsationEmailValue) || empty($organsationEmailValue['value'])) { + api_not_allowed(true); +} + +$provider = $plugin->getProvider(); + +$authUrl = $provider->getAuthorizationUrl(['login_hint' => $organsationEmailValue['value']]); + +ChamiloSession::write('oauth2state', $provider->getState()); + +header('Location: '.$authUrl); +exit; diff --git a/plugin/azure_active_directory/README.md b/plugin/azure_active_directory/README.md index d91db27bd2..39f2426f6c 100644 --- a/plugin/azure_active_directory/README.md +++ b/plugin/azure_active_directory/README.md @@ -1,6 +1,10 @@ # The Azure Active Directory Plugin Allow authentication (with OAuth2) with Microsoft's Azure Active Directory. +This plugin add two extra fields for users: +- `organisationemail`, the email registered in Azure Active Directory for each user. +- `azure_id`, to save the internal ID for each user in Azure. + > This plugin use the [`thenetworg/oauth2-azure`](https://github.com/TheNetworg/oauth2-azure) package. ### To configure Azure Active Directory @@ -17,5 +21,10 @@ Allow authentication (with OAuth2) with Microsoft's Azure Active Directory. * _Management login_: (Optional) Disable the chamilo login and enable an alternative login page for users. You will need copy the `/plugin/azure_active_directory/layout/login_form.tpl` file to `/main/template/overrides/layout/` directory. * _Name for the management login_: A name for the management login. By default is "Management Login". +* And assign a region. Preferably `login_bottom`. -And assign a region. Preferably `login_bottom`. +Also, you can configure the external login to work with the classic Chamilo form login. +Adding this line in `configuration.php` file. +```php +$extAuthSource["azure"]["login"] = $_configuration['root_sys']."main/auth/external_login/login.azure.php"; +``` diff --git a/plugin/azure_active_directory/src/callback.php b/plugin/azure_active_directory/src/callback.php index 70bb97653c..5f989ff5e5 100644 --- a/plugin/azure_active_directory/src/callback.php +++ b/plugin/azure_active_directory/src/callback.php @@ -47,7 +47,7 @@ if (!empty($me['email'])) { if (empty($userInfo) && !empty($me['email'])) { $extraFieldValue = new ExtraFieldValue('user'); $itemValue = $extraFieldValue->get_item_id_from_field_variable_and_field_value( - 'organisationemail', + AzureActiveDirectory::EXTRA_FIELD_ORGANISATION_EMAIL, $me['email'] ); @@ -57,7 +57,7 @@ if (empty($userInfo) && !empty($me['email'])) { if (empty($userInfo) && !empty($me['mailNickname'])) { $extraFieldValue = new ExtraFieldValue('user'); $itemValue = $extraFieldValue->get_item_id_from_field_variable_and_field_value( - 'azure_id', + AzureActiveDirectory::EXTRA_FIELD_AZURE_ID, $me['mailNickname'] );