mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 18:18:46 +02:00
N°5430 - OAuth authentication : customize redirect landing URL
This commit is contained in:
@@ -441,6 +441,21 @@
|
||||
}
|
||||
]]></code>
|
||||
</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">
|
||||
<static>false</static>
|
||||
<access>public</access>
|
||||
@@ -450,15 +465,13 @@
|
||||
parent::DoCheckToWrite();
|
||||
|
||||
$aChanges = $this->ListChanges();
|
||||
if (array_key_exists('name', $aChanges) || array_key_exists('used_for_smtp', $aChanges))
|
||||
{
|
||||
if (array_key_exists('name', $aChanges) || array_key_exists('used_for_smtp', $aChanges)) {
|
||||
$sNewName = $this->Get('name');
|
||||
$sNewUseForSMTP = $this->Get('used_for_smtp');
|
||||
if ($sNewUseForSMTP == 'yes') {
|
||||
$oSearch = DBObjectSearch::FromOQL_AllData("SELECT OAuthClientGoogle WHERE name = :newname AND used_for_smtp = :newuseforsmtp AND id != :id UNION SELECT OAuthClientAzure WHERE name = :newname AND used_for_smtp = :newuseforsmtp AND id != :id");
|
||||
$oSet = new DBObjectSet($oSearch, array(), ['id' => $this->GetKey(), 'newname' => $sNewName, 'newuseforsmtp' => $sNewUseForSMTP]);
|
||||
if ($oSet->Count() > 0)
|
||||
{
|
||||
if ($oSet->Count() > 0) {
|
||||
$this->m_aCheckIssues[] = Dict::Format('OAuthClient:Name/UseForSMTPMustBeUnique', $sNewName, $sNewUseForSMTP);
|
||||
}
|
||||
}
|
||||
@@ -500,7 +513,6 @@
|
||||
{
|
||||
switch ($sAttCode) {
|
||||
case 'provider':
|
||||
case 'redirect_url':
|
||||
case 'used_scope':
|
||||
return OPT_ATT_READONLY;
|
||||
}
|
||||
@@ -518,7 +530,6 @@
|
||||
{
|
||||
switch ($sAttCode) {
|
||||
case 'provider':
|
||||
case 'redirect_url':
|
||||
case 'used_scope':
|
||||
return OPT_ATT_READONLY;
|
||||
}
|
||||
@@ -800,7 +811,6 @@
|
||||
{
|
||||
switch ($sAttCode) {
|
||||
case 'provider':
|
||||
case 'redirect_url':
|
||||
case 'used_scope':
|
||||
return OPT_ATT_READONLY;
|
||||
}
|
||||
@@ -818,7 +828,6 @@
|
||||
{
|
||||
switch ($sAttCode) {
|
||||
case 'provider':
|
||||
case 'redirect_url':
|
||||
case 'used_scope':
|
||||
return OPT_ATT_READONLY;
|
||||
}
|
||||
@@ -863,6 +872,21 @@
|
||||
}
|
||||
]]></code>
|
||||
</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>
|
||||
</class>
|
||||
</classes>
|
||||
|
||||
@@ -19,6 +19,7 @@ Dict::Add('EN US', 'English', 'English', [
|
||||
'itop-oauth-client:TestSMTP' => 'Email send test',
|
||||
'itop-oauth-client:MissingOAuthClient' => 'Missing Oauth client for user name %1$s',
|
||||
'itop-oauth-client:Message:MissingToken' => 'Generate access token before using this OAuth client',
|
||||
'itop-oauth-client:Message:RegenerateToken' => 'Regenerate access token to to take into account the changes',
|
||||
'itop-oauth-client:Message:TokenCreated' => 'Access token created',
|
||||
'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated',
|
||||
'itop-oauth-client:Message:TokenError' => 'Access token not generated due to server error',
|
||||
|
||||
@@ -19,6 +19,7 @@ Dict::Add('FR FR', 'French', 'Français', [
|
||||
'itop-oauth-client:TestSMTP' => 'Tester l\'envoi de mail',
|
||||
'itop-oauth-client:MissingOAuthClient' => 'Il n\'y a pas de client OAuth pour l\'utilisateur %1$s',
|
||||
'itop-oauth-client:Message:MissingToken' => 'Générez le jeton d\'accès avant d\'utiliser ce client OAuth',
|
||||
'itop-oauth-client:Message:RegenerateToken' => 'Re-générez le jeton d\'accès prendre en compte les modifications',
|
||||
'itop-oauth-client:Message:TokenCreated' => 'Le jeton d\'accès à été créé',
|
||||
'itop-oauth-client:Message:TokenRecreated' => 'Le jeton d\'accès à été renouvelé',
|
||||
'itop-oauth-client:Message:TokenError' => 'Le jeton d\'accès n\'a pas été généré à cause d`une erreur serveur',
|
||||
|
||||
Reference in New Issue
Block a user