Merge branch 'support/2.7' into support/3.0

# Conflicts:
#	core/config.class.inc.php
This commit is contained in:
Eric Espie
2022-11-30 14:27:32 +01:00
3 changed files with 38 additions and 39 deletions

View File

@@ -576,13 +576,29 @@ class Config
'source_of_value' => '', 'source_of_value' => '',
'show_in_conf_sample' => false, 'show_in_conf_sample' => false,
], ],
'email_css' => [ 'email_transport_smtp.allow_self_signed' => array(
'type' => 'string', 'type' => 'bool',
'description' => 'CSS that will override the standard stylesheet used for the notifications', 'description' => 'Allow self signed peer certificates',
'default' => "", 'default' => false,
'value' => "", 'value' => false,
'source_of_value' => '', 'source_of_value' => '',
'show_in_conf_sample' => false, 'show_in_conf_sample' => false,
),
'email_transport_smtp.verify_peer' => array(
'type' => 'bool',
'description' => 'Verify peer certificate',
'default' => false,
'value' => false,
'source_of_value' => '',
'show_in_conf_sample' => false,
),
'email_css' => [
'type' => 'string',
'description' => 'CSS that will override the standard stylesheet used for the notifications',
'default' => "",
'value' => "",
'source_of_value' => '',
'show_in_conf_sample' => false,
], ],
'email_default_sender_address' => [ 'email_default_sender_address' => [
'type' => 'string', 'type' => 'string',

View File

@@ -66,12 +66,12 @@
<default_value/> <default_value/>
<is_null_allowed>true</is_null_allowed> <is_null_allowed>true</is_null_allowed>
</field> </field>
<field id="client_id" xsi:type="AttributeText"> <field id="client_id" xsi:type="AttributeString">
<sql>client_id</sql> <sql>client_id</sql>
<default_value/> <default_value/>
<is_null_allowed>false</is_null_allowed> <is_null_allowed>false</is_null_allowed>
</field> </field>
<field id="client_secret" xsi:type="AttributeText"> <field id="client_secret" xsi:type="AttributePassword">
<sql>client_secret</sql> <sql>client_secret</sql>
<default_value/> <default_value/>
<is_null_allowed>false</is_null_allowed> <is_null_allowed>false</is_null_allowed>
@@ -318,7 +318,6 @@ HTML
<attributes> <attributes>
<attribute id="provider"/> <attribute id="provider"/>
<attribute id="client_id"/> <attribute id="client_id"/>
<attribute id="client_secret"/>
</attributes> </attributes>
<is_blocking>true</is_blocking> <is_blocking>true</is_blocking>
</rule> </rule>
@@ -481,21 +480,6 @@ HTML
} }
]]></code> ]]></code>
</method> </method>
<method id="OnUpdate">
<static>false</static>
<access>protected</access>
<type>Overload-DBObject</type>
<code><![CDATA[
protected function OnUpdate()
{
$aChanges = $this->ListChanges();
if (array_key_exists('client_id', $aChanges) || array_key_exists('client_secret', $aChanges) || array_key_exists('redirect_url', $aChanges)) {
$sMessage = Dict::S('itop-oauth-client:Message:RegenerateToken');
self::SetSessionMessage(get_class($this), $this->GetKey(), 'RegenerateToken', $sMessage, 'info', 1);
}
}
]]></code>
</method>
<method id="DoCheckToWrite"> <method id="DoCheckToWrite">
<static>false</static> <static>false</static>
<access>public</access> <access>public</access>
@@ -541,6 +525,12 @@ HTML
$this->Set('used_scope', 'advanced'); $this->Set('used_scope', 'advanced');
$this->Set('scope', ''); $this->Set('scope', '');
} }
$aChanges = $this->ListChanges();
if (array_key_exists('client_id', $aChanges) || array_key_exists('client_secret', $aChanges) || array_key_exists('redirect_url', $aChanges)) {
$sMessage = Dict::S('itop-oauth-client:Message:RegenerateToken');
self::SetSessionMessage(get_class($this), $this->GetKey(), 'RegenerateToken', $sMessage, 'info', 1);
$this->Set('status', 'inactive');
}
} }
]]></code> ]]></code>
</method> </method>
@@ -642,7 +632,6 @@ HTML
<attributes> <attributes>
<attribute id="provider"/> <attribute id="provider"/>
<attribute id="client_id"/> <attribute id="client_id"/>
<attribute id="client_secret"/>
</attributes> </attributes>
<is_blocking>true</is_blocking> <is_blocking>true</is_blocking>
</rule> </rule>
@@ -852,6 +841,12 @@ HTML
$this->Set('used_scope', 'advanced'); $this->Set('used_scope', 'advanced');
$this->Set('scope', ''); $this->Set('scope', '');
} }
$aChanges = $this->ListChanges();
if (array_key_exists('client_id', $aChanges) || array_key_exists('client_secret', $aChanges) || array_key_exists('redirect_url', $aChanges)) {
$sMessage = Dict::S('itop-oauth-client:Message:RegenerateToken');
self::SetSessionMessage(get_class($this), $this->GetKey(), 'RegenerateToken', $sMessage, 'info', 1);
$this->Set('status', 'inactive');
}
} }
]]></code> ]]></code>
</method> </method>
@@ -925,21 +920,6 @@ HTML
} }
]]></code> ]]></code>
</method> </method>
<method id="OnUpdate">
<static>false</static>
<access>protected</access>
<type>Overload-DBObject</type>
<code><![CDATA[
protected function OnUpdate()
{
$aChanges = $this->ListChanges();
if (array_key_exists('client_id', $aChanges) || array_key_exists('client_secret', $aChanges) || array_key_exists('redirect_url', $aChanges)) {
$sMessage = Dict::S('itop-oauth-client:Message:RegenerateToken');
self::SetSessionMessage(get_class($this), $this->GetKey(), 'RegenerateToken', $sMessage, 'info', 1);
}
}
]]></code>
</method>
</methods> </methods>
</class> </class>
</classes> </classes>

View File

@@ -159,11 +159,14 @@ class EmailSwiftMailer extends EMail
$sEncryption = static::$m_oConfig->Get('email_transport_smtp.encryption'); $sEncryption = static::$m_oConfig->Get('email_transport_smtp.encryption');
$sUserName = static::$m_oConfig->Get('email_transport_smtp.username'); $sUserName = static::$m_oConfig->Get('email_transport_smtp.username');
$sPassword = static::$m_oConfig->Get('email_transport_smtp.password'); $sPassword = static::$m_oConfig->Get('email_transport_smtp.password');
$bAllowSelfSigned = static::$m_oConfig->Get('email_transport_smtp.allow_self_signed');
$bVerifyPeer = static::$m_oConfig->Get('email_transport_smtp.verify_peer');
$oTransport = new Swift_SmtpTransport($sHost, $sPort, $sEncryption); $oTransport = new Swift_SmtpTransport($sHost, $sPort, $sEncryption);
if (strlen($sUserName) > 0) { if (strlen($sUserName) > 0) {
$oTransport->setUsername($sUserName); $oTransport->setUsername($sUserName);
$oTransport->setPassword($sPassword); $oTransport->setPassword($sPassword);
$oTransport->setStreamOptions(array('ssl' => array('allow_self_signed' => $bAllowSelfSigned, 'verify_peer' => $bVerifyPeer)));
} }
break; break;