diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 66115b22a..efc31737b 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -341,13 +341,17 @@ JS } /** - * Important: For compatibility reasons, this function still allows to manipulate the $oPage. In that case, markup will be put above the real header of the panel. - * To insert something IN the panel, we now need to add UIBlocks in either the "subtitle" or "toolbar" sections of the array that will be returned. + * @param \WebPage $oPage warning, since 3.0.0 this parameter was kept for compatibility reason. You shouldn't write directly on the page ! + * When writing to the page, markup will be put above the real header of the panel. + * To insert something IN the panel, we now need to add UIBlocks in either the "subtitle" or "toolbar" sections of the array that will be returned. + * @param bool $bEditMode Deprecated parameter in iTop 3.0.0, use {@see GetDisplayMode()} and ENUM_DISPLAY_MODE_* constants instead * - * @param \WebPage $oPage - * @param bool $bEditMode Note that this parameter is no longer used in this method. Use {@see static::$sDisplayMode} instead - * - * @return array UIBlocks to be inserted in the "subtitle" and the "toolbar" sections of the ObjectDetails block. eg. ['subtitle' => [, ], 'toolbar' => []] + * @return array{ + * subtitle: \Combodo\iTop\Application\UI\Base\UIBlock[], + * toolbar: \Combodo\iTop\Application\UI\Base\UIBlock[] + * } + * blocks to be inserted in the "subtitle" and the "toolbar" sections of the ObjectDetails block. + * eg. ['subtitle' => [, ], 'toolbar' => []] * * @throws \ApplicationException * @throws \ArchivedObjectException @@ -356,7 +360,10 @@ JS * @throws \MySQLException * @throws \OQLException * - * @since 3.0.0 $bEditMode is deprecated and no longer used + * @since 3.0.0 $bEditMode is deprecated, see param documentation above + * @since 3.0.0 changed signature : method must return header content in an array (no more writing directly to the $oPage) + * + * @noinspection PhpUnusedParameterInspection */ public function DisplayBareHeader(WebPage $oPage, $bEditMode = false) { diff --git a/core/config.class.inc.php b/core/config.class.inc.php index ee3612c2e..536d0946c 100644 --- a/core/config.class.inc.php +++ b/core/config.class.inc.php @@ -576,46 +576,6 @@ class Config 'source_of_value' => '', 'show_in_conf_sample' => false, ], - 'email_transport_smtp.oauth.provider' => [ - 'type' => 'string', - 'description' => 'Email OAuth provider', - 'default' => '', - 'value' => '', - 'source_of_value' => '', - 'show_in_conf_sample' => false, - ], - 'email_transport_smtp.oauth.client_id' => [ - 'type' => 'string', - 'description' => 'Email OAuth client id', - 'default' => '', - 'value' => '', - 'source_of_value' => '', - 'show_in_conf_sample' => false, - ], - 'email_transport_smtp.oauth.client_secret' => [ - 'type' => 'string', - 'description' => 'Email OAuth client secret', - 'default' => '', - 'value' => '', - 'source_of_value' => '', - 'show_in_conf_sample' => false, - ], - 'email_transport_smtp.oauth.access_token' => [ - 'type' => 'string', - 'description' => 'Email OAuth access token', - 'default' => '', - 'value' => '', - 'source_of_value' => '', - 'show_in_conf_sample' => false, - ], - 'email_transport_smtp.oauth.refresh_token' => [ - 'type' => 'string', - 'description' => 'Email OAuth refresh token', - 'default' => '', - 'value' => '', - 'source_of_value' => '', - 'show_in_conf_sample' => false, - ], 'email_css' => [ 'type' => 'string', 'description' => 'CSS that will override the standard stylesheet used for the notifications', diff --git a/core/ormcaselog.class.inc.php b/core/ormcaselog.class.inc.php index 2d024fa31..950ff0627 100644 --- a/core/ormcaselog.class.inc.php +++ b/core/ormcaselog.class.inc.php @@ -155,7 +155,7 @@ class ormCaseLog { break; case static::ENUM_FORMAT_HTML: - $sHtmlEntry = $sTextEntry; + $sHtmlEntry = InlineImage::FixUrls($sTextEntry); $sTextEntry = utils::HtmlToText($sHtmlEntry); break; } @@ -723,7 +723,7 @@ class ormCaseLog { } else { - $sRes = $sRaw; + $sRes = InlineImage::FixUrls($sRaw); } break; } @@ -758,6 +758,6 @@ class ormCaseLog { } $iPos += $this->m_aIndex[$index]['separator_length']; $sText = substr($this->m_sLog, $iPos, $this->m_aIndex[$index]['text_length']); - return $sText; + return InlineImage::FixUrls($sText); } } diff --git a/datamodels/2.x/installation.xml b/datamodels/2.x/installation.xml index 330736741..1812f6a94 100755 --- a/datamodels/2.x/installation.xml +++ b/datamodels/2.x/installation.xml @@ -21,6 +21,7 @@ combodo-db-tools itop-core-update itop-hub-connector + itop-oauth-client combodo-backoffice-darkmoon-theme itop-themes-compat diff --git a/datamodels/2.x/itop-oauth-client/README.md b/datamodels/2.x/itop-oauth-client/README.md new file mode 100644 index 000000000..a520ac75c --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/README.md @@ -0,0 +1,2 @@ +# Extension OAuth 2.0 client + diff --git a/datamodels/2.x/itop-oauth-client/ajax.php b/datamodels/2.x/itop-oauth-client/ajax.php new file mode 100644 index 000000000..1b81b0829 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/ajax.php @@ -0,0 +1,24 @@ += 0) { + $sTemplates = MODULESROOT.'itop-oauth-client/templates'; +} else { + $sTemplates = MODULESROOT.'itop-oauth-client/templates/legacy'; +} + +$oUpdateController = new AjaxOauthClientController($sTemplates, 'itop-oauth-client'); +$oUpdateController->AllowOnlyAdmin(); +$oUpdateController->SetDefaultOperation('CreateMailbox'); +$oUpdateController->HandleOperation(); + + diff --git a/images/icons/icons8-azure.svg b/datamodels/2.x/itop-oauth-client/assets/img/icons8-azure.svg similarity index 100% rename from images/icons/icons8-azure.svg rename to datamodels/2.x/itop-oauth-client/assets/img/icons8-azure.svg diff --git a/images/icons/icons8-google.svg b/datamodels/2.x/itop-oauth-client/assets/img/icons8-google.svg similarity index 100% rename from images/icons/icons8-google.svg rename to datamodels/2.x/itop-oauth-client/assets/img/icons8-google.svg diff --git a/datamodels/2.x/itop-oauth-client/assets/js/oauth_connect.js b/datamodels/2.x/itop-oauth-client/assets/js/oauth_connect.js new file mode 100644 index 000000000..1ce571112 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/assets/js/oauth_connect.js @@ -0,0 +1,99 @@ +/** + * @copyright Copyright (C) 2010-2022 Combodo SARL + * @license http://opensource.org/licenses/AGPL-3.0 + */ + +// Function used to open OAuth popup +var oWindowObjectReference = null; +var sPreviousUrl = null; +var oListener = null; +var sOAuthAjaxURI = null; +var sOAuthObjClass = null; +var sOAuthObjKey = null; +var sOAuthReturnURI = null; + + +const oOnOauthSuccess = function (event) { + if (oListener !== null) { + clearInterval(oListener); + } + + $.post( + sOAuthAjaxURI, + { + operation: 'GetDisplayAuthenticationResults', + class: sOAuthObjClass, + id: sOAuthObjKey, + redirect_url: event.data + }, + function (oData) { + window.location = oData.data; + } + ); +} +const oOpenSignInWindow = function (url, name) { + // Remove any existing event listener + window.removeEventListener('message', oOnOauthSuccess); + if (oListener !== null) { + clearInterval(oListener); + } + + // Window features + const sWindowFeatures = 'toolbar=no, menubar=no, width=600, height=700, top=100, left=100'; + + if (oWindowObjectReference === null || oWindowObjectReference.closed) { + /* If the pointer to the window object in memory does not exist + or if such pointer exists but the window was closed */ + oWindowObjectReference = window.open(url, name, sWindowFeatures); + } else if (sPreviousUrl !== url) { + /* If the resource to load is different, + then we load it in the already opened secondary window, and then + we bring such window back on top/in front of its parent window. */ + oWindowObjectReference = window.open(url, name, sWindowFeatures); + oWindowObjectReference.focus(); + } else { + /* Else the window reference must exist and the window + is not closed; therefore, we can bring it back on top of any other + window with the focus() method. There would be no need to re-create + the window or to reload the referenced resource. */ + oWindowObjectReference.focus(); + } + /* Let know every second our child window that we're waiting for it to complete, + once we reach our landing page, it'll send us a reply + */ + oListener = window.setInterval(function () { + if (oWindowObjectReference.closed) { + clearInterval(oListener); + } + oWindowObjectReference.postMessage('anyone', sOAuthReturnURI); + }, 1000); + + /* Once we receive a response, transmit it to the server to get authenticate and display + results + */ + window.addEventListener('message', oOnOauthSuccess, false); + // Assign the previous URL + sPreviousUrl = url; +}; + + +const OAuthConnect = function(sClass, sId, sAjaxUri, sReturnUri) { + sOAuthAjaxURI = sAjaxUri; + sOAuthObjClass = sClass; + sOAuthObjKey = sId; + sOAuthReturnURI = sReturnUri; + + $.post( + sOAuthAjaxURI, + { + operation: 'GetOAuthAuthorizationUrl', + class: sOAuthObjClass, + id: sOAuthObjKey + }, + function (oData) { + if (oData.status === 'success') { + oOpenSignInWindow(oData.data.authorization_url, 'OAuth authorization') + } + } + ); +} \ No newline at end of file diff --git a/datamodels/2.x/itop-oauth-client/composer.json b/datamodels/2.x/itop-oauth-client/composer.json new file mode 100644 index 000000000..f12b85530 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/composer.json @@ -0,0 +1,16 @@ +{ + "config": { + "classmap-authoritative": true + }, + "autoload": { + "psr-4": { + "Combodo\\iTop\\OAuthClient\\": "src" + } + }, + "name": "combodo/itop-oauth-client", + "type": "itop-extension", + "description": "Remote authentication for OAuth 2.0", + "require": { + "composer-runtime-api": "^2.0" + } +} \ No newline at end of file diff --git a/datamodels/2.x/itop-oauth-client/cs.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/cs.dict.itop-oauth-client.php new file mode 100644 index 000000000..ac3a5196f --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/cs.dict.itop-oauth-client.php @@ -0,0 +1,74 @@ + 'Create a mailbox...~~', + 'Menu:OAuthClient' => 'OAuth Client~~', + 'Menu:OAuthClient+' => '~~', + 'Menu:GenerateTokens' => 'Generate access tokens...~~', + 'Menu:RegenerateTokens' => 'Regenerate access tokens...~~', + + 'itop-oauth-client/Operation:CreateMailBox/Title' => 'Mailbox creation~~', + + 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', + '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:TokenCreated' => 'Access token created~~', + 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', +]); + +// +// Class: OAuthClient +// + +Dict::Add('CS CZ', 'Czech', 'Čeština', [ + 'Class:OAuthClient' => 'Oauth Client~~', + 'Class:OAuthClient/Attribute:provider' => 'Provider~~', + 'Class:OAuthClient/Attribute:provider+' => '~~', + 'Class:OAuthClient/Attribute:name' => 'Login~~', + 'Class:OAuthClient/Attribute:name+' => '~~', + 'Class:OAuthClient/Attribute:scope' => 'Scope~~', + 'Class:OAuthClient/Attribute:scope+' => '~~', + 'Class:OAuthClient/Attribute:description' => 'Description~~', + 'Class:OAuthClient/Attribute:description+' => '~~', + 'Class:OAuthClient/Attribute:client_id' => 'Client id~~', + 'Class:OAuthClient/Attribute:client_id+' => '~~', + 'Class:OAuthClient/Attribute:client_secret' => 'Client secret~~', + 'Class:OAuthClient/Attribute:client_secret+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token' => 'Refresh token~~', + 'Class:OAuthClient/Attribute:refresh_token+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration' => 'Refresh token expiration~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration+' => '~~', + 'Class:OAuthClient/Attribute:token' => 'Access token~~', + 'Class:OAuthClient/Attribute:token+' => '~~', + '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+' => '~~', + 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', +]); + +// +// Class: OAuthClientAzure +// +Dict::Add('CS CZ', 'Czech', 'Čeština', [ + 'Class:OAuthClientAzure' => 'OAuth client for Microsoft Azure~~', + 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', + +]); + +// +// Class: OAuthClientGoogle +// +Dict::Add('CS CZ', 'Czech', 'Čeština', [ + 'Class:OAuthClientGoogle' => 'OAuth client for Google~~', + 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', +]); + diff --git a/datamodels/2.x/itop-oauth-client/da.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/da.dict.itop-oauth-client.php new file mode 100644 index 000000000..5bcb967ee --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/da.dict.itop-oauth-client.php @@ -0,0 +1,74 @@ + 'Create a mailbox...~~', + 'Menu:OAuthClient' => 'OAuth Client~~', + 'Menu:OAuthClient+' => '~~', + 'Menu:GenerateTokens' => 'Generate access tokens...~~', + 'Menu:RegenerateTokens' => 'Regenerate access tokens...~~', + + 'itop-oauth-client/Operation:CreateMailBox/Title' => 'Mailbox creation~~', + + 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', + '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:TokenCreated' => 'Access token created~~', + 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', +]); + +// +// Class: OAuthClient +// + +Dict::Add('DA DA', 'Danish', 'Dansk', [ + 'Class:OAuthClient' => 'Oauth Client~~', + 'Class:OAuthClient/Attribute:provider' => 'Provider~~', + 'Class:OAuthClient/Attribute:provider+' => '~~', + 'Class:OAuthClient/Attribute:name' => 'Login~~', + 'Class:OAuthClient/Attribute:name+' => '~~', + 'Class:OAuthClient/Attribute:scope' => 'Scope~~', + 'Class:OAuthClient/Attribute:scope+' => '~~', + 'Class:OAuthClient/Attribute:description' => 'Description~~', + 'Class:OAuthClient/Attribute:description+' => '~~', + 'Class:OAuthClient/Attribute:client_id' => 'Client id~~', + 'Class:OAuthClient/Attribute:client_id+' => '~~', + 'Class:OAuthClient/Attribute:client_secret' => 'Client secret~~', + 'Class:OAuthClient/Attribute:client_secret+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token' => 'Refresh token~~', + 'Class:OAuthClient/Attribute:refresh_token+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration' => 'Refresh token expiration~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration+' => '~~', + 'Class:OAuthClient/Attribute:token' => 'Access token~~', + 'Class:OAuthClient/Attribute:token+' => '~~', + '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+' => '~~', + 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', +]); + +// +// Class: OAuthClientAzure +// +Dict::Add('DA DA', 'Danish', 'Dansk', [ + 'Class:OAuthClientAzure' => 'OAuth client for Microsoft Azure~~', + 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', + +]); + +// +// Class: OAuthClientGoogle +// +Dict::Add('DA DA', 'Danish', 'Dansk', [ + 'Class:OAuthClientGoogle' => 'OAuth client for Google~~', + 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', +]); + 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 new file mode 100644 index 000000000..a40a51436 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/datamodel.itop-oauth-client.xml @@ -0,0 +1,287 @@ + + + + + + cmdbAbstractObject + + cloud,searchable + true + autoincrement + priv_oauth_client + id + + + + + + + + + + + + + + + + + + + provider + + false + + + name + + false + + + true + + active + inactive + + status + inactive + false + + + description + + true + + + client_id + + false + + + client_secret + + false + + + refresh_token + + true + none + + + refresh_token_expiration + + true + none + + + token + + true + none + + + token_expiration + + true + none + + + redirect_url + + _blank + true + + + MailInboxOAuth + oauth_client_id + 0 + 0 + + + + + false + public + Overload-DBObject + Get('scope'); + if ($this->Get('status') == 'inactive') { + $oPage->p(''.Dict::S('itop-oauth-client:Message:MissingToken').''); + } elseif (($sScope == 'SMTP' || $sScope == 'EMail') && $oConfig->Get('email_transport_smtp.username') == $this->Get('name')) { + $sLabel = Dict::S('itop-oauth-client:UsedForSMTP'); + $sTestLabel = Dict::S('itop-oauth-client:TestSMTP'); + $sTestURL = utils::GetAbsoluteUrlAppRoot().'setup/email.test.php'; + $oPage->p("$sLabel $sTestLabel"); + } + } + } + ]]> + + + false + public + Overload-DBObject + + + + false + public + Overload-DBObject + + + + false + public + Get('provider').'.com'; + } + ]]> + + + false + public + + + + false + public + Get('status') == 'active') { + return new \League\OAuth2\Client\Token\AccessToken([ + 'access_token' => $this->Get('token'), + 'expires_in' => date_format(new DateTime($this->Get('token_expiration')), 'U') - time(), + 'refresh_token' => $this->Get('refresh_token'), + 'token_type' => 'Bearer', + ]); + } + return null; + } + ]]> + + + false + public + Set('token', $oAccessToken->getToken()); + $this->Set('token_expiration', date(AttributeDateTime::GetSQLFormat(), $oAccessToken->getExpires())); + if (!empty($oAccessToken->getRefreshToken())) { + $this->Set('refresh_token', $oAccessToken->getRefreshToken()); + } + $this->Set('status', 'active'); + $this->DBUpdate(); + } + ]]> + + + +
+ + + 1 + + + 2 + + + 3 + + + 5 + + + 6 + + + 7 + + + 8 + + +
+ + + + 1 + + + 3 + + + + + + + 1 + + + 2 + + + + + + + 1 + + + 2 + + + +
+
+
+ + + 100 + ConfigurationTools + + 1 + 0 + OAuthClient + UR_ACTION_READ + + + + + + + + +
diff --git a/datamodels/2.x/itop-oauth-client/de.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/de.dict.itop-oauth-client.php new file mode 100644 index 000000000..fc7d62765 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/de.dict.itop-oauth-client.php @@ -0,0 +1,74 @@ + 'Create a mailbox...~~', + 'Menu:OAuthClient' => 'OAuth Client~~', + 'Menu:OAuthClient+' => '~~', + 'Menu:GenerateTokens' => 'Generate access token...~~', + 'Menu:RegenerateTokens' => 'Regenerate access token...~~', + + 'itop-oauth-client/Operation:CreateMailBox/Title' => 'Mailbox creation~~', + + 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', + '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:TokenCreated' => 'Access token created~~', + 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', +]); + +// +// Class: OAuthClient +// + +Dict::Add('DE DE', 'German', 'Deutsch', [ + 'Class:OAuthClient' => 'Oauth Client~~', + 'Class:OAuthClient/Attribute:provider' => 'Provider~~', + 'Class:OAuthClient/Attribute:provider+' => '~~', + 'Class:OAuthClient/Attribute:name' => 'Login~~', + 'Class:OAuthClient/Attribute:name+' => '~~', + 'Class:OAuthClient/Attribute:scope' => 'Scope~~', + 'Class:OAuthClient/Attribute:scope+' => '~~', + 'Class:OAuthClient/Attribute:description' => 'Description~~', + 'Class:OAuthClient/Attribute:description+' => '~~', + 'Class:OAuthClient/Attribute:client_id' => 'Client id~~', + 'Class:OAuthClient/Attribute:client_id+' => '~~', + 'Class:OAuthClient/Attribute:client_secret' => 'Client secret~~', + 'Class:OAuthClient/Attribute:client_secret+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token' => 'Refresh token~~', + 'Class:OAuthClient/Attribute:refresh_token+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration' => 'Refresh token expiration~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration+' => '~~', + 'Class:OAuthClient/Attribute:token' => 'Access token~~', + 'Class:OAuthClient/Attribute:token+' => '~~', + '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+' => '~~', + 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', +]); + +// +// Class: OAuthClientAzure +// +Dict::Add('DE DE', 'German', 'Deutsch', [ + 'Class:OAuthClientAzure' => 'OAuth client for Microsoft Azure~~', + 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', + +]); + +// +// Class: OAuthClientGoogle +// +Dict::Add('DE DE', 'German', 'Deutsch', [ + 'Class:OAuthClientGoogle' => 'OAuth client for Google~~', + 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', +]); + 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 new file mode 100644 index 000000000..1a91fb173 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/en.dict.itop-oauth-client.php @@ -0,0 +1,78 @@ + 'Create a mailbox...', + 'Menu:OAuthClient' => 'OAuth Client', + 'Menu:OAuthClient+' => '', + 'Menu:GenerateTokens' => 'Generate access token...', + 'Menu:RegenerateTokens' => 'Regenerate access token...', + + 'itop-oauth-client/Operation:CreateMailBox/Title' => 'Mailbox creation', + + 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP', + '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:TokenCreated' => 'Access token created', + 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated', +]); + +// +// Class: OAuthClient +// + +Dict::Add('EN US', 'English', 'English', [ + 'Class:OAuthClient' => 'Oauth Client', + 'Class:OAuthClient/Attribute:provider' => 'Provider', + 'Class:OAuthClient/Attribute:provider+' => '', + 'Class:OAuthClient/Attribute:name' => 'Login', + 'Class:OAuthClient/Attribute:name+' => '', + 'Class:OAuthClient/Attribute:scope' => 'Scope', + 'Class:OAuthClient/Attribute:scope+' => '', + 'Class:OAuthClient/Attribute:status' => 'Status', + 'Class:OAuthClient/Attribute:status+' => '', + 'Class:OAuthClient/Attribute:status/Value:active' => 'Access token generated', + 'Class:OAuthClient/Attribute:status/Value:inactive' => 'No Access token', + 'Class:OAuthClient/Attribute:description' => 'Description', + 'Class:OAuthClient/Attribute:description+' => '', + 'Class:OAuthClient/Attribute:client_id' => 'Client id', + 'Class:OAuthClient/Attribute:client_id+' => '', + 'Class:OAuthClient/Attribute:client_secret' => 'Client secret', + 'Class:OAuthClient/Attribute:client_secret+' => '', + 'Class:OAuthClient/Attribute:refresh_token' => 'Refresh token', + 'Class:OAuthClient/Attribute:refresh_token+' => '', + 'Class:OAuthClient/Attribute:refresh_token_expiration' => 'Refresh token expiration', + 'Class:OAuthClient/Attribute:refresh_token_expiration+' => '', + 'Class:OAuthClient/Attribute:token' => 'Access token', + 'Class:OAuthClient/Attribute:token+' => '', + '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+' => '', + 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list', + 'Class:OAuthClient/Attribute:mailbox_list+' => '', +]); + +// +// Class: OAuthClientAzure +// +Dict::Add('EN US', 'English', 'English', [ + 'Class:OAuthClientAzure' => 'OAuth client for Microsoft Azure', + 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)', + +]); + +// +// Class: OAuthClientGoogle +// +Dict::Add('EN US', 'English', 'English', [ + 'Class:OAuthClientGoogle' => 'OAuth client for Google', + 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)', +]); + diff --git a/datamodels/2.x/itop-oauth-client/es_cr.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/es_cr.dict.itop-oauth-client.php new file mode 100644 index 000000000..5baf5dbf9 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/es_cr.dict.itop-oauth-client.php @@ -0,0 +1,74 @@ + 'Create a mailbox...~~', + 'Menu:OAuthClient' => 'OAuth Client~~', + 'Menu:OAuthClient+' => '~~', + 'Menu:GenerateTokens' => 'Generate access tokens...~~', + 'Menu:RegenerateTokens' => 'Regenerate access tokens...~~', + + 'itop-oauth-client/Operation:CreateMailBox/Title' => 'Mailbox creation~~', + + 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', + '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:TokenCreated' => 'Access token created~~', + 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', +]); + +// +// Class: OAuthClient +// + +Dict::Add('ES CR', 'Spanish', 'Español, Castellaño', [ + 'Class:OAuthClient' => 'Oauth Client~~', + 'Class:OAuthClient/Attribute:provider' => 'Provider~~', + 'Class:OAuthClient/Attribute:provider+' => '~~', + 'Class:OAuthClient/Attribute:name' => 'Login~~', + 'Class:OAuthClient/Attribute:name+' => '~~', + 'Class:OAuthClient/Attribute:scope' => 'Scope~~', + 'Class:OAuthClient/Attribute:scope+' => '~~', + 'Class:OAuthClient/Attribute:description' => 'Description~~', + 'Class:OAuthClient/Attribute:description+' => '~~', + 'Class:OAuthClient/Attribute:client_id' => 'Client id~~', + 'Class:OAuthClient/Attribute:client_id+' => '~~', + 'Class:OAuthClient/Attribute:client_secret' => 'Client secret~~', + 'Class:OAuthClient/Attribute:client_secret+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token' => 'Refresh token~~', + 'Class:OAuthClient/Attribute:refresh_token+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration' => 'Refresh token expiration~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration+' => '~~', + 'Class:OAuthClient/Attribute:token' => 'Access token~~', + 'Class:OAuthClient/Attribute:token+' => '~~', + '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+' => '~~', + 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', +]); + +// +// Class: OAuthClientAzure +// +Dict::Add('ES CR', 'Spanish', 'Español, Castellaño', [ + 'Class:OAuthClientAzure' => 'OAuth client for Microsoft Azure~~', + 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', + +]); + +// +// Class: OAuthClientGoogle +// +Dict::Add('ES CR', 'Spanish', 'Español, Castellaño', [ + 'Class:OAuthClientGoogle' => 'OAuth client for Google~~', + 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', +]); + 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 new file mode 100644 index 000000000..e8461b535 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/fr.dict.itop-oauth-client.php @@ -0,0 +1,78 @@ + 'Créer une boite mail...', + 'Menu:OAuthClient' => 'Client OAuth', + 'Menu:OAuthClient+' => '', + 'Menu:GenerateTokens' => 'Créer un jeton d\'accès...', + 'Menu:RegenerateTokens' => 'Recréer un jeton d\'accès..', + + 'itop-oauth-client/Operation:CreateMailBox/Title' => 'Création de boite mail', + + 'itop-oauth-client:UsedForSMTP' => 'Ce client Oauth est utilisé pour SMTP', + '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:TokenCreated' => 'Le jeton d\'accès à été créé', + 'itop-oauth-client:Message:TokenRecreated' => 'Le jeton d\'accès à été renouvelé', +]); + +// +// Class: OAuthClient +// + +Dict::Add('FR FR', 'French', 'Français', [ + 'Class:OAuthClient' => 'Client OAuth', + 'Class:OAuthClient/Attribute:provider' => 'Fournisseur', + 'Class:OAuthClient/Attribute:provider+' => '', + 'Class:OAuthClient/Attribute:name' => 'Login', + 'Class:OAuthClient/Attribute:name+' => '', + 'Class:OAuthClient/Attribute:scope' => 'Niveaux d\'accès', + 'Class:OAuthClient/Attribute:scope+' => '', + 'Class:OAuthClient/Attribute:description' => 'Description', + 'Class:OAuthClient/Attribute:description+' => '', + 'Class:OAuthClient/Attribute:client_id' => 'ID Client', + 'Class:OAuthClient/Attribute:client_id+' => '', + 'Class:OAuthClient/Attribute:client_secret' => 'Code secret du client', + 'Class:OAuthClient/Attribute:client_secret+' => '', + 'Class:OAuthClient/Attribute:refresh_token' => 'Jeton de renouvellement', + 'Class:OAuthClient/Attribute:refresh_token+' => '', + 'Class:OAuthClient/Attribute:refresh_token_expiration' => 'Date d\'expiration du jeton de renouvellement', + 'Class:OAuthClient/Attribute:refresh_token_expiration+' => '', + 'Class:OAuthClient/Attribute:token' => 'Jeton d\'accès', + 'Class:OAuthClient/Attribute:token+' => '', + '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+' => '', + 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list', + 'Class:OAuthClient/Attribute:mailbox_list+' => '', +]); + +// +// Class: OAuthClientAzure +// +Dict::Add('FR FR', 'French', 'Français', [ + 'Class:OAuthClientAzure' => 'Client OAuth pour Microsoft Azure', + 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)', + +]); + +// +// Class: OAuthClientGoogle +// +Dict::Add('FR FR', 'French', 'Français', [ + 'Class:OAuthClientGoogle' => 'Client OAuth pour Google', + 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)', +]); + + +// Additional language entries not present in English dict +Dict::Add('FR FR', 'French', 'Français', array( + 'Class:OAuthClient/Name' => '%1$s-%%2$~', +)); diff --git a/datamodels/2.x/itop-oauth-client/hu.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/hu.dict.itop-oauth-client.php new file mode 100644 index 000000000..6c6287f9f --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/hu.dict.itop-oauth-client.php @@ -0,0 +1,74 @@ + 'Create a mailbox...~~', + 'Menu:OAuthClient' => 'OAuth Client~~', + 'Menu:OAuthClient+' => '~~', + 'Menu:GenerateTokens' => 'Generate access tokens...~~', + 'Menu:RegenerateTokens' => 'Regenerate access tokens...~~', + + 'itop-oauth-client/Operation:CreateMailBox/Title' => 'Mailbox creation~~', + + 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', + '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:TokenCreated' => 'Access token created~~', + 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', +]); + +// +// Class: OAuthClient +// + +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ + 'Class:OAuthClient' => 'Oauth Client~~', + 'Class:OAuthClient/Attribute:provider' => 'Provider~~', + 'Class:OAuthClient/Attribute:provider+' => '~~', + 'Class:OAuthClient/Attribute:name' => 'Login~~', + 'Class:OAuthClient/Attribute:name+' => '~~', + 'Class:OAuthClient/Attribute:scope' => 'Scope~~', + 'Class:OAuthClient/Attribute:scope+' => '~~', + 'Class:OAuthClient/Attribute:description' => 'Description~~', + 'Class:OAuthClient/Attribute:description+' => '~~', + 'Class:OAuthClient/Attribute:client_id' => 'Client id~~', + 'Class:OAuthClient/Attribute:client_id+' => '~~', + 'Class:OAuthClient/Attribute:client_secret' => 'Client secret~~', + 'Class:OAuthClient/Attribute:client_secret+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token' => 'Refresh token~~', + 'Class:OAuthClient/Attribute:refresh_token+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration' => 'Refresh token expiration~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration+' => '~~', + 'Class:OAuthClient/Attribute:token' => 'Access token~~', + 'Class:OAuthClient/Attribute:token+' => '~~', + '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+' => '~~', + 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', +]); + +// +// Class: OAuthClientAzure +// +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ + 'Class:OAuthClientAzure' => 'OAuth client for Microsoft Azure~~', + 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', + +]); + +// +// Class: OAuthClientGoogle +// +Dict::Add('HU HU', 'Hungarian', 'Magyar', [ + 'Class:OAuthClientGoogle' => 'OAuth client for Google~~', + 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', +]); + diff --git a/datamodels/2.x/itop-oauth-client/index.php b/datamodels/2.x/itop-oauth-client/index.php new file mode 100644 index 000000000..4078be629 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/index.php @@ -0,0 +1,24 @@ += 0) { + $sTemplates = MODULESROOT.'itop-oauth-client/templates'; +} else { + $sTemplates = MODULESROOT.'itop-oauth-client/templates/legacy'; +} + +$oUpdateController = new OAuthClientController($sTemplates, 'itop-oauth-client'); +$oUpdateController->AllowOnlyAdmin(); +$oUpdateController->SetDefaultOperation('CreateMailbox'); +$oUpdateController->HandleOperation(); + + diff --git a/datamodels/2.x/itop-oauth-client/it.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/it.dict.itop-oauth-client.php new file mode 100644 index 000000000..bc601ae8b --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/it.dict.itop-oauth-client.php @@ -0,0 +1,74 @@ + 'Create a mailbox...~~', + 'Menu:OAuthClient' => 'OAuth Client~~', + 'Menu:OAuthClient+' => '~~', + 'Menu:GenerateTokens' => 'Generate access tokens...~~', + 'Menu:RegenerateTokens' => 'Regenerate access tokens...~~', + + 'itop-oauth-client/Operation:CreateMailBox/Title' => 'Mailbox creation~~', + + 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', + '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:TokenCreated' => 'Access token created~~', + 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', +]); + +// +// Class: OAuthClient +// + +Dict::Add('IT IT', 'Italian', 'Italiano', [ + 'Class:OAuthClient' => 'Oauth Client~~', + 'Class:OAuthClient/Attribute:provider' => 'Provider~~', + 'Class:OAuthClient/Attribute:provider+' => '~~', + 'Class:OAuthClient/Attribute:name' => 'Login~~', + 'Class:OAuthClient/Attribute:name+' => '~~', + 'Class:OAuthClient/Attribute:scope' => 'Scope~~', + 'Class:OAuthClient/Attribute:scope+' => '~~', + 'Class:OAuthClient/Attribute:description' => 'Description~~', + 'Class:OAuthClient/Attribute:description+' => '~~', + 'Class:OAuthClient/Attribute:client_id' => 'Client id~~', + 'Class:OAuthClient/Attribute:client_id+' => '~~', + 'Class:OAuthClient/Attribute:client_secret' => 'Client secret~~', + 'Class:OAuthClient/Attribute:client_secret+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token' => 'Refresh token~~', + 'Class:OAuthClient/Attribute:refresh_token+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration' => 'Refresh token expiration~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration+' => '~~', + 'Class:OAuthClient/Attribute:token' => 'Access token~~', + 'Class:OAuthClient/Attribute:token+' => '~~', + '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+' => '~~', + 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', +]); + +// +// Class: OAuthClientAzure +// +Dict::Add('IT IT', 'Italian', 'Italiano', [ + 'Class:OAuthClientAzure' => 'OAuth client for Microsoft Azure~~', + 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', + +]); + +// +// Class: OAuthClientGoogle +// +Dict::Add('IT IT', 'Italian', 'Italiano', [ + 'Class:OAuthClientGoogle' => 'OAuth client for Google~~', + 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', +]); + diff --git a/datamodels/2.x/itop-oauth-client/ja.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/ja.dict.itop-oauth-client.php new file mode 100644 index 000000000..1a5bdca02 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/ja.dict.itop-oauth-client.php @@ -0,0 +1,74 @@ + 'Create a mailbox...~~', + 'Menu:OAuthClient' => 'OAuth Client~~', + 'Menu:OAuthClient+' => '~~', + 'Menu:GenerateTokens' => 'Generate access tokens...~~', + 'Menu:RegenerateTokens' => 'Regenerate access tokens...~~', + + 'itop-oauth-client/Operation:CreateMailBox/Title' => 'Mailbox creation~~', + + 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', + '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:TokenCreated' => 'Access token created~~', + 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', +]); + +// +// Class: OAuthClient +// + +Dict::Add('JA JP', 'Japanese', '日本語', [ + 'Class:OAuthClient' => 'Oauth Client~~', + 'Class:OAuthClient/Attribute:provider' => 'Provider~~', + 'Class:OAuthClient/Attribute:provider+' => '~~', + 'Class:OAuthClient/Attribute:name' => 'Login~~', + 'Class:OAuthClient/Attribute:name+' => '~~', + 'Class:OAuthClient/Attribute:scope' => 'Scope~~', + 'Class:OAuthClient/Attribute:scope+' => '~~', + 'Class:OAuthClient/Attribute:description' => 'Description~~', + 'Class:OAuthClient/Attribute:description+' => '~~', + 'Class:OAuthClient/Attribute:client_id' => 'Client id~~', + 'Class:OAuthClient/Attribute:client_id+' => '~~', + 'Class:OAuthClient/Attribute:client_secret' => 'Client secret~~', + 'Class:OAuthClient/Attribute:client_secret+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token' => 'Refresh token~~', + 'Class:OAuthClient/Attribute:refresh_token+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration' => 'Refresh token expiration~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration+' => '~~', + 'Class:OAuthClient/Attribute:token' => 'Access token~~', + 'Class:OAuthClient/Attribute:token+' => '~~', + '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+' => '~~', + 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', +]); + +// +// Class: OAuthClientAzure +// +Dict::Add('JA JP', 'Japanese', '日本語', [ + 'Class:OAuthClientAzure' => 'OAuth client for Microsoft Azure~~', + 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', + +]); + +// +// Class: OAuthClientGoogle +// +Dict::Add('JA JP', 'Japanese', '日本語', [ + 'Class:OAuthClientGoogle' => 'OAuth client for Google~~', + 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', +]); + diff --git a/datamodels/2.x/itop-oauth-client/module.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/module.itop-oauth-client.php new file mode 100644 index 000000000..632ede130 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/module.itop-oauth-client.php @@ -0,0 +1,54 @@ + 'OAuth 2.0 client', + 'category' => 'business', + + // Setup + // + 'dependencies' => array( + 'itop-welcome-itil/2.7.7,' + ), + 'mandatory' => false, + 'visible' => true, + + // Components + // + 'datamodel' => array( + 'vendor/autoload.php', + 'model.itop-oauth-client.php', // Contains the PHP code generated by the "compilation" of datamodel.remote-authent-oauth.xml + 'src/Model/OAuthClientGoogle.php', + 'src/Model/OAuthClientAzure.php', + 'src/Service/PopupMenuExtension.php', + ), + 'webservice' => array( + + ), + 'data.struct' => array( + // add your 'structure' definition XML files here, + ), + 'data.sample' => array( + // add your sample data XML files here, + ), + + // Documentation + // + 'doc.manual_setup' => '', // hyperlink to manual setup documentation, if any + 'doc.more_information' => '', // hyperlink to more information, if any + + // Default settings + // + 'settings' => array( + // Module specific settings go here, if any + ), + ) +); + diff --git a/datamodels/2.x/itop-oauth-client/nl.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/nl.dict.itop-oauth-client.php new file mode 100644 index 000000000..81d390251 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/nl.dict.itop-oauth-client.php @@ -0,0 +1,74 @@ + 'Create a mailbox...~~', + 'Menu:OAuthClient' => 'OAuth Client~~', + 'Menu:OAuthClient+' => '~~', + 'Menu:GenerateTokens' => 'Generate access tokens...~~', + 'Menu:RegenerateTokens' => 'Regenerate access tokens...~~', + + 'itop-oauth-client/Operation:CreateMailBox/Title' => 'Mailbox creation~~', + + 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', + '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:TokenCreated' => 'Access token created~~', + 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', +]); + +// +// Class: OAuthClient +// + +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ + 'Class:OAuthClient' => 'Oauth Client~~', + 'Class:OAuthClient/Attribute:provider' => 'Provider~~', + 'Class:OAuthClient/Attribute:provider+' => '~~', + 'Class:OAuthClient/Attribute:name' => 'Login~~', + 'Class:OAuthClient/Attribute:name+' => '~~', + 'Class:OAuthClient/Attribute:scope' => 'Scope~~', + 'Class:OAuthClient/Attribute:scope+' => '~~', + 'Class:OAuthClient/Attribute:description' => 'Description~~', + 'Class:OAuthClient/Attribute:description+' => '~~', + 'Class:OAuthClient/Attribute:client_id' => 'Client id~~', + 'Class:OAuthClient/Attribute:client_id+' => '~~', + 'Class:OAuthClient/Attribute:client_secret' => 'Client secret~~', + 'Class:OAuthClient/Attribute:client_secret+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token' => 'Refresh token~~', + 'Class:OAuthClient/Attribute:refresh_token+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration' => 'Refresh token expiration~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration+' => '~~', + 'Class:OAuthClient/Attribute:token' => 'Access token~~', + 'Class:OAuthClient/Attribute:token+' => '~~', + '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+' => '~~', + 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', +]); + +// +// Class: OAuthClientAzure +// +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ + 'Class:OAuthClientAzure' => 'OAuth client for Microsoft Azure~~', + 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', + +]); + +// +// Class: OAuthClientGoogle +// +Dict::Add('NL NL', 'Dutch', 'Nederlands', [ + 'Class:OAuthClientGoogle' => 'OAuth client for Google~~', + 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', +]); + diff --git a/datamodels/2.x/itop-oauth-client/pt_br.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/pt_br.dict.itop-oauth-client.php new file mode 100644 index 000000000..150ac6fc6 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/pt_br.dict.itop-oauth-client.php @@ -0,0 +1,74 @@ + 'Create a mailbox...~~', + 'Menu:OAuthClient' => 'OAuth Client~~', + 'Menu:OAuthClient+' => '~~', + 'Menu:GenerateTokens' => 'Generate access tokens...~~', + 'Menu:RegenerateTokens' => 'Regenerate access tokens...~~', + + 'itop-oauth-client/Operation:CreateMailBox/Title' => 'Mailbox creation~~', + + 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', + '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:TokenCreated' => 'Access token created~~', + 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', +]); + +// +// Class: OAuthClient +// + +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ + 'Class:OAuthClient' => 'Oauth Client~~', + 'Class:OAuthClient/Attribute:provider' => 'Provider~~', + 'Class:OAuthClient/Attribute:provider+' => '~~', + 'Class:OAuthClient/Attribute:name' => 'Login~~', + 'Class:OAuthClient/Attribute:name+' => '~~', + 'Class:OAuthClient/Attribute:scope' => 'Scope~~', + 'Class:OAuthClient/Attribute:scope+' => '~~', + 'Class:OAuthClient/Attribute:description' => 'Description~~', + 'Class:OAuthClient/Attribute:description+' => '~~', + 'Class:OAuthClient/Attribute:client_id' => 'Client id~~', + 'Class:OAuthClient/Attribute:client_id+' => '~~', + 'Class:OAuthClient/Attribute:client_secret' => 'Client secret~~', + 'Class:OAuthClient/Attribute:client_secret+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token' => 'Refresh token~~', + 'Class:OAuthClient/Attribute:refresh_token+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration' => 'Refresh token expiration~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration+' => '~~', + 'Class:OAuthClient/Attribute:token' => 'Access token~~', + 'Class:OAuthClient/Attribute:token+' => '~~', + '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+' => '~~', + 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', +]); + +// +// Class: OAuthClientAzure +// +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ + 'Class:OAuthClientAzure' => 'OAuth client for Microsoft Azure~~', + 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', + +]); + +// +// Class: OAuthClientGoogle +// +Dict::Add('PT BR', 'Brazilian', 'Brazilian', [ + 'Class:OAuthClientGoogle' => 'OAuth client for Google~~', + 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', +]); + diff --git a/datamodels/2.x/itop-oauth-client/ru.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/ru.dict.itop-oauth-client.php new file mode 100644 index 000000000..b97fad178 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/ru.dict.itop-oauth-client.php @@ -0,0 +1,74 @@ + 'Create a mailbox...~~', + 'Menu:OAuthClient' => 'OAuth Client~~', + 'Menu:OAuthClient+' => '~~', + 'Menu:GenerateTokens' => 'Generate access tokens...~~', + 'Menu:RegenerateTokens' => 'Regenerate access tokens...~~', + + 'itop-oauth-client/Operation:CreateMailBox/Title' => 'Mailbox creation~~', + + 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', + '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:TokenCreated' => 'Access token created~~', + 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', +]); + +// +// Class: OAuthClient +// + +Dict::Add('RU RU', 'Russian', 'Русский', [ + 'Class:OAuthClient' => 'Oauth Client~~', + 'Class:OAuthClient/Attribute:provider' => 'Provider~~', + 'Class:OAuthClient/Attribute:provider+' => '~~', + 'Class:OAuthClient/Attribute:name' => 'Login~~', + 'Class:OAuthClient/Attribute:name+' => '~~', + 'Class:OAuthClient/Attribute:scope' => 'Scope~~', + 'Class:OAuthClient/Attribute:scope+' => '~~', + 'Class:OAuthClient/Attribute:description' => 'Description~~', + 'Class:OAuthClient/Attribute:description+' => '~~', + 'Class:OAuthClient/Attribute:client_id' => 'Client id~~', + 'Class:OAuthClient/Attribute:client_id+' => '~~', + 'Class:OAuthClient/Attribute:client_secret' => 'Client secret~~', + 'Class:OAuthClient/Attribute:client_secret+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token' => 'Refresh token~~', + 'Class:OAuthClient/Attribute:refresh_token+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration' => 'Refresh token expiration~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration+' => '~~', + 'Class:OAuthClient/Attribute:token' => 'Access token~~', + 'Class:OAuthClient/Attribute:token+' => '~~', + '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+' => '~~', + 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', +]); + +// +// Class: OAuthClientAzure +// +Dict::Add('RU RU', 'Russian', 'Русский', [ + 'Class:OAuthClientAzure' => 'OAuth client for Microsoft Azure~~', + 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', + +]); + +// +// Class: OAuthClientGoogle +// +Dict::Add('RU RU', 'Russian', 'Русский', [ + 'Class:OAuthClientGoogle' => 'OAuth client for Google~~', + 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', +]); + diff --git a/datamodels/2.x/itop-oauth-client/sk.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/sk.dict.itop-oauth-client.php new file mode 100644 index 000000000..d1e15cc49 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/sk.dict.itop-oauth-client.php @@ -0,0 +1,74 @@ + 'Create a mailbox...~~', + 'Menu:OAuthClient' => 'OAuth Client~~', + 'Menu:OAuthClient+' => '~~', + 'Menu:GenerateTokens' => 'Generate access tokens...~~', + 'Menu:RegenerateTokens' => 'Regenerate access tokens...~~', + + 'itop-oauth-client/Operation:CreateMailBox/Title' => 'Mailbox creation~~', + + 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', + '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:TokenCreated' => 'Access token created~~', + 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', +]); + +// +// Class: OAuthClient +// + +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ + 'Class:OAuthClient' => 'Oauth Client~~', + 'Class:OAuthClient/Attribute:provider' => 'Provider~~', + 'Class:OAuthClient/Attribute:provider+' => '~~', + 'Class:OAuthClient/Attribute:name' => 'Login~~', + 'Class:OAuthClient/Attribute:name+' => '~~', + 'Class:OAuthClient/Attribute:scope' => 'Scope~~', + 'Class:OAuthClient/Attribute:scope+' => '~~', + 'Class:OAuthClient/Attribute:description' => 'Description~~', + 'Class:OAuthClient/Attribute:description+' => '~~', + 'Class:OAuthClient/Attribute:client_id' => 'Client id~~', + 'Class:OAuthClient/Attribute:client_id+' => '~~', + 'Class:OAuthClient/Attribute:client_secret' => 'Client secret~~', + 'Class:OAuthClient/Attribute:client_secret+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token' => 'Refresh token~~', + 'Class:OAuthClient/Attribute:refresh_token+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration' => 'Refresh token expiration~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration+' => '~~', + 'Class:OAuthClient/Attribute:token' => 'Access token~~', + 'Class:OAuthClient/Attribute:token+' => '~~', + '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+' => '~~', + 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', +]); + +// +// Class: OAuthClientAzure +// +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ + 'Class:OAuthClientAzure' => 'OAuth client for Microsoft Azure~~', + 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', + +]); + +// +// Class: OAuthClientGoogle +// +Dict::Add('SK SK', 'Slovak', 'Slovenčina', [ + 'Class:OAuthClientGoogle' => 'OAuth client for Google~~', + 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', +]); + diff --git a/datamodels/2.x/itop-oauth-client/src/Controller/AjaxOauthClientController.php b/datamodels/2.x/itop-oauth-client/src/Controller/AjaxOauthClientController.php new file mode 100644 index 000000000..51367d34e --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/src/Controller/AjaxOauthClientController.php @@ -0,0 +1,77 @@ + 'success', 'data' => []]; + + $sAuthorizationUrl = OAuthClientProviderFactory::GetAuthorizationUrl($oOAuthClient); + $aResult['data']['authorization_url'] = $sAuthorizationUrl; + + $this->DisplayJSONPage($aResult); + } + + public function OperationGetDisplayAuthenticationResults() + { + $sClass = utils::ReadParam('class'); + $sId = utils::ReadParam('id'); + + IssueLog::Debug("GetDisplayAuthenticationResults for $sClass::$sId", self::LOG_CHANNEL); + + /** @var \OAuthClient $oOAuthClient */ + $oOAuthClient = MetaModel::GetObject($sClass, $sId); + $bIsCreation = empty($oOAuthClient->Get('token')); + + $sRedirectUrl = utils::ReadParam('redirect_url', '', false, 'raw'); + + $sRedirectUrlQuery = parse_url($sRedirectUrl)['query']; + + $aQuery = []; + parse_str($sRedirectUrlQuery, $aQuery); + $sCode = $aQuery['code']; + $oAccessToken = OAuthClientProviderFactory::GetAccessTokenFromCode($oOAuthClient, $sCode); + + $oOAuthClient->SetAccessToken($oAccessToken); + + cmdbAbstractObject::SetSessionMessage( + $sClass, + $sId, + "$sClass:$sId:TokenCreated", + $bIsCreation ? Dict::S('itop-oauth-client:Message:TokenCreated') : Dict::S('itop-oauth-client:Message:TokenRecreated'), + 'ok', + 1, + true + ); + + $aResult = ['status' => 'success']; + $aResult['data'] = utils::GetAbsoluteUrlAppRoot()."pages/UI.php?operation=details&class=$sClass&id=$sId"; + + $this->DisplayJSONPage($aResult); + } + +} \ No newline at end of file diff --git a/datamodels/2.x/itop-oauth-client/src/Controller/OAuthClientController.php b/datamodels/2.x/itop-oauth-client/src/Controller/OAuthClientController.php new file mode 100644 index 000000000..26d2b05b6 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/src/Controller/OAuthClientController.php @@ -0,0 +1,41 @@ +Get('name'); + $sDefaultServer = $oOAuthClient->GetDefaultMailServer(); + $sDefaultPort = $oOAuthClient->GetDefaultMailServerPort(); + + $aParams['sURL'] = utils::GetAbsoluteUrlAppRoot().'pages/UI.php?operation=new&class=MailInboxOAuth'. + '&default[mailbox]=INBOX'. + '&default[server]='.$sDefaultServer. + '&default[port]='.$sDefaultPort. + '&default[oauth_client_id]='.$sId. + '&default[login]='.$sLogin; + + $this->DisplayPage($aParams); + } +} \ No newline at end of file diff --git a/datamodels/2.x/itop-oauth-client/src/Model/OAuthClientAzure.php b/datamodels/2.x/itop-oauth-client/src/Model/OAuthClientAzure.php new file mode 100644 index 000000000..eb798e64d --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/src/Model/OAuthClientAzure.php @@ -0,0 +1,128 @@ + 'cloud', + 'key_type' => 'autoincrement', + 'name_attcode' => ['name', 'scope'], + 'state_attcode' => '', + 'reconc_keys' => ['provider', 'name'], + 'db_table' => 'priv_oauth_client_azure', + 'db_key_field' => 'id', + 'icon' => utils::GetAbsoluteUrlModulesRoot().'itop-oauth-client/assets/img/icons8-azure.svg', + 'db_finalclass_field' => '', + 'uniqueness_rules' => [ + 'Username for scope' => + [ + 'attributes' => ['name', 'scope'], + 'filter' => null, + 'disabled' => false, + 'is_blocking' => true, + ], + 'OAuth Server' => + [ + 'attributes' => ['provider', 'scope', 'client_id', 'client_secret'], + 'filter' => null, + 'disabled' => false, + 'is_blocking' => true, + ], + ], + ]; + MetaModel::Init_Params($aParams); + MetaModel::Init_InheritAttributes(); + MetaModel::Init_AddAttribute(new AttributeEnum('scope', [ + 'allowed_values' => new ValueSetEnum('EMail'), + 'display_style' => 'list', + 'sql' => 'scope', + 'default_value' => 'EMail', + 'is_null_allowed' => false, + 'depends_on' => [], + 'always_load_in_tables' => true, + ])); + + MetaModel::Init_SetZListItems('details', [ + 'name', + 'status', + 'description', + 'provider', + 'scope', + 'redirect_url', + 'client_id', + 'client_secret', + 'mailbox_list', + ]); + MetaModel::Init_SetZListItems('standard_search', [ + 'name', + 'provider', + 'status', + ]); + MetaModel::Init_SetZListItems('list', [ + 'status', + 'provider', + ]); + } + + public function PrefillCreationForm(&$aContextParam) + { + $this->Set('provider', 'Azure'); + $this->Set('redirect_url', OAuthClientProviderFactory::GetRedirectUri()); + + parent::PrefillCreationForm($aContextParam); + } + + /** + * Compute read-only values + * + * @return void + * @throws \ArchivedObjectException + * @throws \CoreException + * @throws \CoreUnexpectedValue + */ + public function ComputeValues() + { + parent::ComputeValues(); + if (empty($this->Get('provider'))) { + $this->Set('provider', 'Azure'); + } + if (empty($this->Get('redirect_url'))) { + $this->Set('redirect_url', OAuthClientProviderFactory::GetRedirectUri()); + } + } + + public function GetAttributeFlags($sAttCode, &$aReasons = array(), $sTargetState = '') + { + if ($sAttCode == 'provider' || $sAttCode == 'redirect_url') { + return OPT_ATT_READONLY; + } + + return parent::GetAttributeFlags($sAttCode, $aReasons, $sTargetState); + } + + public function GetInitialStateAttributeFlags($sAttCode, &$aReasons = array()) + { + if ($sAttCode == 'provider' || $sAttCode == 'redirect_url') { + return OPT_ATT_READONLY; + } + + return parent::GetInitialStateAttributeFlags($sAttCode, $aReasons); + } + + public function GetDefaultMailServer() + { + return 'outlook.office365.com'; + } + + public function GetScope() + { + return 'https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/SMTP.Send offline_access'; + } +} \ No newline at end of file diff --git a/datamodels/2.x/itop-oauth-client/src/Model/OAuthClientGoogle.php b/datamodels/2.x/itop-oauth-client/src/Model/OAuthClientGoogle.php new file mode 100644 index 000000000..83c111852 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/src/Model/OAuthClientGoogle.php @@ -0,0 +1,134 @@ + 'cloud', + 'key_type' => 'autoincrement', + 'name_attcode' => ['name', 'scope'], + 'state_attcode' => '', + 'reconc_keys' => ['provider', 'name'], + 'db_table' => 'priv_oauth_client_google', + 'db_key_field' => 'id', + 'icon' => utils::GetAbsoluteUrlModulesRoot().'itop-oauth-client/assets/img/icons8-google.svg', + 'db_finalclass_field' => '', + 'uniqueness_rules' => [ + 'Username for scope' => + [ + 'attributes' => ['name', 'scope'], + 'filter' => null, + 'disabled' => false, + 'is_blocking' => true, + ], + 'OAuth Server' => + [ + 'attributes' => ['provider', 'scope', 'client_id', 'client_secret'], + 'filter' => null, + 'disabled' => false, + 'is_blocking' => true, + ], + ], + ); + MetaModel::Init_Params($aParams); + MetaModel::Init_InheritAttributes(); + MetaModel::Init_AddAttribute(new AttributeEnum('scope', [ + 'allowed_values' => new ValueSetEnum('EMail'), + 'display_style' => 'list', + 'sql' => 'scope', + 'default_value' => 'EMail', + 'is_null_allowed' => false, + 'depends_on' => [], + 'always_load_in_tables' => true, + ])); + + MetaModel::Init_SetZListItems('details', [ + 'name', + 'status', + 'description', + 'provider', + 'scope', + 'redirect_url', + 'client_id', + 'client_secret', + 'mailbox_list', + ]); + MetaModel::Init_SetZListItems('standard_search', [ + 'name', + 'provider', + 'status', + ]); + MetaModel::Init_SetZListItems('list', [ + 'status', + 'provider', + ]); + } + + public function PrefillCreationForm(&$aContextParam) + { + $this->Set('provider', 'Google'); + $this->Set('scope', 'EMail'); + $this->Set('redirect_url', OAuthClientProviderFactory::GetRedirectUri()); + + parent::PrefillCreationForm($aContextParam); + } + + public function GetAttributeFlags($sAttCode, &$aReasons = array(), $sTargetState = '') + { + if ($sAttCode == 'provider' || $sAttCode == 'scope' || $sAttCode == 'redirect_url') { + return OPT_ATT_READONLY; + } + + return parent::GetAttributeFlags($sAttCode, $aReasons, $sTargetState); + } + + public function GetInitialStateAttributeFlags($sAttCode, &$aReasons = array()) + { + if ($sAttCode == 'provider' || $sAttCode == 'scope' || $sAttCode == 'redirect_url') { + return OPT_ATT_READONLY; + } + + return parent::GetInitialStateAttributeFlags($sAttCode, $aReasons); + } + + /** + * Compute read-only values + * + * @return void + * @throws \ArchivedObjectException + * @throws \CoreException + * @throws \CoreUnexpectedValue + */ + public function ComputeValues() + { + parent::ComputeValues(); + if (empty($this->Get('provider'))) { + $this->Set('provider', 'Google'); + } + if (empty($this->Get('redirect_url'))) { + $this->Set('redirect_url', OAuthClientProviderFactory::GetRedirectUri()); + } + if (empty($this->Get('scope'))) { + $this->Set('scope', 'EMail'); + } + } + + + public function GetDefaultMailServer() + { + return 'imap.gmail.com'; + } + + public function GetScope() + { + return 'https://mail.google.com/'; + } +} \ No newline at end of file diff --git a/datamodels/2.x/itop-oauth-client/src/Service/PopupMenuExtension.php b/datamodels/2.x/itop-oauth-client/src/Service/PopupMenuExtension.php new file mode 100644 index 000000000..7fc0fa78e --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/src/Service/PopupMenuExtension.php @@ -0,0 +1,79 @@ +Get('token')); + $aResult[] = new SeparatorPopupMenuItem(); + + $oAppContext = new ApplicationContext(); + $sMenu = $bHasToken ? 'Menu:RegenerateTokens' : 'Menu:GenerateTokens'; + $sObjClass = get_class($oObj); + $sClass = $sObjClass; + $sId = $oObj->GetKey(); + $sAjaxUri = utils::GetAbsoluteUrlModulePage(static::MODULE_CODE, 'ajax.php'); + // Add a new menu item that triggers a custom JS function defined in our own javascript file: js/sample.js + $sJSFileUrl = utils::GetAbsoluteUrlModulesRoot().static::MODULE_CODE.'/assets/js/oauth_connect.js'; + $sRedirectUri = OAuthClientProviderFactory::GetRedirectUri(); + $aResult[] = new JSPopupMenuItem( + $sMenu.' from '.$sObjClass, + Dict::S($sMenu), + "OAuthConnect('$sClass', $sId, '$sAjaxUri', '$sRedirectUri')", + [$sJSFileUrl] + ); + + if ($bHasToken) { + $sScope = $oObj->Get('scope'); + if ($sScope == 'EMail') { + $aParams = $oAppContext->GetAsHash(); + $sMenu = 'Menu:CreateMailbox'; + $sObjClass = get_class($oObj); + $aParams['class'] = $sObjClass; + $aParams['id'] = $oObj->GetKey(); + $aParams['operation'] = 'CreateMailBox'; + $aResult[] = new URLPopupMenuItem( + $sMenu.' from '.$sObjClass, + Dict::S($sMenu), + utils::GetAbsoluteUrlModulePage(static::MODULE_CODE, 'index.php', $aParams) + ); + } + } + } + break; + + default: + // Unknown type of menu, do nothing + break; + } + + return $aResult; + } +} \ No newline at end of file diff --git a/datamodels/2.x/itop-oauth-client/templates/legacy/CreateMailbox.html.twig b/datamodels/2.x/itop-oauth-client/templates/legacy/CreateMailbox.html.twig new file mode 100644 index 000000000..578bce7b0 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/templates/legacy/CreateMailbox.html.twig @@ -0,0 +1,3 @@ +{# @copyright Copyright (C) 2010-2022 Combodo SARL #} +{# @license http://opensource.org/licenses/AGPL-3.0 #} + diff --git a/datamodels/2.x/itop-oauth-client/templates/legacy/CreateMailbox.ready.js.twig b/datamodels/2.x/itop-oauth-client/templates/legacy/CreateMailbox.ready.js.twig new file mode 100644 index 000000000..8b3d10330 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/templates/legacy/CreateMailbox.ready.js.twig @@ -0,0 +1,4 @@ +{# @copyright Copyright (C) 2010-2022 Combodo SARL #} +{# @license http://opensource.org/licenses/AGPL-3.0 #} + +window.location.href = '{{ sURL|raw }}' \ No newline at end of file diff --git a/datamodels/2.x/itop-oauth-client/tr.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/tr.dict.itop-oauth-client.php new file mode 100644 index 000000000..8ef119962 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/tr.dict.itop-oauth-client.php @@ -0,0 +1,74 @@ + 'Create a mailbox...~~', + 'Menu:OAuthClient' => 'OAuth Client~~', + 'Menu:OAuthClient+' => '~~', + 'Menu:GenerateTokens' => 'Generate access tokens...~~', + 'Menu:RegenerateTokens' => 'Regenerate access tokens...~~', + + 'itop-oauth-client/Operation:CreateMailBox/Title' => 'Mailbox creation~~', + + 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', + '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:TokenCreated' => 'Access token created~~', + 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', +]); + +// +// Class: OAuthClient +// + +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ + 'Class:OAuthClient' => 'Oauth Client~~', + 'Class:OAuthClient/Attribute:provider' => 'Provider~~', + 'Class:OAuthClient/Attribute:provider+' => '~~', + 'Class:OAuthClient/Attribute:name' => 'Login~~', + 'Class:OAuthClient/Attribute:name+' => '~~', + 'Class:OAuthClient/Attribute:scope' => 'Scope~~', + 'Class:OAuthClient/Attribute:scope+' => '~~', + 'Class:OAuthClient/Attribute:description' => 'Description~~', + 'Class:OAuthClient/Attribute:description+' => '~~', + 'Class:OAuthClient/Attribute:client_id' => 'Client id~~', + 'Class:OAuthClient/Attribute:client_id+' => '~~', + 'Class:OAuthClient/Attribute:client_secret' => 'Client secret~~', + 'Class:OAuthClient/Attribute:client_secret+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token' => 'Refresh token~~', + 'Class:OAuthClient/Attribute:refresh_token+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration' => 'Refresh token expiration~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration+' => '~~', + 'Class:OAuthClient/Attribute:token' => 'Access token~~', + 'Class:OAuthClient/Attribute:token+' => '~~', + '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+' => '~~', + 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', +]); + +// +// Class: OAuthClientAzure +// +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ + 'Class:OAuthClientAzure' => 'OAuth client for Microsoft Azure~~', + 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', + +]); + +// +// Class: OAuthClientGoogle +// +Dict::Add('TR TR', 'Turkish', 'Türkçe', [ + 'Class:OAuthClientGoogle' => 'OAuth client for Google~~', + 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', +]); + diff --git a/datamodels/2.x/itop-oauth-client/vendor/autoload.php b/datamodels/2.x/itop-oauth-client/vendor/autoload.php new file mode 100644 index 000000000..d7cdc470f --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/vendor/autoload.php @@ -0,0 +1,7 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + /** @var ?string */ + private $vendorDir; + + // PSR-4 + /** + * @var array[] + * @psalm-var array> + */ + private $prefixLengthsPsr4 = array(); + /** + * @var array[] + * @psalm-var array> + */ + private $prefixDirsPsr4 = array(); + /** + * @var array[] + * @psalm-var array + */ + private $fallbackDirsPsr4 = array(); + + // PSR-0 + /** + * @var array[] + * @psalm-var array> + */ + private $prefixesPsr0 = array(); + /** + * @var array[] + * @psalm-var array + */ + private $fallbackDirsPsr0 = array(); + + /** @var bool */ + private $useIncludePath = false; + + /** + * @var string[] + * @psalm-var array + */ + private $classMap = array(); + + /** @var bool */ + private $classMapAuthoritative = false; + + /** + * @var bool[] + * @psalm-var array + */ + private $missingClasses = array(); + + /** @var ?string */ + private $apcuPrefix; + + /** + * @var self[] + */ + private static $registeredLoaders = array(); + + /** + * @param ?string $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + } + + /** + * @return string[] + */ + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', array_values($this->prefixesPsr0)); + } + + return array(); + } + + /** + * @return array[] + * @psalm-return array> + */ + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + /** + * @return array[] + * @psalm-return array + */ + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + /** + * @return array[] + * @psalm-return array + */ + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + /** + * @return string[] Array of classname => path + * @psalm-var array + */ + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param string[] $classMap Class to filename map + * @psalm-param array $classMap + * + * @return void + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param string[]|string $paths The PSR-0 base directories + * + * @return void + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param string[]|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + * + * @return void + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + * + * @return void + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + * + * @return void + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + * + * @return void + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } + } + + /** + * Unregisters this instance as an autoloader. + * + * @return void + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return true|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + + return null; + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + /** + * Returns the currently registered loaders indexed by their corresponding vendor directories. + * + * @return self[] + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + * @private + */ +function includeFile($file) +{ + include $file; +} diff --git a/datamodels/2.x/itop-oauth-client/vendor/composer/LICENSE b/datamodels/2.x/itop-oauth-client/vendor/composer/LICENSE new file mode 100644 index 000000000..f27399a04 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/vendor/composer/LICENSE @@ -0,0 +1,21 @@ + +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + diff --git a/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_classmap.php b/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_classmap.php new file mode 100644 index 000000000..25e360e9d --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_classmap.php @@ -0,0 +1,13 @@ + $baseDir . '/src/Controller/AjaxOauthClientController.php', + 'Combodo\\iTop\\OAuthClient\\Controller\\OAuthClientController' => $baseDir . '/src/Controller/OAuthClientController.php', + 'Combodo\\iTop\\OAuthClient\\Service\\PopupMenuExtension' => $baseDir . '/src/Service/PopupMenuExtension.php', + 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', +); diff --git a/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_namespaces.php b/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_namespaces.php new file mode 100644 index 000000000..b7fc0125d --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_namespaces.php @@ -0,0 +1,9 @@ + array($baseDir . '/src'), +); diff --git a/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_real.php b/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_real.php new file mode 100644 index 000000000..ad033ac9f --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_real.php @@ -0,0 +1,46 @@ += 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInitd52424b43ff18219f2ec935428aff074::getInitializer($loader)); + } else { + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } + + $loader->setClassMapAuthoritative(true); + $loader->register(true); + + return $loader; + } +} diff --git a/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_static.php b/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_static.php new file mode 100644 index 000000000..3f16c1e01 --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/vendor/composer/autoload_static.php @@ -0,0 +1,39 @@ + + array ( + 'Combodo\\iTop\\OAuthClient\\' => 25, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'Combodo\\iTop\\OAuthClient\\' => + array ( + 0 => __DIR__ . '/../..' . '/src', + ), + ); + + public static $classMap = array ( + 'Combodo\\iTop\\OAuthClient\\Controller\\AjaxOauthClientController' => __DIR__ . '/../..' . '/src/Controller/AjaxOauthClientController.php', + 'Combodo\\iTop\\OAuthClient\\Controller\\OAuthClientController' => __DIR__ . '/../..' . '/src/Controller/OAuthClientController.php', + 'Combodo\\iTop\\OAuthClient\\Service\\PopupMenuExtension' => __DIR__ . '/../..' . '/src/Service/PopupMenuExtension.php', + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInitd52424b43ff18219f2ec935428aff074::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitd52424b43ff18219f2ec935428aff074::$prefixDirsPsr4; + $loader->classMap = ComposerStaticInitd52424b43ff18219f2ec935428aff074::$classMap; + + }, null, ClassLoader::class); + } +} diff --git a/datamodels/2.x/itop-oauth-client/zh_cn.dict.itop-oauth-client.php b/datamodels/2.x/itop-oauth-client/zh_cn.dict.itop-oauth-client.php new file mode 100644 index 000000000..e4f644fde --- /dev/null +++ b/datamodels/2.x/itop-oauth-client/zh_cn.dict.itop-oauth-client.php @@ -0,0 +1,74 @@ + 'Create a mailbox...~~', + 'Menu:OAuthClient' => 'OAuth Client~~', + 'Menu:OAuthClient+' => '~~', + 'Menu:GenerateTokens' => 'Generate access tokens...~~', + 'Menu:RegenerateTokens' => 'Regenerate access tokens...~~', + + 'itop-oauth-client/Operation:CreateMailBox/Title' => 'Mailbox creation~~', + + 'itop-oauth-client:UsedForSMTP' => 'This OAuth client is used for SMTP~~', + '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:TokenCreated' => 'Access token created~~', + 'itop-oauth-client:Message:TokenRecreated' => 'Access token regenerated~~', +]); + +// +// Class: OAuthClient +// + +Dict::Add('ZH CN', 'Chinese', '简体中文', [ + 'Class:OAuthClient' => 'Oauth Client~~', + 'Class:OAuthClient/Attribute:provider' => 'Provider~~', + 'Class:OAuthClient/Attribute:provider+' => '~~', + 'Class:OAuthClient/Attribute:name' => 'Login~~', + 'Class:OAuthClient/Attribute:name+' => '~~', + 'Class:OAuthClient/Attribute:scope' => 'Scope~~', + 'Class:OAuthClient/Attribute:scope+' => '~~', + 'Class:OAuthClient/Attribute:description' => 'Description~~', + 'Class:OAuthClient/Attribute:description+' => '~~', + 'Class:OAuthClient/Attribute:client_id' => 'Client id~~', + 'Class:OAuthClient/Attribute:client_id+' => '~~', + 'Class:OAuthClient/Attribute:client_secret' => 'Client secret~~', + 'Class:OAuthClient/Attribute:client_secret+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token' => 'Refresh token~~', + 'Class:OAuthClient/Attribute:refresh_token+' => '~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration' => 'Refresh token expiration~~', + 'Class:OAuthClient/Attribute:refresh_token_expiration+' => '~~', + 'Class:OAuthClient/Attribute:token' => 'Access token~~', + 'Class:OAuthClient/Attribute:token+' => '~~', + '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+' => '~~', + 'Class:OAuthClient/Attribute:mailbox_list' => 'Mailbox list~~', + 'Class:OAuthClient/Attribute:mailbox_list+' => '~~', +]); + +// +// Class: OAuthClientAzure +// +Dict::Add('ZH CN', 'Chinese', '简体中文', [ + 'Class:OAuthClientAzure' => 'OAuth client for Microsoft Azure~~', + 'Class:OAuthClientAzure/Name' => '%1$s (%2$s)~~', + +]); + +// +// Class: OAuthClientGoogle +// +Dict::Add('ZH CN', 'Chinese', '简体中文', [ + 'Class:OAuthClientGoogle' => 'OAuth client for Google~~', + 'Class:OAuthClientGoogle/Name' => '%1$s (%2$s)~~', +]); + diff --git a/datamodels/2.x/itop-welcome-itil/datamodel.itop-welcome-itil.xml b/datamodels/2.x/itop-welcome-itil/datamodel.itop-welcome-itil.xml index 244951519..9985d4ed6 100644 --- a/datamodels/2.x/itop-welcome-itil/datamodel.itop-welcome-itil.xml +++ b/datamodels/2.x/itop-welcome-itil/datamodel.itop-welcome-itil.xml @@ -29,10 +29,5 @@ - - 45 - ConfigurationTools - $pages/oauth.wizard.php - diff --git a/dictionaries/cs.dictionary.itop.ui.php b/dictionaries/cs.dictionary.itop.ui.php index 5eb2c9444..ddf9906f0 100755 --- a/dictionaries/cs.dictionary.itop.ui.php +++ b/dictionaries/cs.dictionary.itop.ui.php @@ -1676,22 +1676,6 @@ Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'Menu:ConfigurationTools' => 'Configuration~~', )); -// OAuth -Dict::Add('CS CZ', 'Czech', 'Čeština', array( - 'Menu:OAuthWizardMenu' => 'OAuth 2.0~~', - 'core/Operation:Wizard/Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Page:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Panel:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Input:ClientId:Label' => 'Client Id~~', - 'UI:OAuth:Wizard:Form:Input:ClientSecret:Label' => 'Client Secret~~', - 'UI:OAuth:Wizard:Form:Input:Scope:Label' => 'Scope~~', - 'UI:OAuth:Wizard:Form:Input:Additional:Label' => 'Additional parameters~~', - 'UI:OAuth:Wizard:Form:Input:RedirectUri:Label' => 'Redirect Uri~~', - 'UI:OAuth:Wizard:Form:Button:Submit:Label' => 'Authentication~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Title' => 'Configuration for SMTP~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Description' => 'Paste this content into your configuration file to use this OAuth connection for your outgoing emails~~', -)); - // Additional language entries not present in English dict Dict::Add('CS CZ', 'Czech', 'Čeština', array( 'UI:Toggle:StandardDashboard' => 'Standard~~', diff --git a/dictionaries/da.dictionary.itop.ui.php b/dictionaries/da.dictionary.itop.ui.php index e0f6d77b7..19b632898 100644 --- a/dictionaries/da.dictionary.itop.ui.php +++ b/dictionaries/da.dictionary.itop.ui.php @@ -1667,22 +1667,6 @@ Dict::Add('DA DA', 'Danish', 'Dansk', array( 'Menu:ConfigurationTools' => 'Configuration~~', )); -// OAuth -Dict::Add('DA DA', 'Danish', 'Dansk', array( - 'Menu:OAuthWizardMenu' => 'OAuth 2.0~~', - 'core/Operation:Wizard/Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Page:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Panel:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Input:ClientId:Label' => 'Client Id~~', - 'UI:OAuth:Wizard:Form:Input:ClientSecret:Label' => 'Client Secret~~', - 'UI:OAuth:Wizard:Form:Input:Scope:Label' => 'Scope~~', - 'UI:OAuth:Wizard:Form:Input:Additional:Label' => 'Additional parameters~~', - 'UI:OAuth:Wizard:Form:Input:RedirectUri:Label' => 'Redirect Uri~~', - 'UI:OAuth:Wizard:Form:Button:Submit:Label' => 'Authentication~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Title' => 'Configuration for SMTP~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Description' => 'Paste this content into your configuration file to use this OAuth connection for your outgoing emails~~', -)); - // Additional language entries not present in English dict Dict::Add('DA DA', 'Danish', 'Dansk', array( 'UI:Toggle:StandardDashboard' => 'Standard~~', diff --git a/dictionaries/de.dictionary.itop.ui.php b/dictionaries/de.dictionary.itop.ui.php index 6a188cda6..f6249a11f 100644 --- a/dictionaries/de.dictionary.itop.ui.php +++ b/dictionaries/de.dictionary.itop.ui.php @@ -1674,18 +1674,3 @@ Dict::Add('DE DE', 'German', 'Deutsch', array( 'UI:Dashboard:Revert' => 'Auf Originalversion zurücksetzen...', )); -// OAuth -Dict::Add('DE DE', 'German', 'Deutsch', array( - 'Menu:OAuthWizardMenu' => 'OAuth 2.0~~', - 'core/Operation:Wizard/Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Page:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Panel:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Input:ClientId:Label' => 'Client Id~~', - 'UI:OAuth:Wizard:Form:Input:ClientSecret:Label' => 'Client Secret~~', - 'UI:OAuth:Wizard:Form:Input:Scope:Label' => 'Scope~~', - 'UI:OAuth:Wizard:Form:Input:Additional:Label' => 'Additional parameters~~', - 'UI:OAuth:Wizard:Form:Input:RedirectUri:Label' => 'Redirect Uri~~', - 'UI:OAuth:Wizard:Form:Button:Submit:Label' => 'Authentication~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Title' => 'Configuration for SMTP~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Description' => 'Paste this content into your configuration file to use this OAuth connection for your outgoing emails~~', -)); diff --git a/dictionaries/en.dictionary.itop.ui.php b/dictionaries/en.dictionary.itop.ui.php index f9d07c0a5..0db7ae3a8 100644 --- a/dictionaries/en.dictionary.itop.ui.php +++ b/dictionaries/en.dictionary.itop.ui.php @@ -1690,19 +1690,3 @@ Dict::Add('EN US', 'English', 'English', array( 'Menu:Queries' => 'Queries', 'Menu:ConfigurationTools' => 'Configuration', )); - -// OAuth -Dict::Add('EN US', 'English', 'English', array( - 'Menu:OAuthWizardMenu' => 'OAuth 2.0', - 'core/Operation:Wizard/Title' => 'OAuth 2.0 Configuration', - 'UI:OAuth:Wizard:Page:Title' => 'OAuth 2.0 Configuration', - 'UI:OAuth:Wizard:Form:Panel:Title' => 'OAuth 2.0 Configuration', - 'UI:OAuth:Wizard:Form:Input:ClientId:Label' => 'Client Id', - 'UI:OAuth:Wizard:Form:Input:ClientSecret:Label' => 'Client Secret', - 'UI:OAuth:Wizard:Form:Input:Scope:Label' => 'Scope', - 'UI:OAuth:Wizard:Form:Input:Additional:Label' => 'Additional parameters', - 'UI:OAuth:Wizard:Form:Input:RedirectUri:Label' => 'Redirect Uri', - 'UI:OAuth:Wizard:Form:Button:Submit:Label' => 'Authentication', - 'UI:OAuth:Wizard:ResultConf:Panel:Title' => 'Configuration for SMTP', - 'UI:OAuth:Wizard:ResultConf:Panel:Description' => 'Paste this content into your configuration file to use this OAuth connection for your outgoing emails', -)); \ No newline at end of file diff --git a/dictionaries/es_cr.dictionary.itop.ui.php b/dictionaries/es_cr.dictionary.itop.ui.php index 31ccb483d..ac53295a8 100644 --- a/dictionaries/es_cr.dictionary.itop.ui.php +++ b/dictionaries/es_cr.dictionary.itop.ui.php @@ -1682,22 +1682,6 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'Menu:ConfigurationTools' => 'Configuración', )); -// OAuth -Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( - 'Menu:OAuthWizardMenu' => 'OAuth 2.0~~', - 'core/Operation:Wizard/Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Page:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Panel:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Input:ClientId:Label' => 'Client Id~~', - 'UI:OAuth:Wizard:Form:Input:ClientSecret:Label' => 'Client Secret~~', - 'UI:OAuth:Wizard:Form:Input:Scope:Label' => 'Scope~~', - 'UI:OAuth:Wizard:Form:Input:Additional:Label' => 'Additional parameters~~', - 'UI:OAuth:Wizard:Form:Input:RedirectUri:Label' => 'Redirect Uri~~', - 'UI:OAuth:Wizard:Form:Button:Submit:Label' => 'Authentication~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Title' => 'Configuration for SMTP~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Description' => 'Paste this content into your configuration file to use this OAuth connection for your outgoing emails~~', -)); - // Additional language entries not present in English dict Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array( 'UI:Toggle:StandardDashboard' => 'Standard~~', diff --git a/dictionaries/fr.dictionary.itop.ui.php b/dictionaries/fr.dictionary.itop.ui.php index 92112c401..619b64abb 100644 --- a/dictionaries/fr.dictionary.itop.ui.php +++ b/dictionaries/fr.dictionary.itop.ui.php @@ -1671,19 +1671,3 @@ Dict::Add('FR FR', 'French', 'Français', array( 'Menu:Queries' => 'Requêtes', 'Menu:ConfigurationTools' => 'Configuration', )); - -// OAuth -Dict::Add('FR FR', 'French', 'Français', array( - 'Menu:OAuthWizardMenu' => 'OAuth 2.0~~', - 'core/Operation:Wizard/Title' => 'Configuration OAuth 2.0', - 'UI:OAuth:Wizard:Page:Title' => 'Configuration OAuth 2.0', - 'UI:OAuth:Wizard:Form:Panel:Title' => 'Configuration OAuth 2.0', - 'UI:OAuth:Wizard:Form:Input:ClientId:Label' => 'Id client', - 'UI:OAuth:Wizard:Form:Input:ClientSecret:Label' => 'Secret client', - 'UI:OAuth:Wizard:Form:Input:Scope:Label' => 'Scope', - 'UI:OAuth:Wizard:Form:Input:Additional:Label' => 'Paramètres additionnels', - 'UI:OAuth:Wizard:Form:Input:RedirectUri:Label' => 'URI de redirection', - 'UI:OAuth:Wizard:Form:Button:Submit:Label' => 'Authentification', - 'UI:OAuth:Wizard:ResultConf:Panel:Title' => 'Configuration pour SMTP', - 'UI:OAuth:Wizard:ResultConf:Panel:Description' => 'Copier ces lignes dans la configuration pour utiliser cette connexion OAyth 2.0 pour les mails sortants', -)); \ No newline at end of file diff --git a/dictionaries/hu.dictionary.itop.ui.php b/dictionaries/hu.dictionary.itop.ui.php index 8a1514f10..89929addd 100755 --- a/dictionaries/hu.dictionary.itop.ui.php +++ b/dictionaries/hu.dictionary.itop.ui.php @@ -1667,22 +1667,6 @@ Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'Menu:ConfigurationTools' => 'Configuration~~', )); -// OAuth -Dict::Add('HU HU', 'Hungarian', 'Magyar', array( - 'Menu:OAuthWizardMenu' => 'OAuth 2.0~~', - 'core/Operation:Wizard/Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Page:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Panel:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Input:ClientId:Label' => 'Client Id~~', - 'UI:OAuth:Wizard:Form:Input:ClientSecret:Label' => 'Client Secret~~', - 'UI:OAuth:Wizard:Form:Input:Scope:Label' => 'Scope~~', - 'UI:OAuth:Wizard:Form:Input:Additional:Label' => 'Additional parameters~~', - 'UI:OAuth:Wizard:Form:Input:RedirectUri:Label' => 'Redirect Uri~~', - 'UI:OAuth:Wizard:Form:Button:Submit:Label' => 'Authentication~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Title' => 'Configuration for SMTP~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Description' => 'Paste this content into your configuration file to use this OAuth connection for your outgoing emails~~', -)); - // Additional language entries not present in English dict Dict::Add('HU HU', 'Hungarian', 'Magyar', array( 'UI:Toggle:StandardDashboard' => 'Standard~~', diff --git a/dictionaries/it.dictionary.itop.ui.php b/dictionaries/it.dictionary.itop.ui.php index 855282309..22c6d29fc 100644 --- a/dictionaries/it.dictionary.itop.ui.php +++ b/dictionaries/it.dictionary.itop.ui.php @@ -1678,22 +1678,6 @@ Dict::Add('IT IT', 'Italian', 'Italiano', array( 'Menu:ConfigurationTools' => 'configurazione', )); -// OAuth -Dict::Add('IT IT', 'Italian', 'Italiano', array( - 'Menu:OAuthWizardMenu' => 'OAuth 2.0~~', - 'core/Operation:Wizard/Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Page:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Panel:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Input:ClientId:Label' => 'Client Id~~', - 'UI:OAuth:Wizard:Form:Input:ClientSecret:Label' => 'Client Secret~~', - 'UI:OAuth:Wizard:Form:Input:Scope:Label' => 'Scope~~', - 'UI:OAuth:Wizard:Form:Input:Additional:Label' => 'Additional parameters~~', - 'UI:OAuth:Wizard:Form:Input:RedirectUri:Label' => 'Redirect Uri~~', - 'UI:OAuth:Wizard:Form:Button:Submit:Label' => 'Authentication~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Title' => 'Configuration for SMTP~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Description' => 'Paste this content into your configuration file to use this OAuth connection for your outgoing emails~~', -)); - // Additional language entries not present in English dict Dict::Add('IT IT', 'Italian', 'Italiano', array( 'UI:Toggle:StandardDashboard' => 'Standard~~', diff --git a/dictionaries/ja.dictionary.itop.ui.php b/dictionaries/ja.dictionary.itop.ui.php index 463eb43de..3c78e7d90 100644 --- a/dictionaries/ja.dictionary.itop.ui.php +++ b/dictionaries/ja.dictionary.itop.ui.php @@ -1667,22 +1667,6 @@ Dict::Add('JA JP', 'Japanese', '日本語', array( 'Menu:ConfigurationTools' => 'Configuration~~', )); -// OAuth -Dict::Add('JA JP', 'Japanese', '日本語', array( - 'Menu:OAuthWizardMenu' => 'OAuth 2.0~~', - 'core/Operation:Wizard/Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Page:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Panel:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Input:ClientId:Label' => 'Client Id~~', - 'UI:OAuth:Wizard:Form:Input:ClientSecret:Label' => 'Client Secret~~', - 'UI:OAuth:Wizard:Form:Input:Scope:Label' => 'Scope~~', - 'UI:OAuth:Wizard:Form:Input:Additional:Label' => 'Additional parameters~~', - 'UI:OAuth:Wizard:Form:Input:RedirectUri:Label' => 'Redirect Uri~~', - 'UI:OAuth:Wizard:Form:Button:Submit:Label' => 'Authentication~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Title' => 'Configuration for SMTP~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Description' => 'Paste this content into your configuration file to use this OAuth connection for your outgoing emails~~', -)); - // Additional language entries not present in English dict Dict::Add('JA JP', 'Japanese', '日本語', array( 'UI:Toggle:StandardDashboard' => 'Standard~~', diff --git a/dictionaries/nl.dictionary.itop.ui.php b/dictionaries/nl.dictionary.itop.ui.php index 4aca72485..1f6abbfab 100644 --- a/dictionaries/nl.dictionary.itop.ui.php +++ b/dictionaries/nl.dictionary.itop.ui.php @@ -1681,22 +1681,6 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Menu:ConfigurationTools' => 'Configuratie', )); -// OAuth -Dict::Add('NL NL', 'Dutch', 'Nederlands', array( - 'Menu:OAuthWizardMenu' => 'OAuth 2.0~~', - 'core/Operation:Wizard/Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Page:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Panel:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Input:ClientId:Label' => 'Client Id~~', - 'UI:OAuth:Wizard:Form:Input:ClientSecret:Label' => 'Client Secret~~', - 'UI:OAuth:Wizard:Form:Input:Scope:Label' => 'Scope~~', - 'UI:OAuth:Wizard:Form:Input:Additional:Label' => 'Additional parameters~~', - 'UI:OAuth:Wizard:Form:Input:RedirectUri:Label' => 'Redirect Uri~~', - 'UI:OAuth:Wizard:Form:Button:Submit:Label' => 'Authentication~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Title' => 'Configuration for SMTP~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Description' => 'Paste this content into your configuration file to use this OAuth connection for your outgoing emails~~', -)); - // Additional language entries not present in English dict Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'UI:Toggle:StandardDashboard' => 'Standaard', diff --git a/dictionaries/pt_br.dictionary.itop.ui.php b/dictionaries/pt_br.dictionary.itop.ui.php index cb0b57fbb..2cdd156bb 100644 --- a/dictionaries/pt_br.dictionary.itop.ui.php +++ b/dictionaries/pt_br.dictionary.itop.ui.php @@ -1678,22 +1678,6 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'Menu:ConfigurationTools' => 'Configuração', )); -// OAuth -Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( - 'Menu:OAuthWizardMenu' => 'OAuth 2.0~~', - 'core/Operation:Wizard/Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Page:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Panel:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Input:ClientId:Label' => 'Client Id~~', - 'UI:OAuth:Wizard:Form:Input:ClientSecret:Label' => 'Client Secret~~', - 'UI:OAuth:Wizard:Form:Input:Scope:Label' => 'Scope~~', - 'UI:OAuth:Wizard:Form:Input:Additional:Label' => 'Additional parameters~~', - 'UI:OAuth:Wizard:Form:Input:RedirectUri:Label' => 'Redirect Uri~~', - 'UI:OAuth:Wizard:Form:Button:Submit:Label' => 'Authentication~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Title' => 'Configuration for SMTP~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Description' => 'Paste this content into your configuration file to use this OAuth connection for your outgoing emails~~', -)); - // Additional language entries not present in English dict Dict::Add('PT BR', 'Brazilian', 'Brazilian', array( 'UI:Toggle:StandardDashboard' => 'Padrão', diff --git a/dictionaries/ru.dictionary.itop.ui.php b/dictionaries/ru.dictionary.itop.ui.php index 384fb5a9f..edc0a00ae 100644 --- a/dictionaries/ru.dictionary.itop.ui.php +++ b/dictionaries/ru.dictionary.itop.ui.php @@ -1678,22 +1678,6 @@ Dict::Add('RU RU', 'Russian', 'Русский', array( 'Menu:ConfigurationTools' => 'Конфигурация', )); -// OAuth -Dict::Add('RU RU', 'Russian', 'Русский', array( - 'Menu:OAuthWizardMenu' => 'OAuth 2.0~~', - 'core/Operation:Wizard/Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Page:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Panel:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Input:ClientId:Label' => 'Client Id~~', - 'UI:OAuth:Wizard:Form:Input:ClientSecret:Label' => 'Client Secret~~', - 'UI:OAuth:Wizard:Form:Input:Scope:Label' => 'Scope~~', - 'UI:OAuth:Wizard:Form:Input:Additional:Label' => 'Additional parameters~~', - 'UI:OAuth:Wizard:Form:Input:RedirectUri:Label' => 'Redirect Uri~~', - 'UI:OAuth:Wizard:Form:Button:Submit:Label' => 'Authentication~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Title' => 'Configuration for SMTP~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Description' => 'Paste this content into your configuration file to use this OAuth connection for your outgoing emails~~', -)); - // Additional language entries not present in English dict Dict::Add('RU RU', 'Russian', 'Русский', array( 'UI:CSVImport:ObjectsReчmainedUnchanged' => '%1$d объект(ов) не изменились.', diff --git a/dictionaries/sk.dictionary.itop.ui.php b/dictionaries/sk.dictionary.itop.ui.php index a0ef197eb..d1a1960ca 100644 --- a/dictionaries/sk.dictionary.itop.ui.php +++ b/dictionaries/sk.dictionary.itop.ui.php @@ -1670,22 +1670,6 @@ Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'Menu:ConfigurationTools' => 'Configuration~~', )); -// OAuth -Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( - 'Menu:OAuthWizardMenu' => 'OAuth 2.0~~', - 'core/Operation:Wizard/Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Page:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Panel:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Input:ClientId:Label' => 'Client Id~~', - 'UI:OAuth:Wizard:Form:Input:ClientSecret:Label' => 'Client Secret~~', - 'UI:OAuth:Wizard:Form:Input:Scope:Label' => 'Scope~~', - 'UI:OAuth:Wizard:Form:Input:Additional:Label' => 'Additional parameters~~', - 'UI:OAuth:Wizard:Form:Input:RedirectUri:Label' => 'Redirect Uri~~', - 'UI:OAuth:Wizard:Form:Button:Submit:Label' => 'Authentication~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Title' => 'Configuration for SMTP~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Description' => 'Paste this content into your configuration file to use this OAuth connection for your outgoing emails~~', -)); - // Additional language entries not present in English dict Dict::Add('SK SK', 'Slovak', 'Slovenčina', array( 'UI:Toggle:StandardDashboard' => 'Standard~~', diff --git a/dictionaries/tr.dictionary.itop.ui.php b/dictionaries/tr.dictionary.itop.ui.php index 896f7823c..7f1b7264c 100644 --- a/dictionaries/tr.dictionary.itop.ui.php +++ b/dictionaries/tr.dictionary.itop.ui.php @@ -1716,22 +1716,6 @@ Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'Menu:ConfigurationTools' => 'Configuration~~', )); -// OAuth -Dict::Add('TR TR', 'Turkish', 'Türkçe', array( - 'Menu:OAuthWizardMenu' => 'OAuth 2.0~~', - 'core/Operation:Wizard/Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Page:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Panel:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Input:ClientId:Label' => 'Client Id~~', - 'UI:OAuth:Wizard:Form:Input:ClientSecret:Label' => 'Client Secret~~', - 'UI:OAuth:Wizard:Form:Input:Scope:Label' => 'Scope~~', - 'UI:OAuth:Wizard:Form:Input:Additional:Label' => 'Additional parameters~~', - 'UI:OAuth:Wizard:Form:Input:RedirectUri:Label' => 'Redirect Uri~~', - 'UI:OAuth:Wizard:Form:Button:Submit:Label' => 'Authentication~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Title' => 'Configuration for SMTP~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Description' => 'Paste this content into your configuration file to use this OAuth connection for your outgoing emails~~', -)); - // Additional language entries not present in English dict Dict::Add('TR TR', 'Turkish', 'Türkçe', array( 'UI:Toggle:StandardDashboard' => 'Standard~~', diff --git a/dictionaries/zh_cn.dictionary.itop.ui.php b/dictionaries/zh_cn.dictionary.itop.ui.php index a7b41a9a0..05e85367f 100644 --- a/dictionaries/zh_cn.dictionary.itop.ui.php +++ b/dictionaries/zh_cn.dictionary.itop.ui.php @@ -1683,22 +1683,6 @@ Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'Menu:ConfigurationTools' => '配置', )); -// OAuth -Dict::Add('ZH CN', 'Chinese', '简体中文', array( - 'Menu:OAuthWizardMenu' => 'OAuth 2.0~~', - 'core/Operation:Wizard/Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Page:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Panel:Title' => 'OAuth 2.0 Configuration~~', - 'UI:OAuth:Wizard:Form:Input:ClientId:Label' => 'Client Id~~', - 'UI:OAuth:Wizard:Form:Input:ClientSecret:Label' => 'Client Secret~~', - 'UI:OAuth:Wizard:Form:Input:Scope:Label' => 'Scope~~', - 'UI:OAuth:Wizard:Form:Input:Additional:Label' => 'Additional parameters~~', - 'UI:OAuth:Wizard:Form:Input:RedirectUri:Label' => 'Redirect Uri~~', - 'UI:OAuth:Wizard:Form:Button:Submit:Label' => 'Authentication~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Title' => 'Configuration for SMTP~~', - 'UI:OAuth:Wizard:ResultConf:Panel:Description' => 'Paste this content into your configuration file to use this OAuth connection for your outgoing emails~~', -)); - // Additional language entries not present in English dict Dict::Add('ZH CN', 'Chinese', '简体中文', array( 'UI:Toggle:StandardDashboard' => '标准', diff --git a/images/icons/icons8-adjust.svg b/images/icons/icons8-adjust.svg deleted file mode 100644 index b318b8e72..000000000 --- a/images/icons/icons8-adjust.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-administrative-tools.svg b/images/icons/icons8-administrative-tools.svg deleted file mode 100644 index c3add8fe7..000000000 --- a/images/icons/icons8-administrative-tools.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-application-window.svg b/images/icons/icons8-application-window.svg deleted file mode 100644 index 279b80e3b..000000000 --- a/images/icons/icons8-application-window.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-apps-tab.svg b/images/icons/icons8-apps-tab.svg deleted file mode 100644 index 6c3b113ce..000000000 --- a/images/icons/icons8-apps-tab.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-archive-folder.svg b/images/icons/icons8-archive-folder.svg deleted file mode 100644 index 5a087f860..000000000 --- a/images/icons/icons8-archive-folder.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-audit.svg b/images/icons/icons8-audit.svg deleted file mode 100644 index 3f5277793..000000000 --- a/images/icons/icons8-audit.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-automatic.svg b/images/icons/icons8-automatic.svg deleted file mode 100644 index 40afe88e9..000000000 --- a/images/icons/icons8-automatic.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-bandage.svg b/images/icons/icons8-bandage.svg deleted file mode 100644 index d9008bd94..000000000 --- a/images/icons/icons8-bandage.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-book-error.svg b/images/icons/icons8-book-error.svg deleted file mode 100644 index 8117faf86..000000000 --- a/images/icons/icons8-book-error.svg +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-calendar.svg b/images/icons/icons8-calendar.svg deleted file mode 100644 index 39cabd979..000000000 --- a/images/icons/icons8-calendar.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-cassette.svg b/images/icons/icons8-cassette.svg deleted file mode 100644 index 0a5f61044..000000000 --- a/images/icons/icons8-cassette.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-change-approved.svg b/images/icons/icons8-change-approved.svg deleted file mode 100644 index df4556339..000000000 --- a/images/icons/icons8-change-approved.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-change-emergency.svg b/images/icons/icons8-change-emergency.svg deleted file mode 100644 index 88b484395..000000000 --- a/images/icons/icons8-change-emergency.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-change-normal.svg b/images/icons/icons8-change-normal.svg deleted file mode 100644 index 771651a3d..000000000 --- a/images/icons/icons8-change-normal.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-change-routine.svg b/images/icons/icons8-change-routine.svg deleted file mode 100644 index f97454c22..000000000 --- a/images/icons/icons8-change-routine.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-change.svg b/images/icons/icons8-change.svg deleted file mode 100644 index c2b598ae4..000000000 --- a/images/icons/icons8-change.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-checkmark.svg b/images/icons/icons8-checkmark.svg deleted file mode 100644 index 6d3be1d6e..000000000 --- a/images/icons/icons8-checkmark.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-cloud-file.svg b/images/icons/icons8-cloud-file.svg deleted file mode 100644 index f15cdb1b7..000000000 --- a/images/icons/icons8-cloud-file.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-conflict.svg b/images/icons/icons8-conflict.svg deleted file mode 100644 index 794f0a18a..000000000 --- a/images/icons/icons8-conflict.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-contract.svg b/images/icons/icons8-contract.svg deleted file mode 100644 index 44c3747b4..000000000 --- a/images/icons/icons8-contract.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-customer.svg b/images/icons/icons8-customer.svg deleted file mode 100644 index 7c6412829..000000000 --- a/images/icons/icons8-customer.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-database-custom.svg b/images/icons/icons8-database-custom.svg deleted file mode 100644 index 1911ed91c..000000000 --- a/images/icons/icons8-database-custom.svg +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-database.svg b/images/icons/icons8-database.svg deleted file mode 100644 index 14a29ab99..000000000 --- a/images/icons/icons8-database.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-delete.svg b/images/icons/icons8-delete.svg deleted file mode 100644 index 21b40b1f1..000000000 --- a/images/icons/icons8-delete.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-department.svg b/images/icons/icons8-department.svg deleted file mode 100644 index ca480383c..000000000 --- a/images/icons/icons8-department.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-desktop.svg b/images/icons/icons8-desktop.svg deleted file mode 100644 index feda1844d..000000000 --- a/images/icons/icons8-desktop.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-discussion-forum.svg b/images/icons/icons8-discussion-forum.svg deleted file mode 100644 index 353d4a706..000000000 --- a/images/icons/icons8-discussion-forum.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-documents.svg b/images/icons/icons8-documents.svg deleted file mode 100644 index a3ede6e2f..000000000 --- a/images/icons/icons8-documents.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-electrical.svg b/images/icons/icons8-electrical.svg deleted file mode 100644 index 6c0bb910d..000000000 --- a/images/icons/icons8-electrical.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-electricity.svg b/images/icons/icons8-electricity.svg deleted file mode 100644 index 7b8cb99e6..000000000 --- a/images/icons/icons8-electricity.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-electronics.svg b/images/icons/icons8-electronics.svg deleted file mode 100644 index 0e8f0c1c0..000000000 --- a/images/icons/icons8-electronics.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-enclosure-for-servers.svg b/images/icons/icons8-enclosure-for-servers.svg deleted file mode 100644 index 0cd8df095..000000000 --- a/images/icons/icons8-enclosure-for-servers.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-export-csv.svg b/images/icons/icons8-export-csv.svg deleted file mode 100644 index 528abd785..000000000 --- a/images/icons/icons8-export-csv.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-faq.svg b/images/icons/icons8-faq.svg deleted file mode 100644 index caa61afdc..000000000 --- a/images/icons/icons8-faq.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-farm.svg b/images/icons/icons8-farm.svg deleted file mode 100644 index e13069680..000000000 --- a/images/icons/icons8-farm.svg +++ /dev/null @@ -1,426 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-file.svg b/images/icons/icons8-file.svg deleted file mode 100644 index e7b9b5ae0..000000000 --- a/images/icons/icons8-file.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-globe-cable.svg b/images/icons/icons8-globe-cable.svg deleted file mode 100644 index cb1c5a5d1..000000000 --- a/images/icons/icons8-globe-cable.svg +++ /dev/null @@ -1,338 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-globe-fiber.svg b/images/icons/icons8-globe-fiber.svg deleted file mode 100644 index 9f844542e..000000000 --- a/images/icons/icons8-globe-fiber.svg +++ /dev/null @@ -1,300 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-globe-wire.svg b/images/icons/icons8-globe-wire.svg deleted file mode 100644 index 03c5b94c8..000000000 --- a/images/icons/icons8-globe-wire.svg +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-hdd.svg b/images/icons/icons8-hdd.svg deleted file mode 100644 index 2c6a9df88..000000000 --- a/images/icons/icons8-hdd.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-hierarchy.svg b/images/icons/icons8-hierarchy.svg deleted file mode 100644 index fe7f96a1a..000000000 --- a/images/icons/icons8-hierarchy.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-hypervisor.svg b/images/icons/icons8-hypervisor.svg deleted file mode 100644 index 68382ec82..000000000 --- a/images/icons/icons8-hypervisor.svg +++ /dev/null @@ -1,181 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-import-csv.svg b/images/icons/icons8-import-csv.svg deleted file mode 100644 index 2339e50e3..000000000 --- a/images/icons/icons8-import-csv.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-important-book.svg b/images/icons/icons8-important-book.svg deleted file mode 100644 index bbf86c350..000000000 --- a/images/icons/icons8-important-book.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-in-transit.svg b/images/icons/icons8-in-transit.svg deleted file mode 100644 index 1309c8950..000000000 --- a/images/icons/icons8-in-transit.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-laptop.svg b/images/icons/icons8-laptop.svg deleted file mode 100644 index 146cf3783..000000000 --- a/images/icons/icons8-laptop.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-licence.svg b/images/icons/icons8-licence.svg deleted file mode 100644 index 5324d8010..000000000 --- a/images/icons/icons8-licence.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-map-as-drive.svg b/images/icons/icons8-map-as-drive.svg deleted file mode 100644 index 3cf8a728a..000000000 --- a/images/icons/icons8-map-as-drive.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-map-marker.svg b/images/icons/icons8-map-marker.svg deleted file mode 100644 index 49a0aee57..000000000 --- a/images/icons/icons8-map-marker.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-mobile.svg b/images/icons/icons8-mobile.svg deleted file mode 100644 index b54c0a7bd..000000000 --- a/images/icons/icons8-mobile.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-music-robot.svg b/images/icons/icons8-music-robot.svg deleted file mode 100644 index 3547191cb..000000000 --- a/images/icons/icons8-music-robot.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-nas.svg b/images/icons/icons8-nas.svg deleted file mode 100644 index 57a49a1c5..000000000 --- a/images/icons/icons8-nas.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-network.svg b/images/icons/icons8-network.svg deleted file mode 100644 index 565e3b43c..000000000 --- a/images/icons/icons8-network.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-new-item.svg b/images/icons/icons8-new-item.svg deleted file mode 100644 index 83bd92971..000000000 --- a/images/icons/icons8-new-item.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-note.svg b/images/icons/icons8-note.svg deleted file mode 100644 index 88bc8e7c5..000000000 --- a/images/icons/icons8-note.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-office-phone.svg b/images/icons/icons8-office-phone.svg deleted file mode 100644 index 250615322..000000000 --- a/images/icons/icons8-office-phone.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-old-vmware-logo.svg b/images/icons/icons8-old-vmware-logo.svg deleted file mode 100644 index 0664f36b0..000000000 --- a/images/icons/icons8-old-vmware-logo.svg +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-organization.svg b/images/icons/icons8-organization.svg deleted file mode 100644 index e5d5ac06a..000000000 --- a/images/icons/icons8-organization.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-person-female.svg b/images/icons/icons8-person-female.svg deleted file mode 100644 index d9600e415..000000000 --- a/images/icons/icons8-person-female.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-phone.svg b/images/icons/icons8-phone.svg deleted file mode 100644 index 06f02dbd4..000000000 --- a/images/icons/icons8-phone.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-plug-socket.svg b/images/icons/icons8-plug-socket.svg deleted file mode 100644 index 568afaa39..000000000 --- a/images/icons/icons8-plug-socket.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-power-plant.svg b/images/icons/icons8-power-plant.svg deleted file mode 100644 index a1734df07..000000000 --- a/images/icons/icons8-power-plant.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-print.svg b/images/icons/icons8-print.svg deleted file mode 100644 index 1d1d44d16..000000000 --- a/images/icons/icons8-print.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-process-improvement.svg b/images/icons/icons8-process-improvement.svg deleted file mode 100644 index ac48f6537..000000000 --- a/images/icons/icons8-process-improvement.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-puzzle.svg b/images/icons/icons8-puzzle.svg deleted file mode 100644 index 7f897ff3a..000000000 --- a/images/icons/icons8-puzzle.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-rack.svg b/images/icons/icons8-rack.svg deleted file mode 100644 index bffb8ead2..000000000 --- a/images/icons/icons8-rack.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-server-custom.svg b/images/icons/icons8-server-custom.svg deleted file mode 100644 index cda6b501f..000000000 --- a/images/icons/icons8-server-custom.svg +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-server-storage.svg b/images/icons/icons8-server-storage.svg deleted file mode 100644 index 30a0b17dc..000000000 --- a/images/icons/icons8-server-storage.svg +++ /dev/null @@ -1,316 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-server.svg b/images/icons/icons8-server.svg deleted file mode 100644 index 6ab7d4675..000000000 --- a/images/icons/icons8-server.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-service.svg b/images/icons/icons8-service.svg deleted file mode 100644 index 1b8a24c14..000000000 --- a/images/icons/icons8-service.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-services.svg b/images/icons/icons8-services.svg deleted file mode 100644 index a704721f1..000000000 --- a/images/icons/icons8-services.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-smartphone-tablet.svg b/images/icons/icons8-smartphone-tablet.svg deleted file mode 100644 index e1207ce37..000000000 --- a/images/icons/icons8-smartphone-tablet.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-software-instance.svg b/images/icons/icons8-software-instance.svg deleted file mode 100644 index 1956de73f..000000000 --- a/images/icons/icons8-software-instance.svg +++ /dev/null @@ -1,315 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-software-license.svg b/images/icons/icons8-software-license.svg deleted file mode 100644 index 3888b6a87..000000000 --- a/images/icons/icons8-software-license.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-software-other.svg b/images/icons/icons8-software-other.svg deleted file mode 100644 index 3893d62b6..000000000 --- a/images/icons/icons8-software-other.svg +++ /dev/null @@ -1,302 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-software.svg b/images/icons/icons8-software.svg deleted file mode 100644 index 82dba9f6f..000000000 --- a/images/icons/icons8-software.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-solve.svg b/images/icons/icons8-solve.svg deleted file mode 100644 index 8b94ae82e..000000000 --- a/images/icons/icons8-solve.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-stack.svg b/images/icons/icons8-stack.svg deleted file mode 100644 index 25b71c621..000000000 --- a/images/icons/icons8-stack.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-switch-san.svg b/images/icons/icons8-switch-san.svg deleted file mode 100644 index 684b10a84..000000000 --- a/images/icons/icons8-switch-san.svg +++ /dev/null @@ -1,259 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-switch.svg b/images/icons/icons8-switch.svg deleted file mode 100644 index bf630f3b6..000000000 --- a/images/icons/icons8-switch.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-tape-library.svg b/images/icons/icons8-tape-library.svg deleted file mode 100644 index f57a8cf82..000000000 --- a/images/icons/icons8-tape-library.svg +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/images/icons/icons8-tasklist.svg b/images/icons/icons8-tasklist.svg deleted file mode 100644 index 3b2363c92..000000000 --- a/images/icons/icons8-tasklist.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-team.svg b/images/icons/icons8-team.svg deleted file mode 100644 index ee3e9efc4..000000000 --- a/images/icons/icons8-team.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-telephone.svg b/images/icons/icons8-telephone.svg deleted file mode 100644 index 5c94ce136..000000000 --- a/images/icons/icons8-telephone.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-time-limit.svg b/images/icons/icons8-time-limit.svg deleted file mode 100644 index 8f24a7c15..000000000 --- a/images/icons/icons8-time-limit.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-virtual-machine.svg b/images/icons/icons8-virtual-machine.svg deleted file mode 100644 index 06e51360f..000000000 --- a/images/icons/icons8-virtual-machine.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/icons8-web.svg b/images/icons/icons8-web.svg deleted file mode 100644 index fe63a42e8..000000000 --- a/images/icons/icons8-web.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/js/wizardhelper.js b/js/wizardhelper.js index 152361514..26933c3c0 100644 --- a/js/wizardhelper.js +++ b/js/wizardhelper.js @@ -261,7 +261,7 @@ function WizardHelper(sClass, sFormPrefix, sState, sInitialState, sStimulus) { index++; } - if(fieldForm!=null){ + if($('.blockUI').length > 0) { fieldForm.find('button[type=submit]:not(:disabled)').prop("disabled", true).addClass('disabledDuringFieldLoading'); } diff --git a/lib/autoload.php b/lib/autoload.php index f1eeef5ab..460e67535 100644 --- a/lib/autoload.php +++ b/lib/autoload.php @@ -2,11 +2,6 @@ // autoload.php @generated by Composer -if (PHP_VERSION_ID < 50600) { - echo 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; - exit(1); -} - require_once __DIR__ . '/composer/autoload_real.php'; return ComposerAutoloaderInit7f81b4a2a468a061c306af5e447a9a9f::getLoader(); diff --git a/lib/composer/ClassLoader.php b/lib/composer/ClassLoader.php index afef3fa2a..0cd6055d1 100644 --- a/lib/composer/ClassLoader.php +++ b/lib/composer/ClassLoader.php @@ -149,7 +149,7 @@ class ClassLoader /** * @return string[] Array of classname => path - * @psalm-return array + * @psalm-var array */ public function getClassMap() { diff --git a/lib/composer/autoload_classmap.php b/lib/composer/autoload_classmap.php index e377da9f3..ace99f3b6 100644 --- a/lib/composer/autoload_classmap.php +++ b/lib/composer/autoload_classmap.php @@ -2,7 +2,7 @@ // autoload_classmap.php @generated by Composer -$vendorDir = dirname(__DIR__); +$vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( @@ -298,17 +298,13 @@ return array( 'Combodo\\iTop\\Composer\\iTopComposer' => $baseDir . '/sources/Composer/iTopComposer.php', 'Combodo\\iTop\\Controller\\AjaxRenderController' => $baseDir . '/sources/Controller/AjaxRenderController.php', 'Combodo\\iTop\\Controller\\Base\\Layout\\ActivityPanelController' => $baseDir . '/sources/Controller/Base/Layout/ActivityPanelController.php', - 'Combodo\\iTop\\Controller\\OAuth\\OAuthAjaxController' => $baseDir . '/sources/Controller/OAuth/OAuthAjaxController.php', 'Combodo\\iTop\\Controller\\OAuth\\OAuthLandingController' => $baseDir . '/sources/Controller/OAuth/OAuthLandingController.php', - 'Combodo\\iTop\\Controller\\OAuth\\OAuthWizardController' => $baseDir . '/sources/Controller/OAuth/OAuthWizardController.php', 'Combodo\\iTop\\Controller\\PreferencesController' => $baseDir . '/sources/Controller/PreferencesController.php', 'Combodo\\iTop\\Core\\Authentication\\Client\\OAuth\\IOAuthClientProvider' => $baseDir . '/sources/Core/Authentication/Client/OAuth/IOAuthClientProvider.php', - 'Combodo\\iTop\\Core\\Authentication\\Client\\OAuth\\IOAuthClientResultDisplay' => $baseDir . '/sources/Core/Authentication/Client/OAuth/IOAuthClientResultDisplay.php', 'Combodo\\iTop\\Core\\Authentication\\Client\\OAuth\\OAuthClientProviderAbstract' => $baseDir . '/sources/Core/Authentication/Client/OAuth/OAuthClientProviderAbstract.php', 'Combodo\\iTop\\Core\\Authentication\\Client\\OAuth\\OAuthClientProviderAzure' => $baseDir . '/sources/Core/Authentication/Client/OAuth/OAuthClientProviderAzure.php', 'Combodo\\iTop\\Core\\Authentication\\Client\\OAuth\\OAuthClientProviderFactory' => $baseDir . '/sources/Core/Authentication/Client/OAuth/OAuthClientProviderFactory.php', 'Combodo\\iTop\\Core\\Authentication\\Client\\OAuth\\OAuthClientProviderGoogle' => $baseDir . '/sources/Core/Authentication/Client/OAuth/OAuthClientProviderGoogle.php', - 'Combodo\\iTop\\Core\\Authentication\\Client\\OAuth\\OAuthClientResultDisplayConf' => $baseDir . '/sources/Core/Authentication/Client/OAuth/OAuthClientResultDisplayConf.php', 'Combodo\\iTop\\Core\\CMDBChange\\CMDBChangeOrigin' => $baseDir . '/sources/Core/CMDBChange/CMDBChangeOrigin.php', 'Combodo\\iTop\\Core\\DbConnectionWrapper' => $baseDir . '/core/DbConnectionWrapper.php', 'Combodo\\iTop\\Core\\Email\\EmailFactory' => $baseDir . '/sources/Core/Email/EmailFactory.php', diff --git a/lib/composer/autoload_namespaces.php b/lib/composer/autoload_namespaces.php index 6629b7e09..1db5bf646 100644 --- a/lib/composer/autoload_namespaces.php +++ b/lib/composer/autoload_namespaces.php @@ -2,7 +2,7 @@ // autoload_namespaces.php @generated by Composer -$vendorDir = dirname(__DIR__); +$vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( diff --git a/lib/composer/autoload_psr4.php b/lib/composer/autoload_psr4.php index 0a7d4ce20..5a52e9e00 100644 --- a/lib/composer/autoload_psr4.php +++ b/lib/composer/autoload_psr4.php @@ -2,7 +2,7 @@ // autoload_psr4.php @generated by Composer -$vendorDir = dirname(__DIR__); +$vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( diff --git a/lib/composer/include_paths.php b/lib/composer/include_paths.php index af33c1491..d4fb96718 100644 --- a/lib/composer/include_paths.php +++ b/lib/composer/include_paths.php @@ -2,7 +2,7 @@ // include_paths.php @generated by Composer -$vendorDir = dirname(__DIR__); +$vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( diff --git a/pages/ajax.oauth.wizard.php b/pages/ajax.oauth.wizard.php deleted file mode 100644 index 7a753a320..000000000 --- a/pages/ajax.oauth.wizard.php +++ /dev/null @@ -1,13 +0,0 @@ -AllowOnlyAdmin(); -$oUpdateController->SetDefaultOperation('Default'); -$oUpdateController->HandleOperation(); diff --git a/pages/ajax.render.php b/pages/ajax.render.php index e9ea8eda8..72d2f942e 100644 --- a/pages/ajax.render.php +++ b/pages/ajax.render.php @@ -562,7 +562,7 @@ try if (!$oAttDef->IsWritable() || ($oWizardHelper->GetReturnNotEditableFields())) { // Even non-writable fields (like AttributeExternal) can be refreshed - $sHTMLValue = $oObj->GetAsHTML($sAttCode); + $sHTMLValue = "
".$oObj->GetAsHTML($sAttCode)."
"; } else { diff --git a/pages/oauth.wizard.php b/pages/oauth.wizard.php deleted file mode 100644 index 507e6a401..000000000 --- a/pages/oauth.wizard.php +++ /dev/null @@ -1,14 +0,0 @@ -AllowOnlyAdmin(); -$oUpdateController->SetDefaultOperation('Wizard'); -$oUpdateController->HandleOperation(); - diff --git a/setup/email.test.php b/setup/email.test.php index 9184b26b7..8fe476987 100644 --- a/setup/email.test.php +++ b/setup/email.test.php @@ -20,6 +20,9 @@ /** * Wizard to configure and initialize the iTop application */ + +use Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProviderFactory; + require_once('../approot.inc.php'); require_once(APPROOT.'/application/utils.inc.php'); require_once(APPROOT.'/core/email.class.inc.php'); @@ -133,13 +136,20 @@ function CheckEmailSetting($oP) $sDisplayEncryption = empty($sEncryption) ? 'no encryption ' : $sEncryption; $sUserName = MetaModel::GetConfig()->Get('email_transport_smtp.username'); $sDisplayUserName = empty($sUserName) ? 'no user ' : $sUserName; - $sProvider = MetaModel::GetConfig()->Get('email_transport_smtp.oauth.provider'); - $sDisplayProvider = empty($sProvider) ? 'no Provider ' : $sProvider; - $sClientID = MetaModel::GetConfig()->Get('email_transport_smtp.oauth.client_id'); - $sDisplayClientID = empty($sClientID) ? 'no password ' : $sClientID; - $oP->info("SMTP configuration (from config-itop.php): host: $sHost, port: $sPort, provider: $sDisplayProvider, user: $sDisplayUserName, client id: $sDisplayClientID, encryption: $sDisplayEncryption."); - if (($sHost == 'localhost') && ($sPort == '25') && ($sUserName == '') && ($sClientID == '') && ($sProvider == '')) { - $oP->warning("The default settings may not be suitable for your environment. You may want to adjust these values by editing iTop's configuration file (".utils::GetConfigFilePathRelative().').'); + try { + $oRemoteAuthentOAuth = OAuthClientProviderFactory::GetOAuthClientForSMTP(); + $sLink = MetaModel::GetHyperLink(get_class($oRemoteAuthentOAuth), $oRemoteAuthentOAuth->GetKey()); + $oP->info("The connection used is: $sLink"); + $sProvider = $oRemoteAuthentOAuth->Get('provider'); + $sDisplayProvider = empty($sProvider) ? 'no Provider ' : $sProvider; + $sClientID = $oRemoteAuthentOAuth->Get('client_id'); + $oP->info("SMTP configuration (from config-itop.php): host: $sHost, port: $sPort, provider: $sDisplayProvider, user: $sDisplayUserName, encryption: $sDisplayEncryption."); + if (($sHost == 'localhost') && ($sPort == '25') && ($sUserName == '') && ($sClientID == '') && ($sProvider == '')) { + $oP->warning("The default settings may not be suitable for your environment. You may want to adjust these values by editing iTop's configuration file (".utils::GetConfigFilePathRelative().').'); + } + } catch (CoreException $e) { + $bRet = false; + $oP->error($e->getMessage()); } break; @@ -194,9 +204,10 @@ function DisplayStep1(SetupPage $oP) 'input' => "", 'help' => ' email address (e.g. john.foo@worldcompany.com)', ); + $sDefaultFrom = MetaModel::GetConfig()->Get('email_transport_smtp.username'); $aForm[] = array( 'label' => "From:", - 'input' => "", + 'input' => "", 'help' => ' defaults to the configuration param "email_default_sender_address" or "To" field.', ); $oP->form($aForm); @@ -298,4 +309,4 @@ catch(CoreException $e) $oP->error("Error: '".$e->getHtmlDesc()."'"); } $oP->output(); -?> + diff --git a/sources/Controller/OAuth/OAuthAjaxController.php b/sources/Controller/OAuth/OAuthAjaxController.php deleted file mode 100644 index 155cdd9bc..000000000 --- a/sources/Controller/OAuth/OAuthAjaxController.php +++ /dev/null @@ -1,62 +0,0 @@ - 'success', 'data' => []]; - $sProvider = utils::ReadParam('provider', '', false, 'raw'); - $sClientId = utils::ReadParam('client_id', '', false, 'raw'); - $sClientSecret = utils::ReadParam('client_secret', '', false, 'raw'); - $sScope = utils::ReadParam('scope', '', false, 'raw'); - $sAdditional = utils::ReadParam('additional', '', false, 'raw'); - $aAdditional = []; - parse_str($sAdditional, $aAdditional); - $sAuthorizationUrl = OAuthClientProviderFactory::getVendorProviderForAccessUrl($sProvider, $sClientId, $sClientSecret, $sScope, $aAdditional); - $aResult['data']['authorization_url'] = $sAuthorizationUrl; - - $this->DisplayJSONPage($aResult); - } - - public function OperationGetDisplayAuthenticationResults() - { - $aResult = ['status' => 'success', 'data' => []]; - $sProvider = utils::ReadParam('provider', '', false, 'raw'); - $sRedirectUrl = utils::ReadParam('redirect_url', '', false, 'raw'); - $sClientId = utils::ReadParam('client_id', '', false, 'raw'); - $sClientSecret = utils::ReadParam('client_secret', '', false, 'raw'); - $sScope = utils::ReadParam('scope', '', false, 'raw'); - $sAdditional = utils::ReadParam('additional', '', false, 'raw'); - - $sRedirectUrlQuery = parse_url($sRedirectUrl)['query']; - - $aOAuthResultDisplayClasses[] = '\Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientResultDisplayConf'; - if (class_exists('Combodo\iTop\Extension\Service\OAuthClientResultDisplayMailbox')) { - $aOAuthResultDisplayClasses[] = 'Combodo\iTop\Extension\Service\OAuthClientResultDisplayMailbox'; - } - - $aAdditional = []; - parse_str($sAdditional, $aAdditional); - - // $sProviderClass = "\Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProvider".$sProvider; - // $sRedirectUrl = OAuthClientProviderAbstract::GetRedirectUri(); - - $aQuery = []; - parse_str($sRedirectUrlQuery, $aQuery); - $sCode = $aQuery['code']; - $oProvider = OAuthClientProviderFactory::getVendorProvider($sProvider, $sClientId, $sClientSecret, $sScope, $aAdditional); - $oAccessToken = OAuthClientProviderFactory::getAccessTokenFromCode($oProvider, $sCode); - - foreach ($aOAuthResultDisplayClasses as $sOAuthClass) { - $aResult['data'][] = $sOAuthClass::GetResultDisplayScript($sClientId, $sClientSecret, $sProvider, $oAccessToken); - } - - $this->DisplayJSONPage($aResult); - } -} \ No newline at end of file diff --git a/sources/Controller/OAuth/OAuthWizardController.php b/sources/Controller/OAuth/OAuthWizardController.php deleted file mode 100644 index 25265ea6b..000000000 --- a/sources/Controller/OAuth/OAuthWizardController.php +++ /dev/null @@ -1,68 +0,0 @@ -AddLinkedScript(utils::GetAbsoluteUrlAppRoot().'/js/pages/backoffice/oauth.wizard.js'); - - $aOAuthClasses = [ - 'Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProviderAzure', - 'Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProviderGoogle', - ]; - - foreach ($aOAuthClasses as $sOAuthClass) { - $aParams['aProviders'][] = [ - 'name' => $sOAuthClass::GetVendorName(), - 'icon' => $sOAuthClass::GetVendorIcon(), - 'colors' => $sOAuthClass::GetVendorColors(), - ]; - } - - $aParams['aInputs'] = [ - 'client_id' => ['type' => 'text', 'label' => Dict::S('UI:OAuth:Wizard:Form:Input:ClientId:Label'), 'read_only' => false, 'value' => ''], - 'client_secret' => ['type' => 'text', 'label' => Dict::S('UI:OAuth:Wizard:Form:Input:ClientSecret:Label'), 'read_only' => false, 'value' => ''], - 'scope' => ['type' => 'text', 'label' => Dict::S('UI:OAuth:Wizard:Form:Input:Scope:Label'), 'read_only' => false, 'value' => ''], - 'additional' => ['type' => 'text', 'label' => Dict::S('UI:OAuth:Wizard:Form:Input:Additional:Label'), 'read_only' => false, 'value' => ''], - 'redirect_uri' => ['type' => 'text', 'label' => Dict::S('UI:OAuth:Wizard:Form:Input:RedirectUri:Label'), 'read_only' => true, 'value' => OAuthClientProviderAbstract::GetRedirectUri()], - ]; - - // TODO: Needs to handle mail to ticket part too - $aParams['aAdditionalBlocks'][] = OAuthClientResultDisplayConf::GetResultDisplayTemplate(); - if (class_exists('Combodo\iTop\Extension\Service\OAuthClientResultDisplayMailbox')) { - $aParams['aAdditionalBlocks'][] = OAuthClientResultDisplayMailbox::GetResultDisplayTemplate(); - } - - $this->DisplayPage($aParams); - } -} \ No newline at end of file diff --git a/sources/Core/Authentication/Client/OAuth/IOAuthClientResultDisplay.php b/sources/Core/Authentication/Client/OAuth/IOAuthClientResultDisplay.php deleted file mode 100644 index e5111f38e..000000000 --- a/sources/Core/Authentication/Client/OAuth/IOAuthClientResultDisplay.php +++ /dev/null @@ -1,11 +0,0 @@ -oOauthClient = $oOauthClient; + } /** * @return \League\OAuth2\Client\Provider\GenericProvider @@ -47,7 +50,7 @@ abstract class OAuthClientProviderAbstract implements IOAuthClientProvider */ public function GetAccessToken(): AccessToken { - return $this->oAccessToken; + return $this->oOauthClient->GetAccessToken(); } /** @@ -55,93 +58,7 @@ abstract class OAuthClientProviderAbstract implements IOAuthClientProvider */ public function SetAccessToken(AccessToken $oAccessToken) { - $this->oAccessToken = $oAccessToken; - } - - /** - * @return string - */ - public static function GetVendorIcon(): string - { - return static::$sVendorIcon; - } - - /** - * @return string - */ - public static function GetVendorName(): string - { - return static::$sVendorName; - } - - - public static function getConfFromAccessToken($oAccessToken, $sClientId, $sClientSecret): string - { - $sAccessToken = $oAccessToken->getToken(); - $sRefreshToken = $oAccessToken->getRefreshToken(); - $sVendor = static::GetVendorName(); - - return << 'SMTP_OAuth', -'email_transport_smtp.oauth.provider' => '$sVendor', -'email_transport_smtp.oauth.client_id' => '$sClientId', -'email_transport_smtp.oauth.client_secret' => '$sClientSecret', -'email_transport_smtp.oauth.access_token' => '$sAccessToken', -'email_transport_smtp.oauth.refresh_token' => '$sRefreshToken', -EOF; - } - - /** - * @return array - */ - public static function GetVendorColors(): array - { - return static::$sVendorColors; - } - - /** - * @return void - * @throws \Exception - */ - public static function InitizalizeRedirectUri() - { - static::$sRedirectUri = utils::GetAbsoluteUrlAppRoot().'pages/oauth.landing.php'; - } - - /** - * @return string - */ - public static function GetRedirectUri(): string - { - if (static::$sRedirectUri === '') { - static::InitizalizeRedirectUri(); - } - - return static::$sRedirectUri; - } - - /** - * @return string - */ - public static function GetRequiredSMTPScope(): string - { - return static::$sRequiredSMTPScope; - } - - /** - * @return string - */ - public static function GetRequiredIMAPScope(): string - { - return static::$sRequiredIMAPScope; - } - - /** - * @return string - */ - public static function GetRequiredPOPScope(): string - { - return static::$sRequiredPOPScope; + $this->oOauthClient->SetAccessToken($oAccessToken); } /** @@ -149,15 +66,7 @@ EOF; */ public function GetScope() { - return $this->sScope; - } - - /** - * @param mixed $sScope - */ - public function SetScope($sScope) - { - $this->sScope = $sScope; + return $this->oOauthClient->GetScope(); } } \ No newline at end of file diff --git a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderAzure.php b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderAzure.php index cbf298377..e3c594101 100644 --- a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderAzure.php +++ b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderAzure.php @@ -2,45 +2,34 @@ namespace Combodo\iTop\Core\Authentication\Client\OAuth; -use League\OAuth2\Client\Token\AccessToken; use TheNetworg\OAuth2\Client\Provider\Azure; class OAuthClientProviderAzure extends OAuthClientProviderAbstract { - /** @var string */ - static protected $sVendorName = 'Azure'; - /** @var array */ - static protected $sVendorColors = ['#0766b7', '#0d396b', '#2893df', '#3ccbf4']; - /** @var string */ - static protected $sVendorIcon = '../images/icons/icons8-azure.svg'; - static protected $sRequiredSMTPScope = 'https://outlook.office.com/SMTP.Send offline_access'; - static protected $sRequiredIMAPScope = 'https://outlook.office.com/IMAP.AccessAsUser.All offline_access'; - static protected $sRequiredPOPScope = 'https://outlook.office.com/POP.AccessAsUser.All offline access'; - /** @var \League\OAuth2\Client\Provider\GenericProvider */ - protected $oVendorProvider; - /** @var \League\OAuth2\Client\Token\AccessToken */ - protected $oAccessToken; +// /** @var string */ +// static protected $sVendorName = 'Azure'; +// /** @var array */ +// static protected $sVendorColors = ['#0766b7', '#0d396b', '#2893df', '#3ccbf4']; +// /** @var string */ +// static protected $sVendorIcon = '../images/icons/icons8-azure.svg'; +// static protected $sRequiredSMTPScope = 'https://outlook.office.com/SMTP.Send offline_access'; +// static protected $sRequiredIMAPScope = 'https://outlook.office.com/IMAP.AccessAsUser.All offline_access'; +// static protected $sRequiredPOPScope = 'https://outlook.office.com/POP.AccessAsUser.All offline access'; - public function __construct($aVendorProvider, array $collaborators = [], array $aAccessTokenParams = []) + + public function __construct($oOAuthClient, array $collaborators = []) { - $this->oVendorProvider = new Azure(array_merge([ + parent::__construct($oOAuthClient); + + $aOptions = [ 'prompt' => 'consent', 'scope' => 'offline_access', 'defaultEndPointVersion' => Azure::ENDPOINT_VERSION_2_0, - ], - $aVendorProvider), $collaborators); + 'clientId' => $oOAuthClient->Get('client_id'), + 'clientSecret' => $oOAuthClient->Get('client_secret'), + 'redirectUri' => $oOAuthClient->Get('redirect_url'), + ]; - if (!empty($aAccessTokenParams)) { - $this->oAccessToken = new AccessToken([ - "access_token" => $aAccessTokenParams["access_token"], - "expires_in" => -1, - "refresh_token" => $aAccessTokenParams["refresh_token"], - "token_type" => "Bearer", - ]); - } - - if (isset($aVendorProvider['scope'])) { - $this->SetScope($aVendorProvider['scope']); - } + $this->oVendorProvider = new Azure($aOptions, $collaborators); } } \ No newline at end of file diff --git a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderFactory.php b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderFactory.php index d484b26ba..58445c3b7 100644 --- a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderFactory.php +++ b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderFactory.php @@ -3,10 +3,15 @@ namespace Combodo\iTop\Core\Authentication\Client\OAuth; use CoreException; +use DBObject; +use DBObjectSet; +use DBSearch; use Dict; use GuzzleHttp\Client; use League\OAuth2\Client\Token\AccessTokenInterface; use MetaModel; +use OAuthClient; +use utils; class OAuthClientProviderFactory { @@ -14,98 +19,110 @@ class OAuthClientProviderFactory * @return mixed * @throws \CoreException */ - public static function getProviderForSMTP() + public static function GetProviderForSMTP() { - $sProviderVendor = MetaModel::GetConfig()->Get('email_transport_smtp.oauth.provider'); // email_transport_smtp.oauth.provider - $sProviderClass = self::getProviderClass($sProviderVendor); - $aProviderVendorParams = [ - 'clientId' => MetaModel::GetConfig()->Get('email_transport_smtp.oauth.client_id'), // email_transport_smtp.oauth.client_id - 'clientSecret' => MetaModel::GetConfig()->Get('email_transport_smtp.oauth.client_secret'),// email_transport_smtp.oauth.client_secret - 'redirectUri' => $sProviderClass::GetRedirectUri(), - 'scope' => $sProviderClass::GetRequiredSMTPScope(), - ]; - $aAccessTokenParams = [ - "access_token" => MetaModel::GetConfig()->Get('email_transport_smtp.oauth.access_token'), // email_transport_smtp.oauth.access_token - "refresh_token" => MetaModel::GetConfig()->Get('email_transport_smtp.oauth.refresh_token'), // email_transport_smtp.oauth.refresh_token - 'scope' => $sProviderClass::GetRequiredSMTPScope(), - ]; - $aCollaborators = [ - 'httpClient' => new Client(['verify' => false]), - ]; + $oOAuthClient = self::GetOAuthClientForSMTP(); - return new $sProviderClass($aProviderVendorParams, $aCollaborators, $aAccessTokenParams); + return self::GetClientProvider($oOAuthClient); } /** - * @param $sProviderVendor - * @param $sClientId - * @param $sClientSecret - * @param $sScope - * @param $aAdditional - * - * @return mixed + * @return \DBObject|null * @throws \CoreException + * @throws \CoreUnexpectedValue + * @throws \MissingQueryArgument + * @throws \MySQLException + * @throws \MySQLHasGoneAwayException + * @throws \OQLException */ - public static function getVendorProvider($sProviderVendor, $sClientId, $sClientSecret, $sScope, $aAdditional) + public static function GetOAuthClientForSMTP() { - $sRedirectUrl = OAuthClientProviderAbstract::GetRedirectUri(); - $sProviderClass = self::getProviderClass($sProviderVendor); - $aCollaborators = [ - 'httpClient' => new Client(['verify' => false]), - ]; - - return new $sProviderClass(array_merge(['clientId' => $sClientId, 'clientSecret' => $sClientSecret, 'redirectUri' => $sRedirectUrl, 'scope' => $sScope], $aAdditional), $aCollaborators); + $sUsername = MetaModel::GetConfig()->Get('email_transport_smtp.username'); + $oSet = new DBObjectSet(DBSearch::FromOQL("SELECT OAuthClient WHERE name=:username", ['username' => $sUsername])); + if ($oSet->Count() < 1) { + throw new CoreException(Dict::Format('itop-oauth-client:MissingOAuthClient', $sUsername)); + } + while ($oOAuthClient = $oSet->Fetch()) { + $sScope = $oOAuthClient->Get('scope'); + if ($sScope == 'EMail') { + return $oOAuthClient; + } + } + throw new CoreException(Dict::Format('itop-oauth-client:MissingOAuthClient', $sUsername)); } - public static function getVendorProviderForAccessUrl($sProviderVendor, $sClientId, $sClientSecret, $sScope, $aAdditional) + /** + * @param \OAuthClient $oOAuthClient + * + * @return mixed + * @throws \ArchivedObjectException + * @throws \CoreException + */ + public static function GetAuthorizationUrl(OAuthClient $oOAuthClient) { - $oProvider = static::getVendorProvider($sProviderVendor, $sClientId, $sClientSecret, $sScope, $aAdditional); - + $oProvider = self::GetClientProvider($oOAuthClient); return $oProvider->GetVendorProvider()->getAuthorizationUrl([ 'scope' => [ - $sScope, + $oProvider->GetScope(), ], ]); } /** - * @param \Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProviderAbstract $oProvider + * @param \OAuthClient $oOAuthClient * @param $sCode * * @return AccessTokenInterface - * @throws \League\OAuth2\Client\Provider\Exception\IdentityProviderException + * @throws \ArchivedObjectException + * @throws \CoreException */ - public static function getAccessTokenFromCode($oProvider, $sCode) + public static function GetAccessTokenFromCode(OAuthClient $oOAuthClient, $sCode) { + $oProvider = self::GetClientProvider($oOAuthClient); return $oProvider->GetVendorProvider()->getAccessToken('authorization_code', ['code' => $sCode, 'scope' => $oProvider->GetScope()]); } - public static function getConfFromRedirectUrl($sProviderVendor, $sClientId, $sClientSecret, $sRedirectUrlQuery) - { - $sRedirectUrl = OAuthClientProviderAbstract::GetRedirectUri(); - $sProviderClass = self::getProviderClass($sProviderVendor); - $aQuery = []; - parse_str($sRedirectUrlQuery, $aQuery); - $sCode = $aQuery['code']; - $oProvider = new $sProviderClass(['clientId' => $sClientId, 'clientSecret' => $sClientSecret, 'redirectUri' => $sRedirectUrl]); - - return $sProviderClass::getConfFromAccessToken($oProvider->GetVendorProvider()->getAccessToken('authorization_code', ['code' => $sCode]), $sClientId, $sClientSecret); - } - /** * @param $sProviderVendor * * @return string * @throws \CoreException */ - public static function getProviderClass($sProviderVendor): string + protected static function GetProviderClass($sProviderVendor): string { $sProviderClass = "\Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProvider".$sProviderVendor; if (!class_exists($sProviderClass)) { - throw new CoreException(dict::Format('UI:Error:SMTP:UnknownVendor', $sProviderVendor)); + throw new CoreException(Dict::Format('UI:Error:SMTP:UnknownVendor', $sProviderVendor)); } return $sProviderClass; } + /** + * @return string + * @throws \Exception + */ + public static function GetRedirectUri(): string + { + return utils::GetAbsoluteUrlAppRoot().'pages/oauth.landing.php'; + } + + /** + * @param \DBObject $oOAuthClient + * + * @return mixed + * @throws \ArchivedObjectException + * @throws \CoreException + */ + public static function GetClientProvider(DBObject $oOAuthClient) + { + $sProviderVendor = $oOAuthClient->Get('provider'); + $sProviderClass = self::GetProviderClass($sProviderVendor); + $aCollaborators = [ + 'httpClient' => new Client(['verify' => false]), + ]; + + return new $sProviderClass($oOAuthClient, $aCollaborators); + } + } \ No newline at end of file diff --git a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderGoogle.php b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderGoogle.php index bd2a1e3b6..35ddafca8 100644 --- a/sources/Core/Authentication/Client/OAuth/OAuthClientProviderGoogle.php +++ b/sources/Core/Authentication/Client/OAuth/OAuthClientProviderGoogle.php @@ -3,39 +3,33 @@ namespace Combodo\iTop\Core\Authentication\Client\OAuth; use League\OAuth2\Client\Provider\Google; -use League\OAuth2\Client\Token\AccessToken; class OAuthClientProviderGoogle extends OAuthClientProviderAbstract { - /** @var string */ - static protected $sVendorName = 'Google'; - /** @var array */ - static protected $sVendorColors = ['#DB4437', '#F4B400', '#0F9D58', '#4285F4']; - /** @var string */ - static protected $sVendorIcon = '../images/icons/icons8-google.svg'; - /** @var \League\OAuth2\Client\Provider\GenericProvider */ - protected $oVendorProvider; - /** @var \League\OAuth2\Client\Token\AccessToken */ - protected $oAccessToken; - static protected $sRequiredSMTPScope = 'https://mail.google.com/'; - static protected $sRequiredIMAPScope = 'https://mail.google.com/'; - static protected $sRequiredPOPScope = 'https://mail.google.com/'; +// /** @var string */ +// static protected $sVendorName = 'Google'; +// /** @var array */ +// static protected $sVendorColors = ['#DB4437', '#F4B400', '#0F9D58', '#4285F4']; +// /** @var string */ +// static protected $sVendorIcon = '../images/icons/icons8-google.svg'; +// +// static protected $sRequiredSMTPScope = 'https://mail.google.com/'; +// static protected $sRequiredIMAPScope = 'https://mail.google.com/'; +// static protected $sRequiredPOPScope = 'https://mail.google.com/'; - public function __construct($aVendorProvider, array $collaborators = [], array $aAccessTokenParams = []) + public function __construct($oOAuthClient, array $collaborators = []) { - $this->oVendorProvider = new Google(array_merge(['prompt' => 'consent', 'accessType' => 'offline'], $aVendorProvider), $collaborators); + parent::__construct($oOAuthClient); + $aOptions = [ + 'prompt' => 'consent', + 'accessType' => 'offline', + 'clientId' => $oOAuthClient->Get('client_id'), + 'clientSecret' => $oOAuthClient->Get('client_secret'), + 'redirectUri' => $oOAuthClient->Get('redirect_url'), + 'scope' => $oOAuthClient->GetScope(), - if (!empty($aAccessTokenParams)) { - $this->oAccessToken = new AccessToken([ - "access_token" => $aAccessTokenParams["access_token"], - "expires_in" => -1, - "refresh_token" => $aAccessTokenParams["refresh_token"], - "token_type" => "Bearer", - ]); - } + ]; + $this->oVendorProvider = new Google($aOptions, $collaborators); - if (isset($aVendorProvider['scope'])) { - $this->SetScope($aVendorProvider['scope']); - } } } \ No newline at end of file diff --git a/sources/Core/Authentication/Client/OAuth/OAuthClientResultDisplayConf.php b/sources/Core/Authentication/Client/OAuth/OAuthClientResultDisplayConf.php deleted file mode 100644 index a2e3c6507..000000000 --- a/sources/Core/Authentication/Client/OAuth/OAuthClientResultDisplayConf.php +++ /dev/null @@ -1,45 +0,0 @@ -AddCSSClass('ibo-oauth-wizard--result--panel'); - $oConfResultPanel->SetIsCollapsible(true); - $oConfResultPanel->AddHtml('

'.Dict::S('UI:OAuth:Wizard:ResultConf:Panel:Description').'

'); - $oConfResultPanel->AddHtml('
'); - return $oConfResultPanel; - } - - public static function GetResultDisplayScript($sClientId, $sClientSecret, $sVendor, AccessToken $oAccessToken) - { - $sAccessToken = $oAccessToken->getToken(); - $sRefreshToken = $oAccessToken->getRefreshToken(); - $sConf = << 'SMTP_OAuth', -'email_transport_smtp.oauth.provider' => '$sVendor', -'email_transport_smtp.oauth.client_id' => '$sClientId', -'email_transport_smtp.oauth.client_secret' => '$sClientSecret', -'email_transport_smtp.oauth.access_token' => '$sAccessToken', -'email_transport_smtp.oauth.refresh_token' => '$sRefreshToken', -EOF; - $sConf = json_encode($sConf); - - return <<getMessage(), static::LOG_CHANNEL); return false; } diff --git a/sources/Core/Email/EmailLaminas.php b/sources/Core/Email/EmailLaminas.php index 3c2a48d6e..53031d383 100644 --- a/sources/Core/Email/EmailLaminas.php +++ b/sources/Core/Email/EmailLaminas.php @@ -189,6 +189,7 @@ class EMailLaminas extends Email $oOptions = new SmtpOptions($aOptions); $oTransport->setOptions($oOptions); break; + case 'SMTP_OAuth': $sHost = self::$m_oConfig->Get('email_transport_smtp.host'); $sPort = self::$m_oConfig->Get('email_transport_smtp.port'); @@ -210,8 +211,9 @@ class EMailLaminas extends Email $oOptions = new SmtpOptions($aOptions); $oTransport->setOptions($oOptions); - \Laminas\Mail\Protocol\Smtp\Auth\Oauth::setProvider(OAuthClientProviderFactory::getProviderForSMTP()); + \Laminas\Mail\Protocol\Smtp\Auth\Oauth::setProvider(OAuthClientProviderFactory::GetProviderForSMTP()); break; + case 'Null': $oTransport = new Smtp(); break; diff --git a/templates/pages/backoffice/oauth/DisplayConfig.html.twig b/templates/pages/backoffice/oauth/DisplayConfig.html.twig deleted file mode 100644 index 1fcf8b8b3..000000000 --- a/templates/pages/backoffice/oauth/DisplayConfig.html.twig +++ /dev/null @@ -1,8 +0,0 @@ -{# @copyright Copyright (C) 2010-2022 Combodo SARL #} -{# @license http://opensource.org/licenses/AGPL-3.0 #} - -
- {{ 'UI:OAuth:Wizard:ResultConf:Panel:Title'|dict_s }} -

{{ 'UI:OAuth:Wizard:ResultConf:Panel:Description'|dict_s }}

-
-
\ No newline at end of file diff --git a/templates/pages/backoffice/oauth/Wizard.html.twig b/templates/pages/backoffice/oauth/Wizard.html.twig deleted file mode 100644 index 0aee723b3..000000000 --- a/templates/pages/backoffice/oauth/Wizard.html.twig +++ /dev/null @@ -1,53 +0,0 @@ -{# @copyright Copyright (C) 2010-2022 Combodo SARL #} -{# @license http://opensource.org/licenses/AGPL-3.0 #} - -
-

{{ 'UI:OAuth:Wizard:Page:Title'|dict_s }}

- -
- -
-
- {% set sIsChecked = 'checked' %} - {% for aSelect in aProviders %} - - - - {% set sIsChecked = '' %} - {% endfor %} -
-
- -
- {{ 'UI:OAuth:Wizard:Form:Panel:Title'|dict_s }} -
- - {% for sName, aInput in aInputs %} -
-
-
-
- -
-
-
- {% endfor %} - -
-
-
- - {% for sTemplate in aAdditionalBlocks %} - {% include sTemplate %} - {% endfor %} - -
\ No newline at end of file diff --git a/templates/pages/backoffice/oauth/Wizard.ready.js.twig b/templates/pages/backoffice/oauth/Wizard.ready.js.twig deleted file mode 100644 index 8cc297840..000000000 --- a/templates/pages/backoffice/oauth/Wizard.ready.js.twig +++ /dev/null @@ -1,131 +0,0 @@ -// Function used to open OAuth popup -var oWindowObjectReference = null; -var sPreviousUrl = null; -var oListener = null - -const oOnOauthSuccess = function (event){ - clearInterval(oListener); - $.post( - '{{ sAjaxUri }}', - { - operation: 'GetDisplayAuthenticationResults', - provider: $('[name="provider"]:checked').val(), - client_id: $('[name="client_id"]').val(), - client_secret: $('[name="client_secret"]').val(), - scope: $(this).find('[name="scope"]').val(), - additional: $(this).find('[name="additional"]').val(), - redirect_url: event.data - }, - function(oData){ - if(oData.status == 'success') - { - oData.data.forEach(function(item, index){ - new Function(item)(); - }); - } - $('.ibo-oauth-wizard--form--submit').prop('disabled', false); - } - ); -} -const oOpenSignInWindow = function (url, name){ - // Remove any existing event listener - window.removeEventListener('message', oOnOauthSuccess); - if(oListener !== null){ - clearInterval(oListener); - } - - // Window features - const sWindowFeatures = 'toolbar=no, menubar=no, width=600, height=700, top=100, left=100'; - - if (oWindowObjectReference === null || oWindowObjectReference.closed) { - /* If the pointer to the window object in memory does not exist - or if such pointer exists but the window was closed */ - oWindowObjectReference = window.open(url, name, sWindowFeatures); - } else if (sPreviousUrl !== url) { - /* If the resource to load is different, - then we load it in the already opened secondary window, and then - we bring such window back on top/in front of its parent window. */ - oWindowObjectReference = window.open(url, name, sWindowFeatures); - oWindowObjectReference.focus(); - } else { - /* Else the window reference must exist and the window - is not closed; therefore, we can bring it back on top of any other - window with the focus() method. There would be no need to re-create - the window or to reload the referenced resource. */ - oWindowObjectReference.focus(); - } - /* Let know every second our child window that we're waiting for it to complete, - once we reach our landing page, it'll send us a reply - */ - oListener = window.setInterval(function(){ - if (oWindowObjectReference.closed) { - $('.ibo-oauth-wizard--form--submit').prop('disabled', false); - clearInterval(oListener); - } - oWindowObjectReference.postMessage('anyone', '{{ sReturnUri }}'); - }, 1000); - /* Once we receive a response, transmit it to the server to get authenticate and display - results - */ - window.addEventListener('message', oOnOauthSuccess, false); - // Assign the previous URL - sPreviousUrl = url; -}; - -// Function used when the form is submitted - -const oOnFormSubmit = function(){ - $('.ibo-oauth-wizard--form--submit').prop('disabled', true); - $.post( - '{{ sAjaxUri }}', - { - operation: 'GetAuthorizationUrl', - provider: $('[name="provider"]:checked').val(), - client_id: $(this).find('[name="client_id"]').val(), - client_secret: $(this).find('[name="client_secret"]').val(), - scope: $(this).find('[name="scope"]').val(), - additional: $(this).find('[name="additional"]').val() - }, - function(oData){ - if(oData.status == 'success') - { - oOpenSignInWindow(oData.data.authorization_url, 'OAuth authorization') - } - else{ - $('.ibo-oauth-wizard--form--submit').prop('disabled', false); - } - } - ); - return false; -} - -// Function used to update provider image - -function oUpdateProviderImage(elem){ - - var oColor1 = $(elem).prev('[name="provider"]').attr('data-color1'); - var oColor2 = $(elem).prev('[name="provider"]').attr('data-color2'); - var oColor4 = $(elem).prev('[name="provider"]').attr('data-color3'); - var oColor3 = $(elem).prev('[name="provider"]').attr('data-color4'); - - $('#fcef55fc-4968-45b2-93bb-1a1080c85fc7').attr('fill', oColor1); - $('#e8fa0310-b872-4adf-aedd-0c6eda09f3b8').attr('fill', oColor1); - $('#a4813fcf-056e-4514-bb8b-e6506f49341f').attr('fill', oColor1); - $('#e73810fe-4cf4-40cc-8c7c-ca544ce30bd4-108').attr('fill', oColor2); - $('#e12ee00d-aa4a-4413-a013-11d20b7f97f7').attr('fill', oColor2); - $('#b4d4939a-c6e6-4f4d-ba6c-e8b05485017d').attr('fill', oColor2); - $('#b06d66ec-6c84-45dd-8c27-1263a6253192-107').attr('fill', oColor3); - $('#f58f497e-6949-45c8-be5f-eee2aa0f6586').attr('fill', oColor3); - $('#aff120b1-519b-4e96-ac87-836aa55663de').attr('fill', oColor3); - $('#ae7af94f-88d7-4204-9f07-e3651de85c05-111').attr('fill', oColor4); - $('#a6768b0e-63d0-4b31-8462-9b2e0b00f0fd-112').attr('fill', oColor4); -} -$('body').on('click', '.ui-checkboxradio-radio-label', function(){ - oUpdateProviderImage(this) -}) -oUpdateProviderImage($('[name="provider"]:checked').next()); - -// Initialize provider buttons -$('#select_layout').buttonset(); - -$('.ibo-oauth-wizard--form').on('submit', oOnFormSubmit);