Merged in feature/HOR-4485 (pull request #6468)
HOR-4485 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
18
config/oauthClients.php
Normal file
18
config/oauthClients.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'pm' => [
|
||||
'clientId' => 'x-pm-local-client',
|
||||
'clientSecret' => '179ad45c6ce2cb97cf1029e212046e81',
|
||||
'clientName' => 'PM Web Designer',
|
||||
'clientDescription' => 'ProcessMaker Web Designer App',
|
||||
'clientWebsite' => 'www.processmaker.com',
|
||||
],
|
||||
'mobile' => [
|
||||
'clientId' => 'x-pm-mobile-client',
|
||||
'clientSecret' => '4426746995afa07e7485df1055471800',
|
||||
'clientName' => 'PM Mobile App',
|
||||
'clientDescription' => 'PM Mobile App for Android and iOS',
|
||||
'clientWebsite' => 'www.processmaker.com',
|
||||
],
|
||||
];
|
||||
@@ -2131,7 +2131,8 @@ class WorkspaceTools
|
||||
{
|
||||
$this->initPropel(true);
|
||||
$pmRestClient = OauthClientsPeer::retrieveByPK('x-pm-local-client');
|
||||
if (empty($pmRestClient)) {
|
||||
$pmMobileRestClient = OauthClientsPeer::retrieveByPK(config('oauthClients.mobile.clientId'));
|
||||
if (empty($pmRestClient) || empty($pmMobileRestClient)) {
|
||||
if (!is_file(PATH_DATA . 'sites/' . $workspace . '/' . '.server_info')) {
|
||||
$_CSERVER = $_SERVER;
|
||||
unset($_CSERVER['REQUEST_TIME']);
|
||||
@@ -2159,14 +2160,27 @@ class WorkspaceTools
|
||||
$skin
|
||||
);
|
||||
|
||||
$oauthClients = new OauthClients();
|
||||
$oauthClients->setClientId('x-pm-local-client');
|
||||
$oauthClients->setClientSecret('179ad45c6ce2cb97cf1029e212046e81');
|
||||
$oauthClients->setClientName('PM Web Designer');
|
||||
$oauthClients->setClientDescription('ProcessMaker Web Designer App');
|
||||
$oauthClients->setClientWebsite('www.processmaker.com');
|
||||
$oauthClients->setRedirectUri($endpoint);
|
||||
$oauthClients->save();
|
||||
if (empty($pmRestClient)) {
|
||||
$oauthClients = new OauthClients();
|
||||
$oauthClients->setClientId('x-pm-local-client');
|
||||
$oauthClients->setClientSecret('179ad45c6ce2cb97cf1029e212046e81');
|
||||
$oauthClients->setClientName('PM Web Designer');
|
||||
$oauthClients->setClientDescription('ProcessMaker Web Designer App');
|
||||
$oauthClients->setClientWebsite('www.processmaker.com');
|
||||
$oauthClients->setRedirectUri($endpoint);
|
||||
$oauthClients->save();
|
||||
}
|
||||
|
||||
if (empty($pmMobileRestClient) && !empty(config('oauthClients.mobile.clientId'))) {
|
||||
$oauthClients = new OauthClients();
|
||||
$oauthClients->setClientId(config('oauthClients.mobile.clientId'));
|
||||
$oauthClients->setClientSecret(config('oauthClients.mobile.clientSecret'));
|
||||
$oauthClients->setClientName(config('oauthClients.mobile.clientName'));
|
||||
$oauthClients->setClientDescription(config('oauthClients.mobile.clientDescription'));
|
||||
$oauthClients->setClientWebsite(config('oauthClients.mobile.clientWebsite'));
|
||||
$oauthClients->setRedirectUri($endpoint);
|
||||
$oauthClients->save();
|
||||
}
|
||||
} else {
|
||||
eprintln("WARNING! No server info found!", 'red');
|
||||
}
|
||||
|
||||
@@ -1059,6 +1059,20 @@ class InstallerModule extends Controller
|
||||
'REDIRECT_URI' => $endpoint,
|
||||
'USR_UID' => '00000000000000000000000000000001'
|
||||
]);
|
||||
|
||||
if (!empty(config('oauthClients.mobile.clientId'))) {
|
||||
DB::connection(self::CONNECTION_INSTALL)
|
||||
->table('OAUTH_CLIENTS')
|
||||
->insert([
|
||||
'CLIENT_ID' => config('oauthClients.mobile.clientId'),
|
||||
'CLIENT_SECRET' => config('oauthClients.mobile.clientSecret'),
|
||||
'CLIENT_NAME' => config('oauthClients.mobile.clientName'),
|
||||
'CLIENT_DESCRIPTION' => config('oauthClients.mobile.clientDescription'),
|
||||
'CLIENT_WEBSITE' => config('oauthClients.mobile.clientWebsite'),
|
||||
'REDIRECT_URI' => $endpoint,
|
||||
'USR_UID' => '00000000000000000000000000000001'
|
||||
]);
|
||||
}
|
||||
|
||||
$indexFileUpdated = true;
|
||||
if (defined('PARTNER_FLAG') || isset($_REQUEST['PARTNER_FLAG'])) {
|
||||
|
||||
@@ -1396,6 +1396,17 @@ class adminProxy extends HttpProxyController
|
||||
$oauthClients->setClientWebsite('www.processmaker.com');
|
||||
$oauthClients->setRedirectUri($endpoint);
|
||||
$oauthClients->save();
|
||||
|
||||
if (!empty(config('oauthClients.mobile.clientId'))) {
|
||||
$oauthClients = new OauthClients();
|
||||
$oauthClients->setClientId(config('oauthClients.mobile.clientId'));
|
||||
$oauthClients->setClientSecret(config('oauthClients.mobile.clientSecret'));
|
||||
$oauthClients->setClientName(config('oauthClients.mobile.clientName'));
|
||||
$oauthClients->setClientDescription(config('oauthClients.mobile.clientDescription'));
|
||||
$oauthClients->setClientWebsite(config('oauthClients.mobile.clientWebsite'));
|
||||
$oauthClients->setRedirectUri($endpoint);
|
||||
$oauthClients->save();
|
||||
}
|
||||
|
||||
$result['success'] = true;
|
||||
$result['message'] = '';
|
||||
|
||||
@@ -220,6 +220,20 @@ class Installer
|
||||
'USR_UID' => '00000000000000000000000000000001'
|
||||
]);
|
||||
|
||||
if (!empty(config('oauthClients.mobile.clientId'))) {
|
||||
DB::connection(self::CONNECTION_INSTALL)
|
||||
->table('OAUTH_CLIENTS')
|
||||
->insert([
|
||||
'CLIENT_ID' => config('oauthClients.mobile.clientId'),
|
||||
'CLIENT_SECRET' => config('oauthClients.mobile.clientSecret'),
|
||||
'CLIENT_NAME' => config('oauthClients.mobile.clientName'),
|
||||
'CLIENT_DESCRIPTION' => config('oauthClients.mobile.clientDescription'),
|
||||
'CLIENT_WEBSITE' => config('oauthClients.mobile.clientWebsite'),
|
||||
'REDIRECT_URI' => $endpoint,
|
||||
'USR_UID' => '00000000000000000000000000000001'
|
||||
]);
|
||||
}
|
||||
|
||||
/* Dump schema rbac && data */
|
||||
$pws = PATH_RBAC_MYSQL_DATA . $schema;
|
||||
$qrs = $this->query_sql_file(PATH_RBAC_MYSQL_DATA . $schema);
|
||||
|
||||
Reference in New Issue
Block a user