diff --git a/datamodels/2.x/itop-oauth-client/datamodel.itop-oauth-client.xml b/datamodels/2.x/itop-oauth-client/datamodel.itop-oauth-client.xml index fb01d1d82..e7cd66a27 100644 --- a/datamodels/2.x/itop-oauth-client/datamodel.itop-oauth-client.xml +++ b/datamodels/2.x/itop-oauth-client/datamodel.itop-oauth-client.xml @@ -484,6 +484,21 @@ HTML } ]]> + + false + protected + Overload-DBObject + 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); + } + } + ]]> + false public @@ -493,15 +508,13 @@ HTML 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); } } @@ -543,7 +556,6 @@ HTML { switch ($sAttCode) { case 'provider': - case 'redirect_url': case 'used_scope': return OPT_ATT_READONLY; } @@ -561,7 +573,6 @@ HTML { switch ($sAttCode) { case 'provider': - case 'redirect_url': case 'used_scope': return OPT_ATT_READONLY; } @@ -856,7 +867,6 @@ HTML { switch ($sAttCode) { case 'provider': - case 'redirect_url': case 'used_scope': return OPT_ATT_READONLY; } @@ -874,7 +884,6 @@ HTML { switch ($sAttCode) { case 'provider': - case 'redirect_url': case 'used_scope': return OPT_ATT_READONLY; } @@ -919,6 +928,21 @@ HTML } ]]> + + false + protected + Overload-DBObject + 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); + } + } + ]]> + diff --git a/datamodels/2.x/itop-oauth-client/en.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/en.dict.itop-oauth-client.php index 5c3a66132..b64e1c838 100644 --- a/datamodels/2.x/itop-oauth-client/en.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/en.dict.itop-oauth-client.php @@ -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', @@ -58,7 +59,11 @@ Dict::Add('EN US', 'English', 'English', [ 'Class:OAuthClient/Attribute:token_expiration' => 'Access token expiration', 'Class:OAuthClient/Attribute:token_expiration+' => '', 'Class:OAuthClient/Attribute:redirect_url' => 'Redirect url', - 'Class:OAuthClient/Attribute:redirect_url+' => 'This url must be copied in the OAuth2 configuration of the provider', + 'Class:OAuthClient/Attribute:redirect_url+' => << 'Mailbox list', 'Class:OAuthClient/Attribute:mailbox_list+' => '', ]); diff --git a/datamodels/2.x/itop-oauth-client/fr.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/fr.dict.itop-oauth-client.php index 339538d52..b747f91e0 100644 --- a/datamodels/2.x/itop-oauth-client/fr.dict.itop-oauth-client.php +++ b/datamodels/2.x/itop-oauth-client/fr.dict.itop-oauth-client.php @@ -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', @@ -58,7 +59,11 @@ Dict::Add('FR FR', 'French', 'Français', [ 'Class:OAuthClient/Attribute:token_expiration' => 'Date d\'expiration du jeton d\'accès', 'Class:OAuthClient/Attribute:token_expiration+' => '', 'Class:OAuthClient/Attribute:redirect_url' => 'URL de redirection', - 'Class:OAuthClient/Attribute:redirect_url+' => 'Cet URL doit être recopié dans la configuration OAuth2 de votre fournisseur', + 'Class:OAuthClient/Attribute:redirect_url+' => << 'Mailbox list', 'Class:OAuthClient/Attribute:mailbox_list+' => '', ]);