N°5102 - Allow to send emails using GSuite SMTP and OAuth - Highlight classes

This commit is contained in:
Eric Espie
2022-07-06 10:10:29 +02:00
parent 237b181eec
commit c759856a61
2 changed files with 30 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ SetupWebPage::AddModule(
'vendor/autoload.php',
'model.itop-oauth-client.php', // Contains the PHP code generated by the "compilation" of datamodel.remote-authent-oauth.xml
'src/Service/PopupMenuExtension.php',
'src/Service/ApplicationUIExtension.php',
),
'webservice' => array(

View File

@@ -0,0 +1,29 @@
<?php
/**
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\OAuthClient\Service;
use AbstractApplicationUIExtension;
use utils;
class ApplicationUIExtension extends AbstractApplicationUIExtension
{
public function GetHilightClass($oObject)
{
// Possible return values are:
// HILIGHT_CLASS_CRITICAL, HILIGHT_CLASS_WARNING, HILIGHT_CLASS_OK, HILIGHT_CLASS_NONE
$oConfig = utils::GetConfig();
$aScopes = $oObject->Get('scope')->GetValues();
if ($oObject->Get('status') == 'inactive') {
return HILIGHT_CLASS_WARNING;
} elseif (in_array('SMTP', $aScopes) && $oConfig->Get('email_transport_smtp.username') == $oObject->Get('name')) {
return HILIGHT_CLASS_OK;
}
return HILIGHT_CLASS_NONE;
}
}