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

This commit is contained in:
Eric Espie
2022-06-22 16:37:31 +02:00
parent ba59643f52
commit 9f60f27636
66 changed files with 1513 additions and 1228 deletions

View File

@@ -0,0 +1,2 @@
# Extension OAuth 2.0 client

View File

@@ -0,0 +1,24 @@
<?php
/**
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\OAuthClient;
use Combodo\iTop\OAuthClient\Controller\AjaxOauthClientController;
require_once(APPROOT.'application/startup.inc.php');
if (version_compare(ITOP_DESIGN_LATEST_VERSION , '3.0') >= 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();

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48px" height="48px"><linearGradient id="k8yl7~hDat~FaoWq8WjN6a" x1="-1254.397" x2="-1261.911" y1="877.268" y2="899.466" gradientTransform="translate(1981.75 -1362.063) scale(1.5625)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#114a8b"/><stop offset="1" stop-color="#0669bc"/></linearGradient><path fill="url(#k8yl7~hDat~FaoWq8WjN6a)" d="M17.634,6h11.305L17.203,40.773c-0.247,0.733-0.934,1.226-1.708,1.226H6.697 c-0.994,0-1.8-0.806-1.8-1.8c0-0.196,0.032-0.39,0.094-0.576L15.926,7.227C16.173,6.494,16.86,6,17.634,6L17.634,6z"/><path fill="#0078d4" d="M34.062,29.324H16.135c-0.458-0.001-0.83,0.371-0.831,0.829c0,0.231,0.095,0.451,0.264,0.608 l11.52,10.752C27.423,41.826,27.865,42,28.324,42h10.151L34.062,29.324z"/><linearGradient id="k8yl7~hDat~FaoWq8WjN6b" x1="-1252.05" x2="-1253.788" y1="887.612" y2="888.2" gradientTransform="translate(1981.75 -1362.063) scale(1.5625)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-opacity=".3"/><stop offset=".071" stop-opacity=".2"/><stop offset=".321" stop-opacity=".1"/><stop offset=".623" stop-opacity=".05"/><stop offset="1" stop-opacity="0"/></linearGradient><path fill="url(#k8yl7~hDat~FaoWq8WjN6b)" d="M17.634,6c-0.783-0.003-1.476,0.504-1.712,1.25L5.005,39.595 c-0.335,0.934,0.151,1.964,1.085,2.299C6.286,41.964,6.493,42,6.702,42h9.026c0.684-0.122,1.25-0.603,1.481-1.259l2.177-6.416 l7.776,7.253c0.326,0.27,0.735,0.419,1.158,0.422h10.114l-4.436-12.676l-12.931,0.003L28.98,6H17.634z"/><linearGradient id="k8yl7~hDat~FaoWq8WjN6c" x1="-1252.952" x2="-1244.704" y1="876.6" y2="898.575" gradientTransform="translate(1981.75 -1362.063) scale(1.5625)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#3ccbf4"/><stop offset="1" stop-color="#2892df"/></linearGradient><path fill="url(#k8yl7~hDat~FaoWq8WjN6c)" d="M32.074,7.225C31.827,6.493,31.141,6,30.368,6h-12.6c0.772,0,1.459,0.493,1.705,1.224 l10.935,32.399c0.318,0.942-0.188,1.963-1.13,2.281C29.093,41.968,28.899,42,28.703,42h12.6c0.994,0,1.8-0.806,1.8-1.801 c0-0.196-0.032-0.39-0.095-0.575L32.074,7.225z"/></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" width="48px" height="48px"><path fill="#fbc02d" d="M43.611,20.083H42V20H24v8h11.303c-1.649,4.657-6.08,8-11.303,8c-6.627,0-12-5.373-12-12 s5.373-12,12-12c3.059,0,5.842,1.154,7.961,3.039l5.657-5.657C34.046,6.053,29.268,4,24,4C12.955,4,4,12.955,4,24s8.955,20,20,20 s20-8.955,20-20C44,22.659,43.862,21.35,43.611,20.083z"/><path fill="#e53935" d="M6.306,14.691l6.571,4.819C14.655,15.108,18.961,12,24,12c3.059,0,5.842,1.154,7.961,3.039 l5.657-5.657C34.046,6.053,29.268,4,24,4C16.318,4,9.656,8.337,6.306,14.691z"/><path fill="#4caf50" d="M24,44c5.166,0,9.86-1.977,13.409-5.192l-6.19-5.238C29.211,35.091,26.715,36,24,36 c-5.202,0-9.619-3.317-11.283-7.946l-6.522,5.025C9.505,39.556,16.227,44,24,44z"/><path fill="#1565c0" d="M43.611,20.083L43.595,20L42,20H24v8h11.303c-0.792,2.237-2.231,4.166-4.087,5.571 c0.001-0.001,0.002-0.001,0.003-0.002l6.19,5.238C36.971,39.205,44,34,44,24C44,22.659,43.862,21.35,43.611,20.083z"/></svg>

After

Width:  |  Height:  |  Size: 977 B

View File

@@ -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')
}
}
);
}

View File

@@ -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"
}
}

View File

@@ -0,0 +1,74 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('CS CZ', 'Czech', 'Čeština', [
'Menu:CreateMailbox' => '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:OAuthClientCreated' => 'Generate access tokens 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)~~',
]);

View File

@@ -0,0 +1,74 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('DA DA', 'Danish', 'Dansk', [
'Menu:CreateMailbox' => '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:OAuthClientCreated' => 'Generate access tokens 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)~~',
]);

View File

@@ -0,0 +1,201 @@
<?xml version="1.0" encoding="UTF-8"?>
<itop_design xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.7">
<constants/>
<classes>
<class id="OAuthClient" _delta="define">
<parent>cmdbAbstractObject</parent>
<properties>
<category>cloud,searchable</category>
<abstract>true</abstract>
<key_type>autoincrement</key_type>
<db_table>priv_oauth_client</db_table>
<db_key_field>id</db_key_field>
<db_final_class_field/>
<naming>
<attributes>
<attribute id="provider"/>
<attribute id="name"/>
</attributes>
</naming>
<display_template/>
<icon/>
<reconciliation>
<attributes>
<attribute id="provider"/>
<attribute id="name"/>
</attributes>
</reconciliation>
</properties>
<fields>
<field id="provider" xsi:type="AttributeString">
<sql>provider</sql>
<default_value/>
<is_null_allowed>false</is_null_allowed>
</field>
<field id="name" xsi:type="AttributeString">
<sql>name</sql>
<default_value/>
<is_null_allowed>false</is_null_allowed>
</field>
<field id="description" xsi:type="AttributeText">
<sql>description</sql>
<default_value/>
<is_null_allowed>true</is_null_allowed>
</field>
<field id="client_id" xsi:type="AttributeText">
<sql>client_id</sql>
<default_value/>
<is_null_allowed>false</is_null_allowed>
</field>
<field id="client_secret" xsi:type="AttributeText">
<sql>client_secret</sql>
<default_value/>
<is_null_allowed>false</is_null_allowed>
</field>
<field id="refresh_token" xsi:type="AttributeText">
<sql>refresh_token</sql>
<default_value/>
<is_null_allowed>true</is_null_allowed>
<tracking_level>none</tracking_level>
</field>
<field id="refresh_token_expiration" xsi:type="AttributeDateTime">
<sql>refresh_token_expiration</sql>
<default_value/>
<is_null_allowed>true</is_null_allowed>
<tracking_level>none</tracking_level>
</field>
<field id="token" xsi:type="AttributeText">
<sql>token</sql>
<default_value/>
<is_null_allowed>true</is_null_allowed>
<tracking_level>none</tracking_level>
</field>
<field id="token_expiration" xsi:type="AttributeDateTime">
<sql>token_expiration</sql>
<default_value/>
<is_null_allowed>true</is_null_allowed>
<tracking_level>none</tracking_level>
</field>
<field id="redirect_url" xsi:type="AttributeURL">
<sql>redirect_url</sql>
<default_value/>
<target>_blank</target>
<is_null_allowed>true</is_null_allowed>
</field>
<field id="mailbox_list" xsi:type="AttributeLinkedSet">
<linked_class>MailInboxOAuth</linked_class>
<ext_key_to_me>oauth_client_id</ext_key_to_me>
<count_min>0</count_min>
<count_max>0</count_max>
</field>
</fields>
<methods>
<method id="DisplayBareHeader">
<static>false</static>
<access>public</access>
<type>Overload-DBObject</type>
<code><![CDATA[
public function DisplayBareHeader(WebPage $oPage, $bEditMode = false)
{
parent::DisplayBareHeader($oPage, $bEditMode);
if (!$bEditMode) {
$oConfig = utils::GetConfig();
$sScope = $this->Get('scope');
if (($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("<b>$sLabel</b>&nbsp;<a href='$sTestURL' target='_blank'>$sTestLabel</a>");
}
}
}
]]></code>
</method>
<method id="GetDefaultMailServer">
<static>false</static>
<access>public</access>
<code><![CDATA[
public function GetDefaultMailServer()
{
return 'imap.'.$this->Get('provider').'.com';
}
]]></code>
</method>
<method id="GetDefaultMailServerPort">
<static>false</static>
<access>public</access>
<code><![CDATA[
public function GetDefaultMailServerPort()
{
return 993;
}
]]></code>
</method>
</methods>
<presentation>
<details>
<items>
<item id="name">
<rank>1</rank>
</item>
<item id="description">
<rank>2</rank>
</item>
<item id="provider">
<rank>3</rank>
</item>
<item id="redirect_url">
<rank>5</rank>
</item>
<item id="client_id">
<rank>6</rank>
</item>
<item id="client_secret">
<rank>7</rank>
</item>
<item id="mailbox_list">
<rank>8</rank>
</item>
</items>
</details>
<search>
<items>
<item id="name">
<rank>1</rank>
</item>
<item id="provider">
<rank>2</rank>
</item>
</items>
</search>
<default_search>
<items>
<item id="name">
<rank>1</rank>
</item>
<item id="provider">
<rank>2</rank>
</item>
</items>
</default_search>
</presentation>
</class>
</classes>
<menus>
<menu id="OAuthClient" xsi:type="OQLMenuNode" _delta="define">
<rank>100</rank>
<parent>ConfigurationTools</parent>
<oql><![CDATA[SELECT OAuthClient]]></oql>
<do_search>1</do_search>
<enable_admin_only>0</enable_admin_only>
<enable_class>OAuthClient</enable_class>
<enable_action>UR_ACTION_READ</enable_action>
</menu>
</menus>
<user_rights>
<groups>
</groups>
<profiles>
</profiles>
</user_rights>
</itop_design>

View File

@@ -0,0 +1,74 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('DE DE', 'German', 'Deutsch', [
'Menu:CreateMailbox' => '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:OAuthClientCreated' => 'Generate access tokens 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)~~',
]);

View File

@@ -0,0 +1,74 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('EN US', 'English', 'English', [
'Menu:CreateMailbox' => '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:OAuthClientCreated' => 'Generate access tokens 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: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)',
]);

View File

@@ -0,0 +1,74 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('ES CR', 'Spanish', 'Español, Castellaño', [
'Menu:CreateMailbox' => '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:OAuthClientCreated' => 'Generate access tokens 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)~~',
]);

View File

@@ -0,0 +1,78 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('FR FR', 'French', 'Français', [
'Menu:CreateMailbox' => '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:OAuthClientCreated' => 'Générez les jetons d\'accès avant d\'utiliser cd 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$~',
));

View File

@@ -0,0 +1,74 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('HU HU', 'Hungarian', 'Magyar', [
'Menu:CreateMailbox' => '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:OAuthClientCreated' => 'Generate access tokens 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)~~',
]);

View File

@@ -0,0 +1,24 @@
<?php
/**
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\OAuthClient;
use Combodo\iTop\OAuthClient\Controller\OAuthClientController;
require_once(APPROOT.'application/startup.inc.php');
if (version_compare(ITOP_DESIGN_LATEST_VERSION , '3.0') >= 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();

View File

@@ -0,0 +1,74 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('IT IT', 'Italian', 'Italiano', [
'Menu:CreateMailbox' => '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:OAuthClientCreated' => 'Generate access tokens 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)~~',
]);

View File

@@ -0,0 +1,74 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('JA JP', 'Japanese', '日本語', [
'Menu:CreateMailbox' => '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:OAuthClientCreated' => 'Generate access tokens 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)~~',
]);

View File

@@ -0,0 +1,55 @@
<?php
//
// iTop module definition file
//
SetupWebPage::AddModule(
__FILE__, // Path to the current file, all other file names are relative to the directory containing this file
'itop-oauth-client/2.7.7',
array(
// Identification
//
'label' => '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',
'src/Service/ApplicationObjectExtension.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
),
)
);

View File

@@ -0,0 +1,74 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('NL NL', 'Dutch', 'Nederlands', [
'Menu:CreateMailbox' => '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:OAuthClientCreated' => 'Generate access tokens 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)~~',
]);

View File

@@ -0,0 +1,74 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('PT BR', 'Brazilian', 'Brazilian', [
'Menu:CreateMailbox' => '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:OAuthClientCreated' => 'Generate access tokens 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)~~',
]);

View File

@@ -0,0 +1,74 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('RU RU', 'Russian', 'Русский', [
'Menu:CreateMailbox' => '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:OAuthClientCreated' => 'Generate access tokens 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)~~',
]);

View File

@@ -0,0 +1,74 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('SK SK', 'Slovak', 'Slovenčina', [
'Menu:CreateMailbox' => '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:OAuthClientCreated' => 'Generate access tokens 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)~~',
]);

View File

@@ -0,0 +1,89 @@
<?php
/**
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\OAuthClient\Controller;
use cmdbAbstractObject;
use Combodo\iTop\Application\TwigBase\Controller\Controller;
use Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProviderFactory;
use Dict;
use IssueLog;
use MetaModel;
use utils;
class AjaxOauthClientController extends Controller
{
const LOG_CHANNEL = 'OAuth';
public function OperationGetOAuthAuthorizationUrl()
{
$sClass = utils::ReadParam('class');
$sId = utils::ReadParam('id');
IssueLog::Debug("GetAuthorizationUrl for $sClass::$sId", self::LOG_CHANNEL);
$oObject = MetaModel::GetObject($sClass, $sId);
$aResult = ['status' => 'success', 'data' => []];
$sProvider = $oObject->Get('provider');
$sClientId = $oObject->Get('client_id');
$sClientSecret = $oObject->Get('client_secret');
$sScope = $oObject->GetScope();
$aAdditional = [];
$sAuthorizationUrl = OAuthClientProviderFactory::getVendorProviderForAccessUrl($sProvider, $sClientId, $sClientSecret, $sScope, $aAdditional);
$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);
$oObject = MetaModel::GetObject($sClass, $sId);
$bIsCreation = empty($oObject->Get('token'));
$sProvider = $oObject->Get('provider');
$sClientId = $oObject->Get('client_id');
$sClientSecret = $oObject->Get('client_secret');
$sScope = $oObject->GetScope();
$aAdditional = [];
$sRedirectUrl = utils::ReadParam('redirect_url', '', false, 'raw');
$sRedirectUrlQuery = parse_url($sRedirectUrl)['query'];
$aQuery = [];
parse_str($sRedirectUrlQuery, $aQuery);
$sCode = $aQuery['code'];
$oProvider = OAuthClientProviderFactory::getVendorProvider($sProvider, $sClientId, $sClientSecret, $sScope, $aAdditional);
$oAccessToken = OAuthClientProviderFactory::getAccessTokenFromCode($oProvider, $sCode);
$oObject->Set('token', $oAccessToken->getToken());
$oObject->Set('refresh_token', $oAccessToken->getRefreshToken());
$oObject->DBUpdate();
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);
}
}

View File

@@ -0,0 +1,41 @@
<?php
/**
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\OAuthClient\Controller;
use Combodo\iTop\Application\TwigBase\Controller\Controller;
use IssueLog;
use MetaModel;
use utils;
class OAuthClientController extends Controller
{
const LOG_CHANNEL = 'OAuth';
public function OperationCreateMailbox()
{
$aParams = [];
$sClass = utils::ReadParam('class');
$sId = utils::ReadParam('id');
IssueLog::Debug("CreateMailbox for $sClass::$sId", self::LOG_CHANNEL);
$oOAuthClient = MetaModel::GetObject($sClass, $sId);
$sLogin = $oOAuthClient->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);
}
}

View File

@@ -0,0 +1,147 @@
<?php
/**
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
use Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProviderAbstract;
class OAuthClientAzure extends OAuthClient
{
public static function Init()
{
$aParams = [
'category' => '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('SMTP,IMAP'),
'display_style' => 'list',
'sql' => 'scope',
'default_value' => 'SMTP',
'is_null_allowed' => false,
'depends_on' => [],
'always_load_in_tables' => true,
]));
MetaModel::Init_SetZListItems('details', [
0 => 'name',
1 => 'description',
2 => 'provider',
3 => 'scope',
4 => 'redirect_url',
5 => 'client_id',
6 => 'client_secret',
7 => 'mailbox_list',
]);
MetaModel::Init_SetZListItems('standard_search', [
0 => 'name',
2 => 'provider',
]);
MetaModel::Init_SetZListItems('list', [
]);
}
public function PrefillCreationForm(&$aContextParam)
{
$this->Set('provider', 'Azure');
$this->Set('redirect_url', OAuthClientProviderAbstract::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', OAuthClientProviderAbstract::GetRedirectUri());
}
}
public function GetDefaultMailServer()
{
return 'outlook.office365.com';
}
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 GetScope()
{
$sScope = $this->Get('scope');
if ($sScope == 'IMAP') {
return 'https://outlook.office.com/IMAP.AccessAsUser.All offline_access';
}
// default is smtp
return 'https://outlook.office.com/SMTP.Send offline_access';
}
public function AfterInsert()
{
parent::AfterInsert();
$sClass = get_class($this);
$sId = $this->GetKey();
cmdbAbstractObject::SetSessionMessage(
$sClass,
$sId,
"$sClass:$sId:OAuthClientCreated",
Dict::S('itop-oauth-client:Message:OAuthClientCreated'),
'info',
100,
true
);
}
}

View File

@@ -0,0 +1,145 @@
<?php
/**
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
use Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProviderAbstract;
class OAuthClientGoogle extends OAuthClient
{
public static function Init()
{
$aParams = array
(
'category' => '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', [
0 => 'name',
1 => 'description',
2 => 'provider',
3 => 'scope',
4 => 'redirect_url',
5 => 'client_id',
6 => 'client_secret',
7 => 'mailbox_list',
]);
MetaModel::Init_SetZListItems('standard_search', [
0 => 'name',
2 => 'provider',
]);
MetaModel::Init_SetZListItems('list', [
]);
}
public function PrefillCreationForm(&$aContextParam)
{
$this->Set('provider', 'Google');
$this->Set('scope', 'EMail');
$this->Set('redirect_url', OAuthClientProviderAbstract::GetRedirectUri());
parent::PrefillCreationForm($aContextParam);
}
public function GetDefaultMailServer()
{
return 'imap.gmail.com';
}
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', OAuthClientProviderAbstract::GetRedirectUri());
}
if (empty($this->Get('scope'))) {
$this->Set('scope', 'EMail');
}
}
public function GetScope()
{
return 'https://mail.google.com/';
}
public function AfterInsert()
{
parent::AfterInsert();
$sClass = get_class($this);
$sId = $this->GetKey();
cmdbAbstractObject::SetSessionMessage(
$sClass,
$sId,
"$sClass:$sId:OAuthClientCreated",
Dict::S('itop-oauth-client:Message:OAuthClientCreated'),
'info',
100,
true
);
}
}

View File

@@ -0,0 +1,30 @@
<?php
/**
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\OAuthClient\Service;
use AbstractApplicationObjectExtension;
use Exception;
use OAuthClient;
class ApplicationObjectExtension extends AbstractApplicationObjectExtension
{
public function OnDBInsert($oObject, $oChange = null)
{
if ($oObject instanceof OAuthClient) {
try {
// Ask for tokens the first time
//$response = utils::DoPostRequest($sRestUrl, $aPostedData);
} catch (Exception $e) {
}
}
parent::OnDBInsert($oObject, $oChange); // TODO: Change the autogenerated stub
}
}

View File

@@ -0,0 +1,79 @@
<?php
/**
* @copyright Copyright (C) 2010-2022 Combodo SARL
* @license http://opensource.org/licenses/AGPL-3.0
*/
namespace Combodo\iTop\OAuthClient\Service;
use ApplicationContext;
use Combodo\iTop\Core\Authentication\Client\OAuth\OAuthClientProviderAbstract;
use Dict;
use iPopupMenuExtension;
use JSPopupMenuItem;
use OAuthClient;
use SeparatorPopupMenuItem;
use URLPopupMenuItem;
use utils;
class PopupMenuExtension implements \iPopupMenuExtension
{
const MODULE_CODE = 'itop-oauth-client';
/**
* @inheritDoc
*/
public static function EnumItems($iMenuId, $param)
{
$aResult = [];
switch ($iMenuId) {
case iPopupMenuExtension::MENU_OBJDETAILS_ACTIONS:
$oObj = $param;
if ($oObj instanceof OAuthClient) {
$bHasToken = !empty($oObj->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 = OAuthClientProviderAbstract::GetRedirectUri();
$aResult[] = new JSPopupMenuItem(
$sMenu.' from '.$sObjClass,
Dict::S($sMenu),
"OAuthConnect('$sClass', $sId, '$sAjaxUri', '$sRedirectUri')",
[$sJSFileUrl]
);
if ($bHasToken) {
$sScope = $oObj->Get('scope');
if ($sScope == 'IMAP' || $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;
}
}

View File

@@ -0,0 +1,3 @@
{# @copyright Copyright (C) 2010-2022 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}

View File

@@ -0,0 +1,4 @@
{# @copyright Copyright (C) 2010-2022 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
window.location.href = '{{ sURL|raw }}'

View File

@@ -0,0 +1,74 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('TR TR', 'Turkish', 'Türkçe', [
'Menu:CreateMailbox' => '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:OAuthClientCreated' => 'Generate access tokens 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)~~',
]);

View File

@@ -0,0 +1,7 @@
<?php
// autoload.php @generated by Composer
require_once __DIR__ . '/composer/autoload_real.php';
return ComposerAutoloaderInitd52424b43ff18219f2ec935428aff074::getLoader();

View File

@@ -0,0 +1,572 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* 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 <fabien@symfony.com>
* @author Jordi Boggiano <j.boggiano@seld.be>
* @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<string, array<string, int>>
*/
private $prefixLengthsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, array<int, string>>
*/
private $prefixDirsPsr4 = array();
/**
* @var array[]
* @psalm-var array<string, string>
*/
private $fallbackDirsPsr4 = array();
// PSR-0
/**
* @var array[]
* @psalm-var array<string, array<string, string[]>>
*/
private $prefixesPsr0 = array();
/**
* @var array[]
* @psalm-var array<string, string>
*/
private $fallbackDirsPsr0 = array();
/** @var bool */
private $useIncludePath = false;
/**
* @var string[]
* @psalm-var array<string, string>
*/
private $classMap = array();
/** @var bool */
private $classMapAuthoritative = false;
/**
* @var bool[]
* @psalm-var array<string, bool>
*/
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<string, array<int, string>>
*/
public function getPrefixesPsr4()
{
return $this->prefixDirsPsr4;
}
/**
* @return array[]
* @psalm-return array<string, string>
*/
public function getFallbackDirs()
{
return $this->fallbackDirsPsr0;
}
/**
* @return array[]
* @psalm-return array<string, string>
*/
public function getFallbackDirsPsr4()
{
return $this->fallbackDirsPsr4;
}
/**
* @return string[] Array of classname => path
* @psalm-var array<string, string>
*/
public function getClassMap()
{
return $this->classMap;
}
/**
* @param string[] $classMap Class to filename map
* @psalm-param array<string, string> $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;
}

View File

@@ -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.

View File

@@ -0,0 +1,14 @@
<?php
// autoload_classmap.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Combodo\\iTop\\OAuthClient\\Controller\\AjaxOauthClientController' => $baseDir . '/src/Controller/AjaxOauthClientController.php',
'Combodo\\iTop\\OAuthClient\\Controller\\OAuthClientController' => $baseDir . '/src/Controller/OAuthClientController.php',
'Combodo\\iTop\\OAuthClient\\Service\\ApplicationObjectExtension' => $baseDir . '/src/Service/ApplicationObjectExtension.php',
'Combodo\\iTop\\OAuthClient\\Service\\PopupMenuExtension' => $baseDir . '/src/Service/PopupMenuExtension.php',
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
);

View File

@@ -0,0 +1,9 @@
<?php
// autoload_namespaces.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
);

View File

@@ -0,0 +1,10 @@
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Combodo\\iTop\\OAuthClient\\' => array($baseDir . '/src'),
);

View File

@@ -0,0 +1,46 @@
<?php
// autoload_real.php @generated by Composer
class ComposerAutoloaderInitd52424b43ff18219f2ec935428aff074
{
private static $loader;
public static function loadClassLoader($class)
{
if ('Composer\Autoload\ClassLoader' === $class) {
require __DIR__ . '/ClassLoader.php';
}
}
/**
* @return \Composer\Autoload\ClassLoader
*/
public static function getLoader()
{
if (null !== self::$loader) {
return self::$loader;
}
spl_autoload_register(array('ComposerAutoloaderInitd52424b43ff18219f2ec935428aff074', 'loadClassLoader'), true, true);
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
spl_autoload_unregister(array('ComposerAutoloaderInitd52424b43ff18219f2ec935428aff074', 'loadClassLoader'));
$useStaticLoader = PHP_VERSION_ID >= 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;
}
}

View File

@@ -0,0 +1,40 @@
<?php
// autoload_static.php @generated by Composer
namespace Composer\Autoload;
class ComposerStaticInitd52424b43ff18219f2ec935428aff074
{
public static $prefixLengthsPsr4 = array (
'C' =>
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\\ApplicationObjectExtension' => __DIR__ . '/../..' . '/src/Service/ApplicationObjectExtension.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);
}
}

View File

@@ -0,0 +1,74 @@
<?php
/**
* Localized data
*
* @copyright Copyright (C) 2013 XXXXX
* @license http://opensource.org/licenses/AGPL-3.0
*/
Dict::Add('ZH CN', 'Chinese', '简体中文', [
'Menu:CreateMailbox' => '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:OAuthClientCreated' => 'Generate access tokens 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)~~',
]);