diff --git a/features/backend/projects/case_scheduler/main_tests_case_scheduler.feature b/features/backend/projects/case_scheduler/main_tests_case_scheduler.feature index 221530d3c..6c715f861 100644 --- a/features/backend/projects/case_scheduler/main_tests_case_scheduler.feature +++ b/features/backend/projects/case_scheduler/main_tests_case_scheduler.feature @@ -20,7 +20,7 @@ Scenario Outline: Get the case schedulers list when there are exactly zero case | test_description | project | record | | Get case scheduler of process Test Michelangelo | 1265557095225ff5c688f46031700471 | 0 | - | Get case scheduler of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 0 | + | Get case scheduler of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 1 | Scenario Outline: Create any case scheduler for a project @@ -122,7 +122,7 @@ Scenario Outline: Get the case schedulers list when there are exactly 16 case sc | test_description | project | record | | Get case scheduler of process Test Michelangelo | 1265557095225ff5c688f46031700471 | 16 | - | Get case scheduler of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 16 | + | Get case scheduler of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 17 | Scenario Outline: Update the case schedulers for a project and then check if the values had changed diff --git a/features/backend/projects/files_manager/main_test_files_manager.feature b/features/backend/projects/files_manager/main_test_files_manager.feature index 5318f62ff..1eaff37ce 100644 --- a/features/backend/projects/files_manager/main_test_files_manager.feature +++ b/features/backend/projects/files_manager/main_test_files_manager.feature @@ -35,7 +35,7 @@ Scenario Outline: Get a list public folder of process files manager Examples: | test_description | project | records | | Get list of process Test Michelangelo | 1265557095225ff5c688f46031700471 | 0 | - | Get list of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 2 | + | Get list of process Process Complete BPMN | 1455892245368ebeb11c1a5001393784 | 4 | Scenario Outline: Get a list templates folder of process files manager diff --git a/features/backend/projects/project_export_import/main_tests_project_export_import.feature b/features/backend/projects/project_export_import/main_tests_project_export_import.feature index 57f673c1d..df679196f 100644 --- a/features/backend/projects/project_export_import/main_tests_project_export_import.feature +++ b/features/backend/projects/project_export_import/main_tests_project_export_import.feature @@ -78,7 +78,7 @@ Scenario: Get a list templates folder of process files manager And the response charset is "UTF-8" And the content type is "application/json" And the type is "array" - And the response has 1 records + And the response has 2 records Scenario: Verify that there are report tables Given I request "project/1455892245368ebeb11c1a5001393784/report-tables" diff --git a/framework/src/Maveriks/WebApplication.php b/framework/src/Maveriks/WebApplication.php index 1baaa21dc..94e8cdfe8 100644 --- a/framework/src/Maveriks/WebApplication.php +++ b/framework/src/Maveriks/WebApplication.php @@ -17,7 +17,9 @@ class WebApplication const RUNNING_INDEX = "index.running"; const RUNNING_WORKFLOW = "workflow.running"; const RUNNING_API = "api.running"; + const RUNNING_OAUTH2 = "api.oauth2"; const SERVICE_API = "service.api"; + const SERVICE_OAUTH2 = "service.oauth2"; const REDIRECT_DEFAULT = "redirect.default"; /** @@ -111,55 +113,7 @@ class WebApplication $uriParts = explode('/', $this->requestUri); if ($uriParts[2] == 'oauth2') { - - if (! isset($uriParts[2])) { - return self::RUNNING_WORKFLOW; - } - - $uriTemp = explode('/', $_SERVER['REQUEST_URI']); - array_shift($uriTemp); - $workspace = array_shift($uriTemp); - $_SERVER['REQUEST_URI'] = '/' . implode('/', $uriTemp); - - $this->loadEnvironment($workspace); - - // $pmOauthClientId - contains PM Local OAuth Id (Web Designer) - $pmOauthClientId = 'x-pm-local-client'; - - // Setting current workspace to Api class - Services\Api::setWorkspace($workspace); - $cacheDir = defined("PATH_C")? PATH_C: sys_get_temp_dir(); - - $sysConfig = \System::getSystemConfiguration(); - - \Luracast\Restler\Defaults::$cacheDirectory = $cacheDir; - $productionMode = !(isset($sysConfig["service_api_debug"]) && $sysConfig["service_api_debug"]); - - Util\Logger::log("Serving API mode: " . ($productionMode? "production": "development")); - - // create a new Restler instance - //$rest = new \Luracast\Restler\Restler(); - $rest = new \Maveriks\Extension\Restler($productionMode); - $rest->setworkspace($workspace); - - // setting api version to Restler - $rest->setAPIVersion('1.0'); - // adding $authenticationClass to Restler - - // Setting database connection source - list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, ''); - $port = empty($port) ? '' : ";port=$port"; - Services\OAuth2\Server::setDatabaseSource(DB_USER, DB_PASS, DB_ADAPTER.":host=$host;dbname=".DB_NAME.$port); - - // Setting default OAuth Client id, for local PM Web Designer - Services\OAuth2\Server::setPmClientId($pmOauthClientId); - Services\OAuth2\Server::setWorkspace($workspace); - - $rest->setOverridingFormats('JsonFormat', 'UploadFormat'); - - $rest->addAPIClass('\ProcessMaker\\Services\\OAuth2\\Server', 'oauth2'); - $rest->handle(); - + return self::RUNNING_OAUTH2; } else { return self::RUNNING_WORKFLOW; } @@ -186,6 +140,16 @@ class WebApplication } Util\Logger::log("API::End Dispatch"); break; + + case self::SERVICE_OAUTH2: + $uriTemp = explode('/', $_SERVER['REQUEST_URI']); + array_shift($uriTemp); + $workspace = array_shift($uriTemp); + $uri = '/' . implode('/', $uriTemp); + + $this->loadEnvironment($workspace); + $this->dispatchApiRequest($uri, $version = "1.0"); + break; } } @@ -393,6 +357,8 @@ class WebApplication // } // } } + + $this->rest->addAPIClass('\ProcessMaker\\Services\\OAuth2\\Server', 'oauth2'); } public function parseApiRequestUri() diff --git a/workflow/engine/classes/class.pluginRegistry.php b/workflow/engine/classes/class.pluginRegistry.php index 45db3491b..b9311ab47 100755 --- a/workflow/engine/classes/class.pluginRegistry.php +++ b/workflow/engine/classes/class.pluginRegistry.php @@ -259,7 +259,11 @@ class PMPluginRegistry $this->registerFolder( $sNamespace, $sNamespace, $detail->sPluginFolder ); //register the default directory, later we can have more $this->_aPluginDetails[$sNamespace]->enabled = true; - $oPlugin = new $detail->sClassName( $detail->sNamespace, $detail->sFilename ); + if (class_exists($detail->sClassName)) { + $oPlugin = new $detail->sClassName( $detail->sNamespace, $detail->sFilename ); + } else { + $oPlugin = $detail; + } $this->_aPlugins[$detail->sNamespace] = $oPlugin; if (method_exists( $oPlugin, 'enable' )) { $oPlugin->enable(); diff --git a/workflow/engine/methods/login/authentication.php b/workflow/engine/methods/login/authentication.php index 28c631062..7ead89e9b 100755 --- a/workflow/engine/methods/login/authentication.php +++ b/workflow/engine/methods/login/authentication.php @@ -43,7 +43,7 @@ try { require_once PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEP . 'enterprise.php'; $enterprise = new enterprisePlugin('enterprise'); - + if (!file_exists(PATH_DATA_SITE . "plugin.singleton")) { $enterprise->enable(); } @@ -100,7 +100,7 @@ try { $errLabel = 'WRONG_LOGIN_CREDENTIALS'; } - $_SESSION["USERNAME_PREVIOUS1"] = $_SESSION["USERNAME_PREVIOUS2"]; + $_SESSION["USERNAME_PREVIOUS1"] = (isset($_SESSION["USERNAME_PREVIOUS2"]))? $_SESSION["USERNAME_PREVIOUS2"] : ""; $_SESSION["USERNAME_PREVIOUS2"] = $usr; if (!isset($uid) || $uid < 0) { diff --git a/workflow/engine/src/ProcessMaker/Services/OAuth2/PmPdo.php b/workflow/engine/src/ProcessMaker/Services/OAuth2/PmPdo.php index 2f84112bc..e7d909314 100644 --- a/workflow/engine/src/ProcessMaker/Services/OAuth2/PmPdo.php +++ b/workflow/engine/src/ProcessMaker/Services/OAuth2/PmPdo.php @@ -209,7 +209,7 @@ class PmPdo implements \OAuth2\Storage\AuthorizationCodeInterface, // the default behavior is to use "username" as the user_id return array_merge(array( - 'user_id' => $username + 'user_id' => $userInfo['USR_UID'] //$username ), $userInfo); } diff --git a/workflow/engine/templates/enterprise/addonsStore.js b/workflow/engine/templates/enterprise/addonsStore.js index 0b86fa80a..33bda2d8e 100644 --- a/workflow/engine/templates/enterprise/addonsStore.js +++ b/workflow/engine/templates/enterprise/addonsStore.js @@ -732,7 +732,6 @@ Ext.onReady(function() { } if (sw == 1) { - var pm = PROCESSMAKER_URL; uploadForm.getForm().submit({ url: "../enterprise/addonsStoreAction", params: { @@ -740,10 +739,8 @@ Ext.onReady(function() { }, waitMsg: _('ID_UPDATING_LICENSE_MSG'), success: function (form, o) { - //Ext.MessageBox.alert(_('ID_INFORMATION'), _('ID_SUCCESSFULLY_UPLOADED')); - //parent.parent.window.location.href = newLocation(); Ext.MessageBox.alert(_('ID_INFORMATION'), _('ID_SUCCESSFULLY_UPLOADED'), function () { - parent.parent.window.location.href = PROCESSMAKER_URL + (SYS_SKIN.substring(0,2) == 'ux')? "/main/login" :"/setup/login/login"; + parent.parent.window.location.href = newLocation() }); }, failure: function (form, o) { @@ -1020,7 +1017,7 @@ Ext.onReady(function() { value: license_expires+'/'+license_span+" ("+license_start_date+" / "+license_end_date+")", hidden: !licensed, hideLabel: !licensed - }, + } ], buttons : [ { diff --git a/workflow/public_html/app.php b/workflow/public_html/app.php index 50d6cc21f..df7df25ae 100644 --- a/workflow/public_html/app.php +++ b/workflow/public_html/app.php @@ -56,6 +56,10 @@ try { $app->run(Maveriks\WebApplication::SERVICE_API); break; + case Maveriks\WebApplication::RUNNING_OAUTH2: + $app->run(Maveriks\WebApplication::SERVICE_OAUTH2); + break; + case Maveriks\WebApplication::RUNNING_INDEX: $response = new Maveriks\Http\Response(file_get_contents("index.html"), 302); $response->send();