Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

pull/3048/head
Julio 6 years ago
commit 01ed20192f
  1. 45
      app/Resources/public/css/scorm.css
  2. 41
      main/auth/external_login/login.azure.php
  3. 11
      plugin/azure_active_directory/README.md
  4. 4
      plugin/azure_active_directory/src/callback.php

@ -703,6 +703,51 @@ See https://support.chamilo.org/issues/6976
.tabs-right{ .tabs-right{
text-align: 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 */ /* END LP VIEW COLLAPSE */
/* Small devices (tablets, 768px and up) */ /* Small devices (tablets, 768px and up) */
@media (min-width: 768px) { @media (min-width: 768px) {

@ -0,0 +1,41 @@
<?php
/* For licensing terms, see /license.txt */
require_once __DIR__.'/functions.inc.php';
/** @var array $uData */
$plugin = AzureActiveDirectory::create();
if ('true' !== $plugin->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;

@ -1,6 +1,10 @@
# The Azure Active Directory Plugin # The Azure Active Directory Plugin
Allow authentication (with OAuth2) with Microsoft's Azure Active Directory. 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. > This plugin use the [`thenetworg/oauth2-azure`](https://github.com/TheNetworg/oauth2-azure) package.
### To configure Azure Active Directory ### 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. * _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. 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". * _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";
```

@ -47,7 +47,7 @@ if (!empty($me['email'])) {
if (empty($userInfo) && !empty($me['email'])) { if (empty($userInfo) && !empty($me['email'])) {
$extraFieldValue = new ExtraFieldValue('user'); $extraFieldValue = new ExtraFieldValue('user');
$itemValue = $extraFieldValue->get_item_id_from_field_variable_and_field_value( $itemValue = $extraFieldValue->get_item_id_from_field_variable_and_field_value(
'organisationemail', AzureActiveDirectory::EXTRA_FIELD_ORGANISATION_EMAIL,
$me['email'] $me['email']
); );
@ -57,7 +57,7 @@ if (empty($userInfo) && !empty($me['email'])) {
if (empty($userInfo) && !empty($me['mailNickname'])) { if (empty($userInfo) && !empty($me['mailNickname'])) {
$extraFieldValue = new ExtraFieldValue('user'); $extraFieldValue = new ExtraFieldValue('user');
$itemValue = $extraFieldValue->get_item_id_from_field_variable_and_field_value( $itemValue = $extraFieldValue->get_item_id_from_field_variable_and_field_value(
'azure_id', AzureActiveDirectory::EXTRA_FIELD_AZURE_ID,
$me['mailNickname'] $me['mailNickname']
); );

Loading…
Cancel
Save