Merge remote-tracking branch 'origin/feature/HOR-3560' into bugfix/HOR-3465

This commit is contained in:
Ronald Quenta
2017-08-07 16:13:26 -04:00
16 changed files with 317 additions and 243 deletions

View File

@@ -1386,35 +1386,44 @@ class Cases
*
* @name searchOpenPreviousTasks,
* @param string $taskUid
* @param string $sAppUid
* @param array $aPreviousTasks optional array that serves to trace the task routes and avoid infinite loops.
* @return $aThreads
* @param string $appUid
* @param array $previousTasks, optional array that serves to trace the task routes and avoid infinite loops.
* @return array, information about the threads in the case
*/
public function searchOpenPreviousTasks($taskUid, $sAppUid, $aPreviousTasks = array())
public function searchOpenPreviousTasks($taskUid, $appUid, $previousTasks = array())
{
//in this array we are storing all open delegation rows.
$aTaskReviewed = array();
//In this array we are storing all open delegation rows.
$threads = array();
//check if this task ( $taskUid ) has open delegations
$delegations = $this->getReviewedTasks($taskUid, $sAppUid);
//Check if this $taskUid has open delegations, this is a single review
$threads = $this->getReviewedTasks($taskUid, $appUid);
if ($delegations !== false) {
if (count($delegations['open']) > 0) {
//there is an open delegation, so we need to return the delegation row
return $delegations['open'];
if ($threads !== false) {
if (count($threads['open']) > 0) {
//There is an open delegation, so we need to return the delegation row
return $threads['open'];
} else {
if(count($delegations['paused']) > 0){
if (count($threads['paused']) > 0) {
//there is an paused delegation, so we need to return the delegation row
return $delegations['paused'];
}else{
return array(); //returning empty array
return $threads['paused'];
}
}
}
// if not we check previous tasks
// until here this task has not appdelegations records.
// get all previous task from $taskUid, and return open delegations rows, if there are
//Search the open delegations in the previous task, this is a recursive review
$threads = $this->getReviewedTasksRecursive($taskUid, $appUid, $previousTasks);
return $threads;
}
/**
* This function get the last open task
* Usually is used when we have a SEC-JOIN and need to review if we need to route the case
* @param string $taskUid
* @param string $appUid
* @param array $previousTasks
* @return array $taskReviewed
*/
public function getReviewedTasksRecursive($taskUid, $appUid, $previousTasks) {
$taskReviewed = array();
$oCriteria = new Criteria('workflow');
$oCriteria->add(RoutePeer::ROU_NEXT_TASK, $taskUid);
$oDataset = RoutePeer::doSelectRs($oCriteria);
@@ -1422,33 +1431,27 @@ class Cases
while ($oDataset->next()) {
$aRow = $oDataset->getRow();
$delegations = $this->getReviewedTasks($aRow['TAS_UID'], $sAppUid);
$delegations = $this->getReviewedTasks($aRow['TAS_UID'], $appUid);
if ($delegations !== false) {
if (count($delegations['open']) > 0) {
//there is an open delegation, so we need to return the delegation row
$aTaskReviewed = array_merge($aTaskReviewed, $delegations['open']);
} else {
if ($aRow['ROU_TYPE'] == 'PARALLEL-BY-EVALUATION') {
$aTaskReviewed = array();
} else {
//$aTaskReviewed = array_merge($aTaskReviewed, $delegations['closed']);
}
$taskReviewed = array_merge($taskReviewed, $delegations['open']);
} elseif ($aRow['ROU_TYPE'] == 'PARALLEL-BY-EVALUATION') {
$taskReviewed = array();
}
} else {
if (!in_array($aRow['TAS_UID'], $aPreviousTasks)) {
// storing the current task uid of the task currently checked
$aPreviousTasks[] = $aRow['TAS_UID'];
// passing the array of previous tasks in oprder to avoid an infinite loop that prevents
$openPreviousTask = $this->searchOpenPreviousTasks($aRow['TAS_UID'], $sAppUid, $aPreviousTasks);
if (count($aPreviousTasks) > 0) {
$aTaskReviewed = array_merge($aTaskReviewed, $openPreviousTask);
}
} elseif (!in_array($aRow['TAS_UID'], $previousTasks)) {
//Storing the current task uid of the task currently checked
$previousTasks[] = $aRow['TAS_UID'];
//Passing the array of previous tasks in order to avoid an infinite loop that prevents
$openPreviousTask = $this->searchOpenPreviousTasks($aRow['TAS_UID'], $appUid, $previousTasks);
if (count($previousTasks) > 0) {
$taskReviewed = array_merge($taskReviewed, $openPreviousTask);
}
}
}
return $aTaskReviewed;
return $taskReviewed;
}
/**
@@ -5788,8 +5791,8 @@ class Cases
* @param string $tasUid
* @param string $usrUid
* @param string $action some action [VIEW, BLOCK, RESEND]
* @param string $delIndex
* @return Array within all user permitions all objects' types
* @param integer $delIndex
* @return array within all user permissions all objects' types
*/
public function getAllObjectsFrom($proUid, $appUid, $tasUid = '', $usrUid = '', $action = '', $delIndex = 0)
{
@@ -5808,6 +5811,7 @@ class Cases
$result = array(
"DYNAFORM" => array(),
"INPUT" => array(),
"ATTACHMENT" => array(),
"OUTPUT" => array(),
"CASES_NOTES" => 0,
"MSGS_HISTORY" => array()
@@ -5878,6 +5882,15 @@ class Cases
$opObjUid,
$aCase['APP_STATUS']
);
//For Attachment
$result['ATTACHMENT'] = $oObjectPermission->objectPermissionByOutputInput(
$appUid,
$proUid,
$opTaskSource,
'ATTACHED',
$opObjUid,
$aCase['APP_STATUS']
);
$result['CASES_NOTES'] = 1;
/*----------------------------------********---------------------------------*/
@@ -5914,6 +5927,16 @@ class Cases
$aCase['APP_STATUS']
);
break;
case 'ATTACHMENT':
$result['ATTACHMENT'] = $oObjectPermission->objectPermissionByOutputInput(
$appUid,
$proUid,
$opTaskSource,
'ATTACHED',
$opObjUid,
$aCase['APP_STATUS']
);
break;
case 'OUTPUT':
$result['OUTPUT'] = $oObjectPermission->objectPermissionByOutputInput(
$appUid,
@@ -5948,9 +5971,10 @@ class Cases
}
}
return Array(
return array(
"DYNAFORMS" => $result['DYNAFORM'],
"INPUT_DOCUMENTS" => $result['INPUT'],
"ATTACHMENTS" => $result['ATTACHMENT'],
"OUTPUT_DOCUMENTS" => $result['OUTPUT'],
"CASES_NOTES" => $result['CASES_NOTES'],
"MSGS_HISTORY" => $result['MSGS_HISTORY']

View File

@@ -1,40 +1,4 @@
<?php
/**
* class.derivation.php
*
* @package workflow.engine.ProcessMaker
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2011 Colosa Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*
*/
require_once ("classes/model/Task.php");
require_once ("classes/model/Process.php");
require_once ("classes/model/Step.php");
require_once ("classes/model/Application.php");
require_once ('classes/model/Groupwf.php');
require_once ("classes/model/GroupUser.php");
require_once ("classes/model/AppDelegation.php");
require_once ("classes/model/Route.php");
require_once ('classes/model/SubApplication.php');
require_once ('classes/model/SubProcess.php');
require_once ("classes/model/Users.php");
/**
* derivation - derivation class
@@ -87,6 +51,7 @@ class Derivation
* @param array $arrayTaskData Task data (derivation)
*
* @return array Return array
* @throws Exception
*/
protected function prepareInformationTask(array $arrayTaskData)
{
@@ -161,7 +126,8 @@ class Derivation
* @param array $arrayData Data
* @param string $taskUid Unique id of Task
*
* @return array Return array
* @return array
* @throws Exception
*/
public function prepareInformation(array $arrayData, $taskUid = "")
{

View File

@@ -530,10 +530,16 @@ class AppDocument extends BaseAppDocument
return $documents;
}
public function exists ($sAppDocUid, $iVersion)
/**
* This function check if exist a document
* @param string $appDocUid, Uid of the document
* @param integer $version,
* @return object
*/
public function exists ($appDocUid, $version = 1)
{
$oAppDocument = AppDocumentPeer::retrieveByPK( $sAppDocUid, $iVersion );
return (is_object( $oAppDocument ) && get_class( $oAppDocument ) == 'AppDocument');
$oAppDocument = AppDocumentPeer::retrieveByPK($appDocUid, $version);
return (is_object($oAppDocument) && get_class($oAppDocument) == 'AppDocument');
}
/**
@@ -547,6 +553,7 @@ class AppDocument extends BaseAppDocument
*/
public function canDownloadInput($user, $appDocUid, $version)
{
//Check if the the requester is the owner in the file
$oCriteria = new Criteria('workflow');
$oCriteria->addSelectColumn(AppDocumentPeer::APP_UID);
$oCriteria->addJoin(AppDocumentPeer::DOC_UID, InputDocumentPeer::INP_DOC_UID, Criteria::LEFT_JOIN);
@@ -560,11 +567,11 @@ class AppDocument extends BaseAppDocument
if ($dataset->getRow()) {
return true;
} else {
//Review if is a INPUT or ATTACHED
$oCriteria = new Criteria("workflow");
$oCriteria->addSelectColumn(AppDocumentPeer::APP_UID);
$oCriteria->addSelectColumn(AppDocumentPeer::DOC_UID);
$oCriteria->addSelectColumn(InputDocumentPeer::PRO_UID);
$oCriteria->addJoin(AppDocumentPeer::DOC_UID, InputDocumentPeer::INP_DOC_UID, Criteria::LEFT_JOIN);
$oCriteria->addSelectColumn(AppDocumentPeer::APP_DOC_TYPE);
$oCriteria->add(AppDocumentPeer::APP_DOC_UID, $appDocUid);
$oCriteria->add(AppDocumentPeer::DOC_VERSION, $version);
$oCriteria->setLimit(1);
@@ -572,28 +579,56 @@ class AppDocument extends BaseAppDocument
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$dataset->next();
$row = $dataset->getRow();
$cases = new \ProcessMaker\BusinessModel\Cases();
$userAuthorization = $cases->userAuthorization(
$user,
$row['PRO_UID'],
$row['APP_UID'],
array(),
array('INPUT_DOCUMENTS' => 'VIEW')
);
if (in_array($appDocUid, $userAuthorization['objectPermissions']['INPUT_DOCUMENTS'])) {
return true;
}
if ($userAuthorization['supervisor']) {
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(StepSupervisorPeer::STEP_UID);
$criteria->add(StepSupervisorPeer::STEP_TYPE_OBJ, "INPUT_DOCUMENT", \Criteria::EQUAL);
$criteria->add(StepSupervisorPeer::STEP_UID_OBJ, $row['DOC_UID'], \Criteria::EQUAL);
$rsCriteria = StepSupervisorPeer::doSelectRS($criteria);
if ($rsCriteria->next()) {
if ($row['DOC_UID'] == '-1') {
//If is an attached we only verify if is a supervisor in the process
$appUid = $row['APP_UID'];
$oApplication = new Application();
$aColumns = $oApplication->Load($appUid);
$cases = new \ProcessMaker\BusinessModel\Cases();
$userAuthorization = $cases->userAuthorization(
$user,
$aColumns['PRO_UID'],
$appUid,
array(),
array('ATTACHMENTS' => 'VIEW')
);
//Has permissions?
if (in_array($appDocUid, $userAuthorization['objectPermissions']['ATTACHMENTS'])) {
return true;
}
//Is supervisor?
if ($userAuthorization['supervisor']) {
return true;
}
} else {
//If is an file related an input document, we will check if the user is a supervisor or has permissions
$appUid = $row['APP_UID'];
$oInputDoc = new InputDocument();
$aColumns = $oInputDoc->Load($row['DOC_UID']);
$cases = new \ProcessMaker\BusinessModel\Cases();
$userAuthorization = $cases->userAuthorization(
$user,
$aColumns['PRO_UID'],
$appUid,
array(),
array('INPUT_DOCUMENTS' => 'VIEW')
);
//Has permissions?
if (in_array($appDocUid, $userAuthorization['objectPermissions']['INPUT_DOCUMENTS'])) {
return true;
}
//Is supervisor?
if ($userAuthorization['supervisor']) {
//Review if the supervisor has assigned the object input document
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(StepSupervisorPeer::STEP_UID);
$criteria->add(StepSupervisorPeer::STEP_TYPE_OBJ, "INPUT_DOCUMENT", \Criteria::EQUAL);
$criteria->add(StepSupervisorPeer::STEP_UID_OBJ, $row['DOC_UID'], \Criteria::EQUAL);
$rsCriteria = StepSupervisorPeer::doSelectRS($criteria);
if ($rsCriteria->next()) {
return true;
}
}
}
}
return false;

View File

@@ -383,10 +383,10 @@ class ObjectPermission extends BaseObjectPermission
}
switch ($obType) {
case 'INPUT':
$oCriteria->add(
$oCriteria->getNewCriterion(AppDocumentPeer::APP_DOC_TYPE, 'INPUT')->
addOr($oCriteria->getNewCriterion(AppDocumentPeer::APP_DOC_TYPE, 'ATTACHED'))
);
$oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, 'INPUT');
break;
case 'ATTACHED':
$oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, 'ATTACHED');
break;
case 'OUTPUT':
$oCriteria->add(AppDocumentPeer::APP_DOC_TYPE, 'OUTPUT');
@@ -399,9 +399,6 @@ class ObjectPermission extends BaseObjectPermission
$result = array();
while ($oDataset->next()) {
$aRow = $oDataset->getRow();
if ($aRow['APP_DOC_TYPE'] == "ATTACHED") {
$aRow['APP_DOC_TYPE'] = "INPUT";
}
if (!in_array($aRow['APP_DOC_UID'], $result)) {
array_push($result, $aRow['APP_DOC_UID']);
}

View File

@@ -75,7 +75,7 @@ class EmailEventMapBuilder
$tMap->addColumn('EMAIL_EVENT_TO', 'EmailEventTo', 'string', CreoleTypes::LONGVARCHAR, true, null);
$tMap->addColumn('EMAIL_EVENT_SUBJECT', 'EmailEventSubject', 'string', CreoleTypes::VARCHAR, false, 150);
$tMap->addColumn('EMAIL_EVENT_SUBJECT', 'EmailEventSubject', 'string', CreoleTypes::VARCHAR, false, 255);
$tMap->addColumn('PRF_UID', 'PrfUid', 'string', CreoleTypes::VARCHAR, false, 32);

View File

@@ -5537,7 +5537,7 @@
<column name="EVN_UID" type="VARCHAR" size="32" required="true" />
<column name="EMAIL_EVENT_FROM" type="VARCHAR" size="100" required="true" default="" />
<column name="EMAIL_EVENT_TO" type="LONGVARCHAR" required="true" />
<column name="EMAIL_EVENT_SUBJECT" type="VARCHAR" size="150" required="false" default=""/>
<column name="EMAIL_EVENT_SUBJECT" type="VARCHAR" size="255" required="false" default=""/>
<column name="PRF_UID" type="VARCHAR" size="32" required="false" default="" />
<column name="EMAIL_SERVER_UID" type="VARCHAR" size="32" required="false" default="" />
</table>

View File

@@ -9326,6 +9326,12 @@ msgstr "Web Entry deleted correctly"
msgid "[LABEL/ID_PASSWORD] Password"
msgstr "Password"
# TRANSLATION
# LABEL/ID_PASSWORD_CONFIRM
#: LABEL/ID_PASSWORD_CONFIRM
msgid "[LABEL/ID_PASSWORD_CONFIRM] Confirm Password"
msgstr "Confirm Password"
# TRANSLATION
# LABEL/ID_NOT_DEFINED
#: LABEL/ID_NOT_DEFINED

View File

@@ -7,11 +7,16 @@
* @access public
*/
use Maveriks\Util\ClassLoader;
use \OAuth2\Request;
use \ProcessMaker\BusinessModel\Light\Tracker;
use \ProcessMaker\Services\OAuth2\Server;
class Designer extends Controller
{
protected $clientId = 'x-pm-local-client';
public function __construct ()
public function __construct()
{
}
@@ -26,57 +31,16 @@ class Designer extends Controller
$proUid = isset($httpData->prj_uid) ? $httpData->prj_uid : '';
$appUid = isset($httpData->app_uid) ? $httpData->app_uid : '';
$proReadOnly = isset($httpData->prj_readonly) ? $httpData->prj_readonly : 'false';
$client = $this->getClientCredentials();
if (isset($httpData->tracker_designer) && $httpData->tracker_designer == 1) {
try {
if (!isset($_SESSION['CASE']) && !isset($_SESSION['PIN'])) {
throw (new \Exception(
\G::LoadTranslation('ID_CASE_NOT_EXISTS') . "\n" . \G::LoadTranslation('ID_PIN_INVALID')
));
}
\ProcessMaker\BusinessModel\Light\Tracker::authentication($_SESSION['CASE'], $_SESSION['PIN']);
} catch (\Exception $e) {
Bootstrap::registerMonolog('CaseTracker', 400, $e->getMessage(), [], SYS_SYS, 'processmaker.log');
\G::header('Location: /errors/error403.php');
die();
}
$client["tracker_designer"] = 1;
}
$authCode = $this->getAuthorizationCode($client);
$clientToken = $this->getCredentials($httpData);
$debug = false; //System::isDebugMode();
$loader = Maveriks\Util\ClassLoader::getInstance();
$loader->add(PATH_TRUNK . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2");
$request = array(
'grant_type' => 'authorization_code',
'code' => $authCode
);
$server = array(
'REQUEST_METHOD' => 'POST'
);
$headers = array(
"PHP_AUTH_USER" => $client['CLIENT_ID'],
"PHP_AUTH_PW" => $client['CLIENT_SECRET'],
"Content-Type" => "multipart/form-data;",
"Authorization" => "Basic " . base64_encode($client['CLIENT_ID'] . ":" . $client['CLIENT_SECRET'])
);
$request = new \OAuth2\Request(array(), $request, array(), array(), array(), $server, null, $headers);
$oauthServer = new \ProcessMaker\Services\OAuth2\Server();
$response = $oauthServer->postToken($request, true);
$clientToken = $response->getParameters();
$clientToken["client_id"] = $client['CLIENT_ID'];
$clientToken["client_secret"] = $client['CLIENT_SECRET'];
$consolidated = 0;
$enterprise = 0;
$distribution = 0;
/*----------------------------------********---------------------------------*/
$licensedFeatures = & PMLicensedFeatures::getSingleton();
$licensedFeatures = &PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('7TTeDBQeWRoZTZKYjh4eFpYUlRDUUEyVERPU3FxellWank=')) {
$consolidated = 1;
}
@@ -101,10 +65,10 @@ class Designer extends Controller
$this->setVar('HTTP_SERVER_HOSTNAME', PmSystem::getHttpServerHostnameRequestsFrontEnd());
if ($debug) {
if (! file_exists(PATH_HTML . "lib-dev/pmUI/build.cache")) {
if (!file_exists(PATH_HTML . "lib-dev/pmUI/build.cache")) {
throw new RuntimeException("Development JS Files were are not generated!.\nPlease execute: \$>rake pmBuildDebug in pmUI project");
}
if (! file_exists(PATH_HTML . "lib-dev/mafe/build.cache")) {
if (!file_exists(PATH_HTML . "lib-dev/mafe/build.cache")) {
throw new RuntimeException("Development JS Files were are not generated!.\nPlease execute: \$>rake pmBuildDebug in MichelangeloFE project");
}
@@ -128,7 +92,7 @@ class Designer extends Controller
$this->setVar('mafeCssFiles', $mafeCssFiles);
} else {
$buildhashFile = PATH_HTML . "lib/buildhash";
if (! file_exists($buildhashFile)) {
if (!file_exists($buildhashFile)) {
throw new RuntimeException("CSS and JS Files were are not generated!.\nPlease review install process");
}
$buildhash = file_get_contents($buildhashFile);
@@ -137,7 +101,7 @@ class Designer extends Controller
$translationMafe = "/translations/translationsMafe.js";
$this->setVar('translationMafe', $translationMafe);
if (!file_exists(PATH_HTML . "translations" . PATH_SEP. 'translationsMafe' . ".js")) {
if (!file_exists(PATH_HTML . "translations" . PATH_SEP . 'translationsMafe' . ".js")) {
$translation = new Translation();
$translation->generateFileTranslationMafe();
}
@@ -197,10 +161,10 @@ class Designer extends Controller
protected function getAuthorizationCode($client)
{
\ProcessMaker\Services\OAuth2\Server::setDatabaseSource($this->getDsn());
\ProcessMaker\Services\OAuth2\Server::setPmClientId($client['CLIENT_ID']);
Server::setDatabaseSource($this->getDsn());
Server::setPmClientId($client['CLIENT_ID']);
$oauthServer = new \ProcessMaker\Services\OAuth2\Server();
$oauthServer = new Server();
if (isset($client["tracker_designer"]) && $client["tracker_designer"] == 1) {
$_SESSION["USER_LOGGED"] = "00000000000000000000000000000001";
@@ -215,7 +179,7 @@ class Designer extends Controller
));
$response = $oauthServer->postAuthorize($authorize, $userId, true);
$code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40);
$code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=') + 5, 40);
if (isset($client["tracker_designer"]) && $client["tracker_designer"] == 1) {
unset($_SESSION["USER_LOGGED"]);
@@ -228,8 +192,63 @@ class Designer extends Controller
{
list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, '');
$port = empty($port) ? '' : ";port=$port";
$dsn = DB_ADAPTER.':host='.$host.';dbname='.DB_NAME.$port;
$dsn = DB_ADAPTER . ':host=' . $host . ';dbname=' . DB_NAME . $port;
return array('dsn' => $dsn, 'username' => DB_USER, 'password' => DB_PASS);
}
/**
* Return credentials oauth2
*
* @param object $httpData
* @return array credentials
*/
public function getCredentials($httpData = null)
{
$client = $this->getClientCredentials();
if (!empty($httpData->tracker_designer) && $httpData->tracker_designer == 1) {
try {
if (!isset($_SESSION['CASE']) && !isset($_SESSION['PIN'])) {
throw (new \Exception(
\G::LoadTranslation('ID_CASE_NOT_EXISTS') . "\n" . \G::LoadTranslation('ID_PIN_INVALID')
));
}
Tracker::authentication($_SESSION['CASE'], $_SESSION['PIN']);
} catch (\Exception $e) {
Bootstrap::registerMonolog('CaseTracker', 400, $e->getMessage(), [], SYS_SYS, 'processmaker.log');
\G::header('Location: /errors/error403.php');
die();
}
$client["tracker_designer"] = 1;
}
$authCode = $this->getAuthorizationCode($client);
$loader = ClassLoader::getInstance();
$loader->add(PATH_TRUNK . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2");
$request = array(
'grant_type' => 'authorization_code',
'code' => $authCode
);
$server = array(
'REQUEST_METHOD' => 'POST'
);
$headers = array(
"PHP_AUTH_USER" => $client['CLIENT_ID'],
"PHP_AUTH_PW" => $client['CLIENT_SECRET'],
"Content-Type" => "multipart/form-data;",
"Authorization" => "Basic " . base64_encode($client['CLIENT_ID'] . ":" . $client['CLIENT_SECRET'])
);
$request = new Request(array(), $request, array(), array(), array(), $server, null, $headers);
$oauthServer = new Server();
$response = $oauthServer->postToken($request, true);
$clientToken = $response->getParameters();
$clientToken["client_id"] = $client['CLIENT_ID'];
$clientToken["client_secret"] = $client['CLIENT_SECRET'];
return $clientToken;
}
}

View File

@@ -80,36 +80,42 @@ class Installer extends Controller
G::RenderPage( 'publish', 'extJs' );
}
/**
* This function can be create a new workspace
* The user need permission PM_SETUP_ADVANCE for this action
* @return void
*/
public function newSite ()
{
$textStep1 = G::LoadTranslation('ID_PROCESSMAKER_REQUIREMENTS_DESCRIPTION_STEP4_1');
$textStep2 = G::LoadTranslation('ID_PROCESSMAKER_REQUIREMENTS_DESCRIPTION_STEP5');
if (!$this->pmIsInstalled()) {
$textStep1 = G::LoadTranslation('ID_PROCESSMAKER_REQUIREMENTS_DESCRIPTION_STEP4_1');
$textStep2 = G::LoadTranslation('ID_PROCESSMAKER_REQUIREMENTS_DESCRIPTION_STEP5');
$this->includeExtJS( 'installer/CardLayout', false );
$this->includeExtJS( 'installer/Wizard', false );
$this->includeExtJS( 'installer/Header', false );
$this->includeExtJS( 'installer/Card', false );
$this->includeExtJS( 'installer/newSite', false );
$this->includeExtJS('installer/CardLayout', false);
$this->includeExtJS('installer/Wizard', false);
$this->includeExtJS('installer/Header', false);
$this->includeExtJS('installer/Card', false);
$this->includeExtJS('installer/newSite', false);
$this->setJSVar('textStep1', $textStep1);
$this->setJSVar('textStep2', $textStep2);
$this->setJSVar('DB_ADAPTER', DB_ADAPTER);
$aux = explode(':', DB_HOST);
$this->setJSVar('DB_HOST', $aux[0]);
$this->setJSVar('DB_PORT', isset( $aux[1] ) ? $aux[1] : (DB_ADAPTER == 'mssql' ? '1433' : '3306'));
$this->setJSVar('DB_NAME', 'workflow');
$this->setJSVar('DB_USER', '');
$this->setJSVar('DB_PASS', '');
$this->setJSVar('pathConfig', PATH_CORE . 'config' . PATH_SEP);
$this->setJSVar('pathLanguages', PATH_LANGUAGECONT);
$this->setJSVar('pathPlugins', PATH_PLUGINS);
$this->setJSVar('pathXmlforms', PATH_XMLFORM);
$this->setJSVar('pathShared', PATH_DATA);
$this->setView('installer/newSite');
$this->setJSVar( 'textStep1', $textStep1 );
$this->setJSVar( 'textStep2', $textStep2 );
$this->setJSVar( 'DB_ADAPTER', DB_ADAPTER );
$aux = explode( ':', DB_HOST );
$this->setJSVar( 'DB_HOST', $aux[0] );
$this->setJSVar( 'DB_PORT', isset( $aux[1] ) ? $aux[1] : (DB_ADAPTER == 'mssql' ? '1433' : '3306') );
$this->setJSVar( 'DB_NAME', 'workflow' );
$this->setJSVar( 'DB_USER', '' );
$this->setJSVar( 'DB_PASS', '' );
$this->setJSVar( 'pathConfig', PATH_CORE . 'config' . PATH_SEP );
$this->setJSVar( 'pathLanguages', PATH_LANGUAGECONT );
$this->setJSVar( 'pathPlugins', PATH_PLUGINS );
$this->setJSVar( 'pathXmlforms', PATH_XMLFORM );
$this->setJSVar( 'pathShared', PATH_DATA );
$this->setView( 'installer/newSite' );
G::RenderPage( 'publish', 'extJs' );
G::RenderPage('publish', 'extJs');
} else {
$this->displayError();
}
}
public function getSystemInfo ()
@@ -414,22 +420,49 @@ class Installer extends Controller
/**
* function to create a workspace
* in fact this function is calling appropiate functions for mysql and mssql
* need permission PM_SETUP_ADVANCE for this action
* @return void
*/
public function createWorkspace ()
{
$pathSharedPartner = trim( $_REQUEST['pathShared'] );
if (file_exists(trim($pathSharedPartner,PATH_SEP). PATH_SEP .'partner.info')) {
$this->systemName = $this->getSystemName($pathSharedPartner);
$_REQUEST["PARTNER_FLAG"] = true;
}
$this->setResponseType( 'json' );
if ($_REQUEST['db_engine'] == 'mysql') {
$info = $this->createMySQLWorkspace();
} else {
$info = $this->createMSSQLWorkspace();
}
if (!$this->pmIsInstalled()) {
$pathSharedPartner = trim($_REQUEST['pathShared']);
if (file_exists(trim($pathSharedPartner, PATH_SEP) . PATH_SEP . 'partner.info')) {
$this->systemName = $this->getSystemName($pathSharedPartner);
$_REQUEST["PARTNER_FLAG"] = true;
}
$this->setResponseType('json');
if ($_REQUEST['db_engine'] == 'mysql') {
$info = $this->createMySQLWorkspace();
} else {
$info = $this->createMSSQLWorkspace();
}
return $info;
return $info;
} else {
$this->displayError();
}
}
/**
* We check if processMaker is not installed
*
* @return boolean
*/
private function pmIsInstalled(){
return file_exists(FILE_PATHS_INSTALLED);
}
/**
* Display an error when processMaker is already installed
*
* @return void
*/
private function displayError(){
$this->setJSVar('messageError', G::LoadTranslation('ID_PROCESSMAKER_ALREADY_INSTALLED'));
$this->includeExtJS('installer/stopInstall');
$this->setView('installer/mainStopInstall');
G::RenderPage('publish', 'extJs');
}
public function forceTogenerateTranslationsFiles ($url)

View File

@@ -3025,6 +3025,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
( 'LABEL','ID_CONFIRM_DELETE_WEB_ENTRY','en','Do you want to delete current web entry?','2014-01-15') ,
( 'LABEL','ID_WEB_ENTRY_SUCCESS_DELETE','en','Web Entry deleted correctly','2014-01-15') ,
( 'LABEL','ID_PASSWORD','en','Password','2014-01-15') ,
( 'LABEL','ID_PASSWORD_CONFIRM','en','Confirm Password','2017-07-25') ,
( 'LABEL','ID_NOT_DEFINED','en','Not defined','2014-01-15') ,
( 'LABEL','ID_WEB_ENTRY_SUCCESS_NEW','en','Web Entry has been created correctly.','2014-01-15') ,
( 'LABEL','ID_REMOVE_ALL_BUTTON_FACE','en','<<','2014-01-15') ,

View File

@@ -3068,7 +3068,7 @@ CREATE TABLE `EMAIL_EVENT`
`EVN_UID` VARCHAR(32) NOT NULL,
`EMAIL_EVENT_FROM` VARCHAR(100) default '' NOT NULL,
`EMAIL_EVENT_TO` MEDIUMTEXT NOT NULL,
`EMAIL_EVENT_SUBJECT` VARCHAR(150) default '',
`EMAIL_EVENT_SUBJECT` VARCHAR(255) default '',
`PRF_UID` VARCHAR(32) default '',
`EMAIL_SERVER_UID` VARCHAR(32) default '',
PRIMARY KEY (`EMAIL_EVENT_UID`)

View File

@@ -1,26 +1,7 @@
<?php
/**
* installServer.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
global $RBAC;
$RBAC->allows(basename(__FILE__), basename(__FILE__));
if (isset( $_POST['form']['NW_TITLE'] )) {
$action = (isset( $_POST['form']['ACTION'] )) ? trim( $_POST['form']['ACTION'] ) : 'test';

View File

@@ -88,6 +88,13 @@ $oHeadPublisher->assign("arrayMenuNewOptionPlugin", $arrayMenuNewOptionPlugin);
$oHeadPublisher->assign("arrayContextMenuOptionPlugin", $arrayContextMenuOptionPlugin);
$oHeadPublisher->assign('extJsViewState', $oHeadPublisher->getExtJsViewState());
$designer = new Designer();
$oHeadPublisher->assign('SYS_SYS', SYS_SYS);
$oHeadPublisher->assign('SYS_LANG', SYS_LANG);
$oHeadPublisher->assign('SYS_SKIN', SYS_SKIN);
$oHeadPublisher->assign('HTTP_SERVER_HOSTNAME', PmSystem::getHttpServerHostnameRequestsFrontEnd());
$oHeadPublisher->assign('credentials', base64_encode(G::json_encode($designer->getCredentials())));
$deleteCasesFlag = false;
global $RBAC;
if($RBAC->userCanAccess('PM_DELETE_PROCESS_CASES') === 1) {

View File

@@ -1,6 +1,7 @@
<?php
namespace ProcessMaker\BusinessModel;
use Behat\Behat\Exception\Exception;
use \G;
use \Cases;
use \Criteria;
@@ -207,24 +208,22 @@ class ProcessPermissions
/**
* Save Process Permission
*
* @var array $data. Data for Process Permission
* @var string $op_uid. Uid for Process Permission
* @var array $data, Data for Process Permission
* @var string $opUid, Uid for Process Permission
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return void
* @throws Exception
*/
public function saveProcessPermission($data, $op_uid = '')
public function saveProcessPermission($data, $opUid = '')
{
try {
$data = array_change_key_case($data, CASE_UPPER);
$this->validateProUid($data['PRO_UID']);
if ($op_uid != '') {
$op_uid = $this->validateOpUid($op_uid);
if ($opUid != '') {
$opUid = $this->validateOpUid($opUid);
}
if ($data['OP_USER_RELATION'] == "1") {
$this->validateUsrUid($data['USR_UID']);
@@ -257,6 +256,9 @@ class ProcessPermissions
}
$sObjectUID = $data['DYNAFORMS'];
break;
case 'ATTACHED':
$sObjectUID = '';
break;
case 'INPUT':
$data['INPUTS'] = $data['INPUTS'] == 0 ? '': $data['INPUTS'];
if ($data['INPUTS'] != '') {
@@ -273,11 +275,11 @@ class ProcessPermissions
break;
}
$oOP = new \ObjectPermission();
$permissionUid = ($op_uid != '') ? $op_uid : G::generateUniqueID();
$permissionUid = ($opUid != '') ? $opUid : G::generateUniqueID();
$data['OP_UID'] = $permissionUid;
$data['OP_OBJ_UID'] = $sObjectUID;
if ($op_uid == '') {
if ($opUid == '') {
$oOP->fromArray( $data, \BasePeer::TYPE_FIELDNAME );
$oOP->save();
$daraRes = $oOP->load($permissionUid);

View File

@@ -65,7 +65,7 @@ class ProcessPermissions extends Api
* @param string $op_user_relation {@from body} {@choice 1,2}
* @param string $op_case_status {@from body} {@choice ALL,DRAFT,TO_DO,PAUSED,COMPLETED}
* @param string $op_participate {@from body} {@choice 0,1}
* @param string $op_obj_type {@from body} {@choice ANY,DYNAFORM,INPUT,OUTPUT,CASES_NOTES,MSGS_HISTORY,SUMMARY_FORM}
* @param string $op_obj_type {@from body} {@choice ANY,DYNAFORM,ATTACHMENT,INPUT,OUTPUT,CASES_NOTES,MSGS_HISTORY,SUMMARY_FORM}
* @param string $op_action {@from body} {@choice VIEW,BLOCK,DELETE,RESEND}
* @param string $tas_uid {@from body}
* @param string $op_task_source {@from body}
@@ -123,7 +123,7 @@ class ProcessPermissions extends Api
* @param string $op_user_relation {@from body} {@choice 1,2}
* @param string $op_case_status {@from body} {@choice ALL,DRAFT,TO_DO,PAUSED,COMPLETED}
* @param string $op_participate {@from body} {@choice 0,1}
* @param string $op_obj_type {@from body} {@choice ANY,DYNAFORM,INPUT,OUTPUT,CASES_NOTES,MSGS_HISTORY,SUMMARY_FORM}
* @param string $op_obj_type {@from body} {@choice ANY,DYNAFORM,ATTACHMENT,INPUT,OUTPUT,CASES_NOTES,MSGS_HISTORY,SUMMARY_FORM}
* @param string $op_action {@from body} {@choice VIEW,BLOCK,DELETE,RESEND}
* @param string $tas_uid {@from body}
* @param string $op_task_source {@from body}