Conflicts

This commit is contained in:
Paula Quispe
2017-10-20 18:51:24 -04:00
178 changed files with 2452 additions and 1973 deletions

View File

@@ -724,7 +724,7 @@ class ActionsByEmail
if ($flagLogin) {
header(
'Location: /sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN .
'Location: /sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN .
'/login/login?u=' . urlencode($_SERVER['REQUEST_URI'])
);

File diff suppressed because it is too large Load Diff

View File

@@ -802,8 +802,8 @@ class InputDocument
break;
}
G::SendMessageText( $message, "ERROR" );
$backUrlObj = explode( "sys" . SYS_SYS, $_SERVER['HTTP_REFERER'] );
G::header( "location: " . "/sys" . SYS_SYS . $backUrlObj[1] );
$backUrlObj = explode( "sys" . config("system.workspace"), $_SERVER['HTTP_REFERER'] );
G::header( "location: " . "/sys" . config("system.workspace") . $backUrlObj[1] );
die();
}
@@ -855,9 +855,9 @@ class InputDocument
if ($msg != '') {
if ($runningWorkflow) {
G::SendMessageText($msg, 'ERROR');
$backUrlObj = explode('sys' . SYS_SYS, $_SERVER['HTTP_REFERER']);
$backUrlObj = explode('sys' . config("system.workspace"), $_SERVER['HTTP_REFERER']);
G::header('location: ' . '/sys' . SYS_SYS . $backUrlObj[1]);
G::header('location: ' . '/sys' . config("system.workspace") . $backUrlObj[1]);
exit(0);
} else {
throw new Exception($msg);
@@ -1005,8 +1005,8 @@ class InputDocument
}
$message = $res->message;
G::SendMessageText($message, "ERROR");
$backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']);
G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]);
$backUrlObj = explode("sys" . config("system.workspace"), $_SERVER['HTTP_REFERER']);
G::header("location: " . "/sys" . config("system.workspace") . $backUrlObj[1]);
die();
}
@@ -1019,8 +1019,8 @@ class InputDocument
if ($inpDocMaxFilesize > 0 && $fileSizeByField > 0) {
if ($fileSizeByField > $inpDocMaxFilesize) {
G::SendMessageText(G::LoadTranslation("ID_SIZE_VERY_LARGE_PERMITTED"), "ERROR");
$arrayAux1 = explode("sys" . SYS_SYS, $_SERVER["HTTP_REFERER"]);
G::header("location: /sys" . SYS_SYS . $arrayAux1[1]);
$arrayAux1 = explode("sys" . config("system.workspace"), $_SERVER["HTTP_REFERER"]);
G::header("location: /sys" . config("system.workspace") . $arrayAux1[1]);
exit(0);
}
}
@@ -1035,8 +1035,8 @@ class InputDocument
$message = G::LoadTranslation('THE_UPLOAD_OF_PHP_FILES_WAS_DISABLED');
Bootstrap::registerMonologPhpUploadExecution('phpUpload', 550, $message, 'processmaker.log');
G::SendMessageText($message, "ERROR");
$backUrlObj = explode("sys" . SYS_SYS, $_SERVER['HTTP_REFERER']);
G::header("location: " . "/sys" . SYS_SYS . $backUrlObj[1]);
$backUrlObj = explode("sys" . config("system.workspace"), $_SERVER['HTTP_REFERER']);
G::header("location: " . "/sys" . config("system.workspace") . $backUrlObj[1]);
die();
}

View File

@@ -281,7 +281,7 @@ class Consolidated
$className = $tableName;
if (!class_exists($className)) {
require_once(PATH_DB . SYS_SYS . PATH_SEP . "classes" . PATH_SEP . $className . ".php");
require_once(PATH_DB . config("system.workspace") . PATH_SEP . "classes" . PATH_SEP . $className . ".php");
}
$oCriteria = new Criteria("workflow");
@@ -908,7 +908,7 @@ class Consolidated
}
}
@unlink(PATH_C . "ws" . PATH_SEP . SYS_SYS . PATH_SEP . "xmlform" . PATH_SEP . $pro_uid . PATH_SEP . $dyn_uid . "." . SYS_LANG);
@unlink(PATH_C . "ws" . PATH_SEP . config("system.workspace") . PATH_SEP . "xmlform" . PATH_SEP . $pro_uid . PATH_SEP . $dyn_uid . "." . SYS_LANG);
$array ['columnModel'] = $caseColumns;

View File

@@ -475,7 +475,7 @@ class EmailEvent
\PMFSendMessage($appUID, $configEmailData['MESS_ACCOUNT'], $emailTo, '', '', $subject,
$contentFile['prf_filename'], array(), array(), true, 0, $configEmailData);
} else {
\Bootstrap::registerMonolog('EmailEventMailError', 200, \G::LoadTranslation('ID_EMAIL_EVENT_CONFIGURATION_EMAIL', array($eventUid, $prj_uid)), ['eventUid' => $eventUid, 'prj_uid' => $prj_uid], SYS_SYS, 'processmaker.log');
\Bootstrap::registerMonolog('EmailEventMailError', 200, \G::LoadTranslation('ID_EMAIL_EVENT_CONFIGURATION_EMAIL', array($eventUid, $prj_uid)), ['eventUid' => $eventUid, 'prj_uid' => $prj_uid], config("system.workspace"), 'processmaker.log');
}
}
}

View File

@@ -63,7 +63,7 @@ class EmailServer
$currentUser = $RBAC->aUserInfo['USER_INFO'];
$info = array(
'ip' => G::getIpAddress(),
'workspace' => (defined("SYS_SYS")) ? SYS_SYS : "Workspace undefined",
'workspace' => (!empty(config("system.workspace"))) ? config("system.workspace") : "Workspace undefined",
'usrUid' => $currentUser['USR_UID']
);
$this->setContextLog($info);

View File

@@ -328,7 +328,7 @@ class Light
//Log
Bootstrap::registerMonolog('MobileCreateCase', 200, "Create case",
['application_uid' => $aData['APPLICATION'], 'usr_uid' => $userId], SYS_SYS, 'processmaker.log');
['application_uid' => $aData['APPLICATION'], 'usr_uid' => $userId], config("system.workspace"), 'processmaker.log');
} catch (Exception $e) {
$response['status'] = 'failure';
$response['message'] = $e->getMessage();
@@ -574,7 +574,7 @@ class Light
//Log
Bootstrap::registerMonolog('MobileRouteCase', 200, 'Route case',
['application_uid' => $applicationUid, 'usr_uid' => $userUid], SYS_SYS, 'processmaker.log');
['application_uid' => $applicationUid, 'usr_uid' => $userUid], config("system.workspace"), 'processmaker.log');
} catch (Exception $e) {
throw $e;
}
@@ -807,7 +807,7 @@ class Light
session_start();
session_regenerate_id();
setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . SYS_SYS, null, false, true);
setcookie("workspaceSkin", SYS_SKIN, time() + (24 * 60 * 60), "/sys" . config("system.workspace"), null, false, true);
if (strlen($msg) > 0) {
$_SESSION['G_MESSAGE'] = $msg;
@@ -1236,7 +1236,7 @@ class Light
public function getUsersToReassign($usr_uid, $task_uid)
{
$memcache = PMmemcached::getSingleton(SYS_SYS);
$memcache = PMmemcached::getSingleton(config("system.workspace"));
$RBAC = RBAC::getSingleton(PATH_DATA, session_id());
$RBAC->sSystem = 'PROCESSMAKER';
$RBAC->initRBAC();
@@ -1323,7 +1323,7 @@ class Light
*/
public function getConfiguration($params)
{
$sysConf = Bootstrap::getSystemConfiguration('', '', SYS_SYS);
$sysConf = Bootstrap::getSystemConfiguration('', '', config("system.workspace"));
$multiTimeZone = false;
//Set Time Zone
/*----------------------------------********---------------------------------*/

View File

@@ -12,7 +12,7 @@ class NotificationDevice
public function checkMobileNotifications()
{
$conf = System::getSystemConfiguration('', '', SYS_SYS);
$conf = System::getSystemConfiguration('', '', config("system.workspace"));
$activeNotifications = true;
if (isset($conf['mobileNotifications'])) {
$activeNotifications = $conf['mobileNotifications'] == 1 ? true : false;

View File

@@ -371,7 +371,7 @@ class MessageApplication
$ws = new \WsBase();
$case = new \Cases();
$common = new \ProcessMaker\Util\Common();
$sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined";
$sysSys = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined";
$common->setFrontEnd($frontEnd);
@@ -683,7 +683,7 @@ class MessageApplication
)
{
try {
\Bootstrap::registerMonolog('MessageEventCron', $level, $message, $aContext, SYS_SYS, 'processmaker.log');
\Bootstrap::registerMonolog('MessageEventCron', $level, $message, $aContext, config("system.workspace"), 'processmaker.log');
} catch (\Exception $e) {
throw $e;
}

View File

@@ -45,7 +45,7 @@ class FileHandler
{
$workflowFile = array();
$workspaceTargetDir = ($target === 'PUBLIC') ? 'public' : 'mailTemplates';
$workspaceDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP;
$workspaceDir = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP;
$templatesDir = $workspaceDir . $workspaceTargetDir . PATH_SEP . $prj_uid;
$templatesFiles = Util\Common::rglob("$templatesDir/*", 0, true);

View File

@@ -44,7 +44,7 @@ class FilesMigrator implements Importable, Exportable
}
$aPath = $data['PATH'];
foreach ($aPath as $target => $files) {
$basePath = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP;
$basePath = PATH_DATA . 'sites' . PATH_SEP . config("system.workspace") . PATH_SEP . 'public' . PATH_SEP;
if (strtoupper($target) === 'PUBLIC') {
foreach ($files as $file) {
$filename = $basePath . ((isset($file["file_path"])) ? $file["file_path"] : $file["filepath"]);

View File

@@ -65,7 +65,7 @@ class GranularExporter
$projectData = $bpmnProject->getProject();
$this->prjName = $projectData['PRJ_NAME'];
$getProjectName = $this->publisher->truncateName($projectData['PRJ_NAME'], false);
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
$outputDir = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx2") + 1;
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx2");
@@ -143,7 +143,7 @@ class GranularExporter
"export_server_os" => PHP_OS ,
"export_server_php_version" => PHP_VERSION_ID,
);
$data["metadata"]["workspace"] = defined("SYS_SYS") ? SYS_SYS : "Unknown";
$data["metadata"]["workspace"] = !empty(config("system.workspace")) ? config("system.workspace") : "Unknown";
$data["metadata"]["name"] = $projectData['PRJ_NAME'];
$data["metadata"]["uid"] = $projectData['PRJ_UID'];
$data["metadata"]["export_version"] = $version;

View File

@@ -44,7 +44,7 @@ class TemplatesMigrator implements Importable, Exportable
}
$aPath = $data['PATH'];
foreach ($aPath as $target => $files) {
$basePath = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'mailTemplates' . PATH_SEP;
$basePath = PATH_DATA . 'sites' . PATH_SEP . config("system.workspace") . PATH_SEP . 'mailTemplates' . PATH_SEP;
if (strtoupper($target) === 'TEMPLATE') {
foreach ($files as $file) {
$filename = $basePath . ((isset($file["file_path"])) ? $file["file_path"] : $file["filepath"]);

View File

@@ -964,7 +964,7 @@ class Process
$process = new \Process();
$memcache = &\PMmemcached::getSingleton(SYS_SYS);
$memcache = &\PMmemcached::getSingleton(config("system.workspace"));
$memkey = "no memcache";
$memcacheUsed = "not used";
@@ -1775,8 +1775,8 @@ class Process
$aInvalidTypes = array("title", "subtitle", "file", "button", "reset", "submit", "javascript");
$aMultipleSelectionFields = array("listbox", "checkgroup", "grid");
if (is_file( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) {
$dyn = new DynaformHandler( PATH_DATA . '/sites/'. SYS_SYS .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' );
if (is_file( PATH_DATA . '/sites/'. config("system.workspace") .'/xmlForms/'. $proUid .'/'.$dynUid. '.xml' ) && filesize( PATH_DATA . '/sites/'. config("system.workspace") .'/xmlForms/'. $proUid .'/'. $dynUid .'.xml' ) > 0) {
$dyn = new DynaformHandler( PATH_DATA . '/sites/'. config("system.workspace") .'/xmlForms/' .$proUid. '/' . $dynUid .'.xml' );
$dynaformFields[] = $dyn->getFields();
$fields = $dyn->getFields();

View File

@@ -5,6 +5,7 @@ use Behat\Behat\Exception\Exception;
use \G;
use \Criteria;
use \ObjectPermissionPeer;
use \Exception as StandardException;
/**
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
@@ -224,6 +225,9 @@ class ProcessPermissions
if ($opUid != '') {
$opUid = $this->validateOpUid($opUid);
}
if (empty($data['USR_UID']) || (isset($data['USR_UID']) && $data['USR_UID'] === "null")) {
throw (new StandardException(G::LoadTranslation("ID_SELECT_USER_OR_GROUP")));
}
if ($data['OP_USER_RELATION'] == "1") {
$this->validateUsrUid($data['USR_UID']);
} else {

View File

@@ -227,7 +227,7 @@ class ProjectUser
} else {
$http = 'http://';
}
$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2';
$endpoint = $http . $_SERVER['HTTP_HOST'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . SYS_SKIN . '/services/wsdl2';
@$client = new \SoapClient( $endpoint );
$user = $sWS_USER;
$pass = $sWS_PASS;
@@ -325,7 +325,7 @@ class ProjectUser
try {
$http = (\G::is_https())? "https://" : "http://";
$client = new \SoapClient($http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/wsdl2");
$client = new \SoapClient($http . $_SERVER["HTTP_HOST"] . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/services/wsdl2");
$params = array(
"userid" => $username,

View File

@@ -99,7 +99,7 @@ class Skins
$xmlConfiguration = file_get_contents($configFileOriginal);
$workspace = ($skinWorkspace == 'global') ? '' : SYS_SYS;
$workspace = ($skinWorkspace == 'global') ? '' : config("system.workspace");
$xmlConfigurationObj = G::xmlParser($xmlConfiguration);
$skinInformationArray = $xmlConfigurationObj->result["skinConfiguration"]["__CONTENT__"]["information"]["__CONTENT__"];

View File

@@ -592,7 +592,7 @@ class Table
}
$className = $table['ADD_TAB_CLASS_NAME'];
$classPeerName = $className . 'Peer';
$sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
$sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP;
if (! file_exists( $sPath . $className . '.php' )) {
throw new \Exception( 'Update:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $className ) );
}
@@ -684,7 +684,7 @@ class Table
}
$className = $table['ADD_TAB_CLASS_NAME'];
$classPeerName = $className . 'Peer';
$sPath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
$sPath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP;
if (! file_exists( $sPath . $className . '.php' )) {
throw new \Exception( 'Update:: ' . G::loadTranslation( 'ID_PMTABLE_CLASS_DOESNT_EXIST', $className ) );
}

View File

@@ -1151,7 +1151,7 @@ class TimerEvent
private function log($action, $value = "", $status = "action")
{
try {
$workspace = (defined("SYS_SYS"))? SYS_SYS : "Wokspace Undefined";
$workspace = (!empty(config("system.workspace")))? config("system.workspace") : "Wokspace Undefined";
$ipClient = \G::getIpAddress();
$actionTimer = "timereventcron: ";
@@ -1192,7 +1192,7 @@ class TimerEvent
)
{
try {
\Bootstrap::registerMonolog('TimerEventCron', $level, $message, $aContext, SYS_SYS, 'processmaker.log');
\Bootstrap::registerMonolog('TimerEventCron', $level, $message, $aContext, config("system.workspace"), 'processmaker.log');
} catch (\Exception $e) {
throw $e;
}
@@ -1214,7 +1214,7 @@ class TimerEvent
$ws = new \WsBase();
$case = new \Cases();
$common = new \ProcessMaker\Util\Common();
$sysSys = (defined("SYS_SYS"))? SYS_SYS : "Undefined";
$sysSys = (!empty(config("system.workspace")))? config("system.workspace") : "Undefined";
$common->setFrontEnd($frontEnd);

View File

@@ -171,7 +171,7 @@ class Trigger
) {
//Check disabled code
$cs = new \CodeScanner(SYS_SYS);
$cs = new \CodeScanner(config("system.workspace"));
$arrayFoundDisabledCode = $cs->checkDisabledCode("SOURCE", $dataTrigger["TRI_WEBBOT"]);

View File

@@ -719,7 +719,7 @@ class User
$aUserProperty = $userProperty->loadOrCreateIfNotExists($userUid, array("USR_PASSWORD_HISTORY" => serialize(array(Bootstrap::hashPassword($arrayData["USR_PASSWORD"])))));
$memKey = "rbacSession" . session_id();
$memcache = &PMmemcached::getSingleton(defined("SYS_SYS") ? SYS_SYS : "");
$memcache = &PMmemcached::getSingleton(!empty(config("system.workspace")) ? config("system.workspace") : "");
if (($rbac->aUserInfo = $memcache->get($memKey)) == false) {
$rbac->loadUserRolePermission("PROCESSMAKER", $userUidLogged);

View File

@@ -43,7 +43,7 @@ class WebEntry
{
$this->pathDataPublic = defined("PATH_DATA_PUBLIC") ? PATH_DATA_PUBLIC : \G::$pathDataPublic;
$this->httpHost = isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : \G::$httpHost;
$this->sysSys = defined("SYS_SYS") ? SYS_SYS : \G::$sysSys;
$this->sysSys = !empty(config("system.workspace")) ? config("system.workspace") : \G::$sysSys;
$this->sysSkin = defined("SYS_SKIN") ? SYS_SKIN : \G::$sysSkin;
try {
foreach ($this->arrayFieldDefinition as $key => $value) {
@@ -851,7 +851,7 @@ class WebEntry
try {
if ((!isset($record['WE_LINK_GENERATION']) || $record['WE_LINK_GENERATION']==='DEFAULT') && $record["WE_METHOD"] == "WS") {
$http = (\G::is_https())? "https://" : "http://";
$url = $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $record["PRO_UID"];
$url = $http . $_SERVER["HTTP_HOST"] . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $record["PRO_UID"];
$record["WE_DATA"] = $url . "/" . $record["WE_DATA"];
}

View File

@@ -1350,13 +1350,13 @@ class WebEntryEvent
strpos($domain, 'https://') === 0;
$url = ($hasProtocol ? '' : $http) .
$domain .
"/sys" . SYS_SYS . "/" .
"/sys" . config("system.workspace") . "/" .
$weLinkLanguage . "/" .
$weLinkSkin . "/" . $prj_uid;
return $url . "/" . $weData;
} else {
$url = $http . $_SERVER["HTTP_HOST"] . "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $prj_uid;
$url = $http . $_SERVER["HTTP_HOST"] . "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN . "/" . $prj_uid;
return $url . "/" . $weData;
}

View File

@@ -1060,7 +1060,7 @@ class System
$workspace = explode("|", $res['SKIN_WORKSPACE']);
$swWS = false;
foreach ($workspace as $key => $value) {
if ($value == SYS_SYS) {
if ($value == config("system.workspace")) {
$swWS = true;
break;
}

View File

@@ -92,7 +92,7 @@ abstract class Exporter
$data = array();
$data["metadata"] = $this->getMetadata();
$data["metadata"]["workspace"] = defined("SYS_SYS") ? SYS_SYS : "Unknown";
$data["metadata"]["workspace"] = !empty(config("system.workspace")) ? config("system.workspace") : "Unknown";
$data["metadata"]["name"] = $this->getProjectName();
$data["metadata"]["uid"] = $this->getProjectUid();

View File

@@ -771,7 +771,7 @@ abstract class Importer
$exporter = new \ProcessMaker\Exporter\XmlExporter($prj_uid);
$getProjectName = $exporter->truncateName($exporter->getProjectName(), false);
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
$outputDir = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx") + 1;
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx");

View File

@@ -90,6 +90,7 @@ class PluginAdapter
'_aJavascripts' => ['name' => 'PLUGIN_JS', 'type' => 'array'],
'_aJs' => ['name' => 'PLUGIN_JS', 'type' => 'array'],
'_restServices' => ['name' => 'PLUGIN_REST_SERVICE', 'type' => 'array'],
'_aTaskExtendedProperties' => ['name' => 'PLUGIN_TASK_EXTENDED_PROPERTIES', 'type' => 'array'],
];
/**

View File

@@ -45,8 +45,7 @@ class PluginRegistry
use PluginStructure;
use Attributes;
use Init;
const NAME_CACHE = SYS_SYS . __CLASS__;
/**
* Instance of de object PluginRegistry
* @var PluginRegistry $instance
@@ -75,9 +74,9 @@ class PluginRegistry
public static function loadSingleton()
{
if (self::$instance === null) {
if (is_null($object = Cache::get(self::NAME_CACHE))) {
if (is_null($object = Cache::get(config("system.workspace") . __CLASS__))) {
$object = new PluginRegistry();
Cache::put(self::NAME_CACHE, $object, config('app.cache_lifetime'));
Cache::put(config("system.workspace") . __CLASS__, $object, config('app.cache_lifetime'));
}
self::$instance = $object;
}
@@ -202,7 +201,7 @@ class PluginRegistry
$fieldPlugin = PluginsRegistry::loadOrCreateIfNotExists(md5($plugin['PLUGIN_NAMESPACE']), $plugin);
PluginsRegistry::update($fieldPlugin);
}
Cache::pull(self::NAME_CACHE);
Cache::pull(config("system.workspace") . __CLASS__);
}
/**
* Get the plugin details, by filename
@@ -855,12 +854,19 @@ class PluginRegistry
}
if ($found) {
require_once($classFile);
$sClassName = substr($this->_aPluginDetails[$trigger->getNamespace()]->getClassName(), 0, 1) .
$sClassNameA = substr($this->_aPluginDetails[$trigger->getNamespace()]->getClassName(), 0, 1) .
str_replace(
'plugin',
['Plugin','plugin'],
'Class',
substr($this->_aPluginDetails[$trigger->getNamespace()]->getClassName(), 1)
);
$sClassNameB = substr($this->_aPluginDetails[$trigger->getNamespace()]->getClassName(), 0, 1) .
str_replace(
['Plugin','plugin'],
'class',
substr($this->_aPluginDetails[$trigger->getNamespace()]->getClassName(), 1)
);
$sClassName = class_exists($sClassNameA) ? $sClassNameA : $sClassNameB;
$obj = new $sClassName();
$methodName = $trigger->getTriggerName();
$response = $obj->{$methodName}($oData);

View File

@@ -138,7 +138,7 @@ class Bpmn extends Handler
//Define the variables for the logging
$info = array(
'ip' => G::getIpAddress(),
'workspace' => (defined("SYS_SYS"))? SYS_SYS : "Workspace undefined"
'workspace' => (!empty(config("system.workspace")))? config("system.workspace") : "Workspace undefined"
);
$this->setContextLog($info);
}

View File

@@ -1123,10 +1123,10 @@ class Workflow extends Handler
$basePath = PATH_DYNAFORM;
break;
case "PUBLIC":
$basePath = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "public" . PATH_SEP;
$basePath = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "public" . PATH_SEP;
break;
case "TEMPLATES":
$basePath = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "mailTemplates" . PATH_SEP;
$basePath = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "mailTemplates" . PATH_SEP;
break;
default:
$basePath = "";
@@ -1213,7 +1213,7 @@ class Workflow extends Handler
//Get templates and public files
$workspaceTargetDirs = array("TEMPLATES" => "mailTemplates", "PUBLIC" => "public");
$workspaceDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP;
$workspaceDir = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP;
foreach ($workspaceTargetDirs as $target => $workspaceTargetDir) {
$templatesDir = $workspaceDir . $workspaceTargetDir . PATH_SEP . $processUid;

View File

@@ -1,11 +1,20 @@
<?php
namespace ProcessMaker\Services\Api;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
use \ProcessMaker\Util\DateTime;
use \ProcessMaker\BusinessModel\Validator;
use AppDocument;
use AppDelegation;
use AppDelegationPeer;
use Criteria;
use Exception;
use Luracast\Restler\RestException;
use ProcessMaker\BusinessModel\Cases as BmCases;
use ProcessMaker\BusinessModel\User as BmUser;
use ProcessMaker\BusinessModel\ProcessSupervisor as BmProcessSupervisor;
use ProcessMaker\Util\DateTime;
use ProcessMaker\BusinessModel\Validator;
use ProcessMaker\Services\Api;
/**
* Cases Api Controller
@@ -42,7 +51,7 @@ class Cases extends Api
$delIndex = $this->parameters[$arrayArgs['app_index']];
$userUid = $this->getUserId();
//Check if the user has the case
$appDelegation = new \AppDelegation();
$appDelegation = new AppDelegation();
$aCurUser = $appDelegation->getCurrentUsers($applicationUid, $delIndex);
if (!empty($aCurUser)) {
foreach ($aCurUser as $key => $value) {
@@ -52,16 +61,37 @@ class Cases extends Api
}
}
//Check if the user has Permissions
$oCases = new \ProcessMaker\BusinessModel\Cases();
$oCases = new BmCases();
return $oCases->checkUserHasPermissionsOrSupervisor($userUid, $applicationUid, $dynaformUid);
break;
case 'doPutCaseVariables':
$applicationUid = $this->parameters[$arrayArgs['app_uid']];
$dynaformUid = $this->parameters[$arrayArgs['dyn_uid']];
$delIndex = $this->parameters[$arrayArgs['del_index']];
$userUid = $this->getUserId();
//Check if the user has the case currently
$appDelegation = new AppDelegation();
$currentUser = $appDelegation->getCurrentUsers($applicationUid, $delIndex);
foreach ($currentUser as $key => $value) {
if ($value === $userUid) {
return true;
}
}
//Check if the user is a supervisor
//Unlike GET, it is not enough to have the processPermission for update the variables
$cases = new BmCases();
$isSupervisor = $cases->isSupervisorFromForm($userUid, $applicationUid, $dynaformUid);
return $isSupervisor;
break;
case 'doPostReassign':
$arrayParameters = $this->parameters[0]['cases'];
$usrUid = $this->getUserId();
//Check if the user is supervisor process
$case = new \ProcessMaker\BusinessModel\Cases();
$user = new \ProcessMaker\BusinessModel\User();
$case = new BmCases();
$user = new BmUser();
$count = 0;
@@ -71,7 +101,7 @@ class Cases extends Api
if (!empty($arrayApplicationData)) {
if (!$user->checkPermission($usrUid, 'PM_REASSIGNCASE')) {
if ($user->checkPermission($usrUid, 'PM_REASSIGNCASE_SUPERVISOR')) {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new BmProcessSupervisor();
$flagps = $supervisor->isUserProcessSupervisor($arrayApplicationData['PRO_UID'], $usrUid);
if (!$flagps) {
$count = $count + 1;
@@ -90,20 +120,20 @@ class Cases extends Api
$appUid = $this->parameters[$arrayArgs['app_uid']];
$usrUid = $this->getUserId();
//Check if the user is supervisor process
$case = new \ProcessMaker\BusinessModel\Cases();
$user = new \ProcessMaker\BusinessModel\User();
$case = new BmCases();
$user = new BmUser();
$arrayApplicationData = $case->getApplicationRecordByPk($appUid, [], false);
if (!empty($arrayApplicationData)) {
$criteria = new \Criteria("workflow");
$criteria->addSelectColumn(\AppDelegationPeer::APP_UID);
$criteria->add(\AppDelegationPeer::APP_UID, $appUid);
$criteria->add(\AppDelegationPeer::USR_UID, $usrUid);
$criteria = new Criteria("workflow");
$criteria->addSelectColumn(AppDelegationPeer::APP_UID);
$criteria->add(AppDelegationPeer::APP_UID, $appUid);
$criteria->add(AppDelegationPeer::USR_UID, $usrUid);
$criteria->setLimit(1);
$rsCriteria = \AppDelegationPeer::doSelectRS($criteria);
$rsCriteria = AppDelegationPeer::doSelectRS($criteria);
if ($rsCriteria->next()) {
return true;
} else {
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
$supervisor = new BmProcessSupervisor();
$flagps = $supervisor->isUserProcessSupervisor($arrayApplicationData['PRO_UID'], $usrUid);
return $flagps;
}
@@ -131,7 +161,7 @@ class Cases extends Api
}
return false;
} catch (\Exception $e) {
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
@@ -147,9 +177,7 @@ class Cases extends Api
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url GET
*/
@@ -174,11 +202,11 @@ class Cases extends Api
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \ProcessMaker\BusinessModel\Cases();
$oCases = new BmCases();
$response = $oCases->getList($dataList);
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -194,9 +222,7 @@ class Cases extends Api
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url GET /paged
*/
@@ -221,10 +247,10 @@ class Cases extends Api
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \ProcessMaker\BusinessModel\Cases();
$oCases = new BmCases();
$response = $oCases->getList($dataList);
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -240,9 +266,7 @@ class Cases extends Api
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url GET /draft
*/
@@ -267,10 +291,10 @@ class Cases extends Api
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \ProcessMaker\BusinessModel\Cases();
$oCases = new BmCases();
$response = $oCases->getList($dataList);
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -286,9 +310,7 @@ class Cases extends Api
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url GET /draft/paged
*/
@@ -313,10 +335,10 @@ class Cases extends Api
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \ProcessMaker\BusinessModel\Cases();
$oCases = new BmCases();
$response = $oCases->getList($dataList);
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -332,9 +354,7 @@ class Cases extends Api
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url GET /participated
*/
@@ -359,10 +379,10 @@ class Cases extends Api
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \ProcessMaker\BusinessModel\Cases();
$oCases = new BmCases();
$response = $oCases->getList($dataList);
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -378,9 +398,7 @@ class Cases extends Api
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url GET /participated/paged
*/
@@ -405,10 +423,10 @@ class Cases extends Api
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \ProcessMaker\BusinessModel\Cases();
$oCases = new BmCases();
$response = $oCases->getList($dataList);
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -424,9 +442,7 @@ class Cases extends Api
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url GET /unassigned
*/
@@ -451,10 +467,10 @@ class Cases extends Api
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \ProcessMaker\BusinessModel\Cases();
$oCases = new BmCases();
$response = $oCases->getList($dataList);
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -470,9 +486,7 @@ class Cases extends Api
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url GET /unassigned/paged
*/
@@ -497,10 +511,10 @@ class Cases extends Api
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \ProcessMaker\BusinessModel\Cases();
$oCases = new BmCases();
$response = $oCases->getList($dataList);
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -516,9 +530,7 @@ class Cases extends Api
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url GET /paused
*/
@@ -543,10 +555,10 @@ class Cases extends Api
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \ProcessMaker\BusinessModel\Cases();
$oCases = new BmCases();
$response = $oCases->getList($dataList);
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -562,9 +574,7 @@ class Cases extends Api
* @param string $pro_uid {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url GET /paused/paged
*/
@@ -589,10 +599,10 @@ class Cases extends Api
$dataList['category'] = $cat_uid;
$dataList['process'] = $pro_uid;
$dataList['search'] = $search;
$oCases = new \ProcessMaker\BusinessModel\Cases();
$oCases = new BmCases();
$response = $oCases->getList($dataList);
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -612,9 +622,7 @@ class Cases extends Api
* @param string $date_to {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url GET /advanced-search
*/
@@ -647,10 +655,10 @@ class Cases extends Api
$dataList['dateFrom'] = $date_from;
$dataList['dateTo'] = $date_to;
$dataList['search'] = $search;
$oCases = new \ProcessMaker\BusinessModel\Cases();
$oCases = new BmCases();
$response = $oCases->getList($dataList);
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -670,9 +678,7 @@ class Cases extends Api
* @param string $date_to {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url GET /advanced-search/paged
*/
@@ -705,10 +711,10 @@ class Cases extends Api
$dataList['dateFrom'] = $date_from;
$dataList['dateTo'] = $date_to;
$dataList['search'] = $search;
$oCases = new \ProcessMaker\BusinessModel\Cases();
$oCases = new BmCases();
$response = $oCases->getList($dataList);
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -719,17 +725,19 @@ class Cases extends Api
* @url GET /:app_uid
*
* @param string $app_uid {@min 32}{@max 32}
* @return array
* @throws Exception
*/
public function doGetCaseInfo($app_uid)
{
try {
$case = new \ProcessMaker\BusinessModel\Cases();
$case = new BmCases();
$case->setFormatFieldNameInUppercase(false);
$caseInfo = $case->getCaseInfo($app_uid, $this->getUserId());
$caseInfo = DateTime::convertUtcToIso8601($caseInfo, $this->arrayFieldIso8601);
return $caseInfo;
} catch (\Exception $e) {
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
@@ -742,7 +750,7 @@ class Cases extends Api
public function doGetTaskCase($app_uid)
{
try {
$case = new \ProcessMaker\BusinessModel\Cases();
$case = new BmCases();
$case->setFormatFieldNameInUppercase(false);
$arrayData = $case->getTaskCase($app_uid, $this->getUserId());
@@ -750,7 +758,7 @@ class Cases extends Api
$response = $arrayData;
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -767,10 +775,10 @@ class Cases extends Api
{
try {
$userUid = $this->getUserId();
$cases = new \ProcessMaker\BusinessModel\Cases();
$cases = new BmCases();
$oData = $cases->addCase($pro_uid, $tas_uid, $userUid, $variables);
return $oData;
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -787,10 +795,10 @@ class Cases extends Api
public function doPostCaseImpersonate($pro_uid, $usr_uid, $tas_uid, $variables = null)
{
try {
$cases = new \ProcessMaker\BusinessModel\Cases();
$cases = new BmCases();
$oData = $cases->addCaseImpersonate($pro_uid, $usr_uid, $tas_uid, $variables);
return $oData;
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -807,9 +815,9 @@ class Cases extends Api
{
try {
$userUid = $this->getUserId();
$cases = new \ProcessMaker\BusinessModel\Cases();
$cases = new BmCases();
$cases->updateReassignCase($app_uid, $userUid, $del_index, $usr_uid_source, $usr_uid_target);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -825,9 +833,9 @@ class Cases extends Api
{
try {
$userUid = $this->getUserId();
$cases = new \ProcessMaker\BusinessModel\Cases();
$cases = new BmCases();
$cases->updateRouteCase($app_uid, $userUid, $del_index);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -846,9 +854,9 @@ class Cases extends Api
{
try {
$userUid = $this->getUserId();
$cases = new \ProcessMaker\BusinessModel\Cases();
$cases = new BmCases();
$cases->putCancelCase($cas_uid, $userUid);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -858,9 +866,7 @@ class Cases extends Api
*
* @param string $cas_uid {@min 1}{@max 32}
* @param string $unpaused_date {@from body}
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url PUT /:cas_uid/pause
*/
@@ -868,13 +874,13 @@ class Cases extends Api
{
try {
$userUid = $this->getUserId();
$cases = new \ProcessMaker\BusinessModel\Cases();
$cases = new BmCases();
if ($unpaused_date == null) {
$cases->putPauseCase($cas_uid, $userUid);
} else {
$cases->putPauseCase($cas_uid, $userUid, false, $unpaused_date);
}
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -883,9 +889,7 @@ class Cases extends Api
* Unpause Case
*
* @param string $cas_uid {@min 1}{@max 32}
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url PUT /:cas_uid/unpause
*/
@@ -893,9 +897,9 @@ class Cases extends Api
{
try {
$userUid = $this->getUserId();
$cases = new \ProcessMaker\BusinessModel\Cases();
$cases = new BmCases();
$cases->putUnpauseCase($cas_uid, $userUid);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -905,9 +909,7 @@ class Cases extends Api
*
* @param string $cas_uid {@min 1}{@max 32}
* @param string $tri_uid {@min 1}{@max 32}
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url PUT /:cas_uid/execute-trigger/:tri_uid
*/
@@ -915,9 +917,9 @@ class Cases extends Api
{
try {
$userUid = $this->getUserId();
$cases = new \ProcessMaker\BusinessModel\Cases();
$cases = new BmCases();
$cases->putExecuteTriggerCase($cas_uid, $tri_uid, $userUid);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -926,9 +928,7 @@ class Cases extends Api
* Delete Case
*
* @param string $cas_uid {@min 1}{@max 32}
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url DELETE /:cas_uid
*/
@@ -936,9 +936,9 @@ class Cases extends Api
{
try {
$usr_uid = $this->getUserId();
$cases = new \ProcessMaker\BusinessModel\Cases();
$cases = new BmCases();
$cases->deleteCase($cas_uid, $usr_uid);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -962,10 +962,10 @@ class Cases extends Api
{
try {
$usr_uid = $this->getUserId();
$cases = new \ProcessMaker\BusinessModel\Cases();
$cases = new BmCases();
$response = $cases->getCaseVariables($app_uid, $usr_uid, $dyn_uid, $pro_uid, $act_uid, $app_index);
return DateTime::convertUtcToIso8601($response);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -977,9 +977,7 @@ class Cases extends Api
* @param array $request_data
* @param string $dyn_uid {@from path}
* @param int $del_index {@from path}
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url PUT /:app_uid/variable
*/
@@ -987,10 +985,10 @@ class Cases extends Api
{
try {
$usr_uid = $this->getUserId();
$cases = new \ProcessMaker\BusinessModel\Cases();
$cases = new BmCases();
$request_data = \ProcessMaker\Util\DateTime::convertDataToUtc($request_data);
$cases->setCaseVariables($app_uid, $request_data, $dyn_uid, $usr_uid, $del_index);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -1008,9 +1006,7 @@ class Cases extends Api
* @param string $date_to {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url GET /:app_uid/notes
*/
@@ -1038,10 +1034,10 @@ class Cases extends Api
$dataList['search'] = $search;
$usr_uid = $this->getUserId();
$cases = new \ProcessMaker\BusinessModel\Cases();
$cases = new BmCases();
$response = $cases->getCaseNotes($app_uid, $usr_uid, $dataList);
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -1058,9 +1054,7 @@ class Cases extends Api
* @param string $date_to {@from path}
* @param string $search {@from path}
* @return array
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url GET /:app_uid/notes/paged
*/
@@ -1086,10 +1080,10 @@ class Cases extends Api
$dataList['search'] = $search;
$usr_uid = $this->getUserId();
$cases = new \ProcessMaker\BusinessModel\Cases();
$cases = new BmCases();
$response = $cases->getCaseNotes($app_uid, $usr_uid, $dataList);
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -1100,9 +1094,7 @@ class Cases extends Api
* @param string $app_uid {@min 1}{@max 32}
* @param string $note_content {@min 1}{@max 500}
* @param int $send_mail {@choice 1,0}
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url POST /:app_uid/note
*/
@@ -1110,10 +1102,10 @@ class Cases extends Api
{
try {
$usr_uid = $this->getUserId();
$cases = new \ProcessMaker\BusinessModel\Cases();
$cases = new BmCases();
$send_mail = ($send_mail == 0) ? false : true;
$cases->saveCaseNote($app_uid, $usr_uid, $note_content, $send_mail);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -1126,13 +1118,13 @@ class Cases extends Api
public function doGetTasks($app_uid)
{
try {
$case = new \ProcessMaker\BusinessModel\Cases();
$case = new BmCases();
$case->setFormatFieldNameInUppercase(false);
$response = $case->getTasks($app_uid);
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
} catch (\Exception $e) {
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
@@ -1144,17 +1136,16 @@ class Cases extends Api
* @param int $del_index {@from body}
* @param string $obj_type {@from body}
* @param string $obj_uid {@from body}
*
* @copyright Colosa - Bolivia
* @throws Exception
*
* @url PUT /:app_uid/execute-triggers
*/
public function doPutExecuteTriggers($app_uid, $del_index, $obj_type, $obj_uid)
{
try {
$cases = new \ProcessMaker\BusinessModel\Cases();
$cases = new BmCases();
$cases->putExecuteTriggers($app_uid, $del_index, $obj_type, $obj_uid);
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -1169,13 +1160,13 @@ class Cases extends Api
public function doGetSteps($app_uid, $del_index)
{
try {
$case = new \ProcessMaker\BusinessModel\Cases();
$case = new BmCases();
$case->setFormatFieldNameInUppercase(false);
$response = $case->getSteps($app_uid, $del_index);
return $response;
} catch (\Exception $e) {
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
@@ -1187,6 +1178,7 @@ class Cases extends Api
*
* @param string $type_view {@from path}
* @return array
* @throws Exception
*
*/
public function doGetCasesListStarCase(
@@ -1194,12 +1186,12 @@ class Cases extends Api
) {
try {
$usr_uid = $this->getUserId();
$case = new \ProcessMaker\BusinessModel\Cases();
$case = new BmCases();
$response = $case->getCasesListStarCase($usr_uid, $type_view);
return $response;
} catch (\Exception $e) {
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
@@ -1211,6 +1203,7 @@ class Cases extends Api
*
* @param string $type_view {@from path}
* @return array
* @throws Exception
*
*/
public function doGetCasesListBookmarkStarCase(
@@ -1218,12 +1211,12 @@ class Cases extends Api
) {
try {
$usr_uid = $this->getUserId();
$case = new \ProcessMaker\BusinessModel\Cases();
$case = new BmCases();
$response = $case->getCasesListBookmarkStarCase($usr_uid, $type_view);
return $response;
} catch (\Exception $e) {
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
@@ -1234,15 +1227,16 @@ class Cases extends Api
* @url POST /bookmark/:tas_uid
*
* @param string $tas_uid {@min 32}{@max 32}
* @throws Exception
*
*/
public function doPostBookmarkStartCase($tas_uid)
{
try {
$userLoggedUid = $this->getUserId();
$user = new \ProcessMaker\BusinessModel\User();
$user = new BmUser();
$user->updateBookmark($userLoggedUid, $tas_uid, 'INSERT');
} catch (\Exception $e) {
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
@@ -1252,15 +1246,16 @@ class Cases extends Api
* @url DELETE /bookmark/:tas_uid
*
* @param string $tas_uid {@min 32}{@max 32}
* @throws Exception
*
*/
public function doDeleteBookmarkStartCase($tas_uid)
{
try {
$userLoggedUid = $this->getUserId();
$user = new \ProcessMaker\BusinessModel\User();
$user = new BmUser();
$user->updateBookmark($userLoggedUid, $tas_uid, 'DELETE');
} catch (\Exception $e) {
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
@@ -1273,15 +1268,16 @@ class Cases extends Api
* @class AccessControl {@className \ProcessMaker\Services\Api\Cases}
*
* @param array $request_data
* @throws Exception
*
*/
public function doPostReassign($request_data)
{
try {
$case = new \ProcessMaker\BusinessModel\Cases();
$case = new BmCases();
$response = $case->doPostReassign($request_data);
return $response;
} catch (\Exception $e) {
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}

View File

@@ -1715,24 +1715,26 @@ class Light extends Api
/**
* Put Case Variables
* @access protected
* @class AccessControl {@className \ProcessMaker\Services\Api\Cases}
* @url PUT /:app_uid/variable
*
* @param string $app_uid {@min 1}{@max 32}
* @param array $request_data
* @param string $dyn_uid {@from path}
* @param int $del_index {@from path}
*
* @url PUT /:app_uid/variable
* @return void
* @throws RestException
*/
public function doPutCaseVariables($app_uid, $request_data, $dyn_uid = '', $del_index = 0)
{
try {
//Check if the user is a supervisor or have permissions
$usr_uid = $this->getUserId();
$cases = new BusinessModelCases();
$hasAccess = $cases->checkUserHasPermissionsOrSupervisor($usr_uid, $app_uid, $dyn_uid);
//When the user is a supervisor del_index is 0
if ($del_index <= 0 && !$hasAccess) {
if ($del_index < 0) {
throw (new Exception(G::LoadTranslation('ID_INVALID_VALUE_EXPECTING_POSITIVE_INTEGER',
array('del_index')), Api::STAT_APP_EXCEPTION));
}
@@ -1740,6 +1742,7 @@ class Light extends Api
throw (new Exception(G::LoadTranslation('ID_CAN_NOT_BE_NULL', array('del_index')),
Api::STAT_APP_EXCEPTION));
}
$cases = new BusinessModelCases();
if ($del_index > 0) {
if ($cases->caseAlreadyRouted($app_uid, $del_index, $usr_uid)) {
throw (new Exception(G::LoadTranslation('ID_CASE_ALREADY_DERIVATED'), Api::STAT_APP_EXCEPTION));

View File

@@ -16,12 +16,10 @@ use ProcessMaker\Project\Adapter\BpmnWorkflow;
use Exception;
/**
* Class Project
*
* @package Services\Api\ProcessMaker
* @author Erik Amaru Ortiz <aortiz.erik@gmail.com, erik@colosa.com>
*
* @protected
* @access protected
* @class AccessControl {@permission PM_FACTORY}
*/
class Project extends Api
{
@@ -53,7 +51,6 @@ class Project extends Api
/**
* @url GET /:prj_uid
*
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetProject($prj_uid)
@@ -75,10 +72,6 @@ class Project extends Api
*
* @param string $prj_name
* @param array $request_data
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @url POST
* @status 201
*/
@@ -97,7 +90,6 @@ class Project extends Api
/**
* @url PUT /:prj_uid
*
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doPutProject($prj_uid, $request_data)
@@ -141,11 +133,10 @@ class Project extends Api
/**
* Bulk actions
*
* @url POST /bulk
*
* @access protected
* @class AccessControl {@permission PM_FACTORY}
*
* @param array $request_data
* @return array $response
* @throws Exception
@@ -162,7 +153,6 @@ class Project extends Api
/**
* @url GET /:prj_uid/export/listObjects
*
* @param string $prj_uid {@min 32}{@max 32}
* @return mixed|string
* @throws RestException
@@ -180,7 +170,6 @@ class Project extends Api
/**
* @url GET /:prj_uid/export-granular
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $objects
*/
@@ -189,7 +178,7 @@ class Project extends Api
$objects = \G::json_decode($objects);
$granularExporter = new GranularExporter($prj_uid);
$outputFilename = $granularExporter->export($objects);
$outputFilename = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'files' . PATH_SEP . 'output' .
$outputFilename = PATH_DATA . 'sites' . PATH_SEP . config("system.workspace") . PATH_SEP . 'files' . PATH_SEP . 'output' .
PATH_SEP . $outputFilename;
$httpStream = new HttpStream();
$fileExtension = pathinfo($outputFilename, PATHINFO_EXTENSION);
@@ -203,7 +192,6 @@ class Project extends Api
/**
* @url GET /:prj_uid/export
*
* @param string $prj_uid {@min 32}{@max 32}
*/
public function export($prj_uid)
@@ -211,7 +199,7 @@ class Project extends Api
$exporter = new \ProcessMaker\Exporter\XmlExporter($prj_uid);
$getProjectName = $exporter->truncateName($exporter->getProjectName(), false);
$outputDir = PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
$outputDir = PATH_DATA . "sites" . PATH_SEP . config("system.workspace") . PATH_SEP . "files" . PATH_SEP . "output" . PATH_SEP;
$version = Common::getLastVersionSpecialCharacters($outputDir, $getProjectName, "pmx") + 1;
$outputFilename = $outputDir . sprintf("%s-%s.%s", str_replace(" ", "_", $getProjectName), $version, "pmx");
@@ -230,9 +218,7 @@ class Project extends Api
/**
* @url POST /import
*
* @param array $request_data
*
* @status 201
*/
public function doPostImport(array $request_data, $option = null, $option_group = null)
@@ -260,7 +246,6 @@ class Project extends Api
/**
* @url POST /save-as
*
* @param string $prj_uid {@from body}
* @param string $prj_name {@from body}
* @param string $prj_description {@from body}
@@ -274,7 +259,6 @@ class Project extends Api
/**
* @url GET /:prj_uid/process
*
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetProcess($prj_uid)
@@ -295,7 +279,6 @@ class Project extends Api
/**
* @url PUT /:prj_uid/process
*
* @param string $prj_uid {@min 32}{@max 32}
* @param array $request_data
*/
@@ -315,9 +298,7 @@ class Project extends Api
/**
* @url POST /generate-bpmn
*
* @param array $request_data
*
* @status 201
*/
public function doPostGenerateBpmn(array $request_data)
@@ -353,7 +334,6 @@ class Project extends Api
/**
* @url GET /:prj_uid/dynaforms
*
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetDynaForms($prj_uid)
@@ -373,7 +353,6 @@ class Project extends Api
/**
* @url GET /:prj_uid/input-documents
*
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetInputDocuments($prj_uid)
@@ -393,7 +372,6 @@ class Project extends Api
/**
* @url GET /:prj_uid/variables
*
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetVariables($prj_uid)
@@ -414,7 +392,6 @@ class Project extends Api
/**
* @url GET /:prj_uid/grid/variables
* @url GET /:prj_uid/grid/:grid_uid/variables
*
* @param string $prj_uid {@min 32}{@max 32}
* @param string $grid_uid
*/
@@ -435,7 +412,6 @@ class Project extends Api
/**
* @url GET /:prj_uid/trigger-wizards
*
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doGetTriggerWizards($prj_uid)
@@ -455,7 +431,6 @@ class Project extends Api
/**
* @url PUT /:prj_uid/update-route-order
*
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doPutUpdateRouteOrder($prj_uid, $request_data)
@@ -471,7 +446,6 @@ class Project extends Api
/**
* @url PUT /:prj_uid/update-route-order-from-project
*
* @param string $prj_uid {@min 32}{@max 32}
*/
public function doPutUpdateRouteOrderFromProject($prj_uid)

View File

@@ -58,44 +58,22 @@ class ProcessPermissions extends Api
}
/**
* Creates a new Process Permission for a project.
*
* @url POST /:prj_uid/process-permission/
* @status 201
*
* @param string $prj_uid {@min 1} {@max 32}
* @param array $request_data
*
* @param string $usr_uid {@from body} {@min 1} {@max 32}
* @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,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}
* @param string $dynaforms {@from body}
* @param string $inputs {@from body}
* @param string $outputs {@from body}
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return array
*
* @url POST /:prj_uid/process-permission/
* @status 201
* @throws RestException
*
* @access protected
* @class AccessControl {@permission PM_FACTORY}
*/
public function doPostProcessPermission(
$prj_uid,
$request_data,
$usr_uid,
$op_user_relation,
$op_case_status,
$op_participate,
$op_obj_type,
$op_action,
$tas_uid = '',
$op_task_source = '',
$dynaforms = '',
$inputs = '',
$outputs = ''
) {
public function doPostProcessPermission($prj_uid, $request_data)
{
try {
$hiddenFields = array('task_target', 'group_user', 'task_source',
'object_type', 'object', 'participated', 'action'

View File

@@ -144,8 +144,8 @@ class Server implements iAuthenticate
$host = $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : '');
$host = $http .'://'. $host;
$applicationsLink = sprintf('%s/%s/oauth2/apps', $host, SYS_SYS);
$authorizationLink = sprintf('%s/%s/oauth2/authorize?response_type=code&client_id=[the-client-id]&scope=*', $host, SYS_SYS);
$applicationsLink = sprintf('%s/%s/oauth2/apps', $host, config("system.workspace"));
$authorizationLink = sprintf('%s/%s/oauth2/authorize?response_type=code&client_id=[the-client-id]&scope=*', $host, config("system.workspace"));
$view = new \Maveriks\Pattern\Mvc\SmartyView(PATH_CORE . "templates/oauth2/index.html");
$view->assign('host', $host);
@@ -180,7 +180,7 @@ class Server implements iAuthenticate
$host = $http . '://' . $_SERVER['SERVER_NAME'] . ($_SERVER['SERVER_PORT'] != '80' ? ':' . $_SERVER['SERVER_PORT'] : '');
$redirect = urlencode($host.'/'.self::$workspace.$_SERVER['REQUEST_URI']);
$loginLink = sprintf('%s/sys%s/%s/%s/login/login?u=%s', $host, SYS_SYS, SYS_LANG, SYS_SKIN, $redirect);
$loginLink = sprintf('%s/sys%s/%s/%s/login/login?u=%s', $host, config("system.workspace"), SYS_LANG, SYS_SKIN, $redirect);
header('location: ' . $loginLink);
die;
}
@@ -214,7 +214,7 @@ class Server implements iAuthenticate
$view = new \Maveriks\Pattern\Mvc\SmartyView(PATH_CORE . "templates/oauth2/authorize.html");
$view->assign('user', $user);
$view->assign('client', $client);
$view->assign('postUri', '/' . SYS_SYS . '/oauth2/authorize?' . $_SERVER['QUERY_STRING']);
$view->assign('postUri', '/' . config("system.workspace") . '/oauth2/authorize?' . $_SERVER['QUERY_STRING']);
$view->render();
exit();
}
@@ -364,7 +364,7 @@ class Server implements iAuthenticate
$userTimeZone = $user->getUsrTimeZone();
if (trim($userTimeZone) == '') {
$arraySystemConfiguration = System::getSystemConfiguration('', '', SYS_SYS);
$arraySystemConfiguration = System::getSystemConfiguration('', '', config("system.workspace"));
$userTimeZone = $arraySystemConfiguration['time_zone'];
}

View File

@@ -200,7 +200,7 @@ class FixReferencePath
*/
public function regeneratePropelClasses($repTabName, $className, $fields, $guid)
{
$sourcePath = PATH_DB . SYS_SYS . PATH_SEP . 'classes' . PATH_SEP;
$sourcePath = PATH_DB . config("system.workspace") . PATH_SEP . 'classes' . PATH_SEP;
@unlink($sourcePath . $className . '.php');
@unlink($sourcePath . $className . 'Peer.php');

View File

@@ -27,7 +27,7 @@ class System
public static function getTimeZone()
{
try {
$arraySystemConfiguration = PmSystem::getSystemConfiguration('', '', SYS_SYS);
$arraySystemConfiguration = PmSystem::getSystemConfiguration('', '', config("system.workspace"));
//Return
return $arraySystemConfiguration['time_zone'];

View File

@@ -1,4 +1,8 @@
<?php
use Illuminate\Session\TokenMismatchException;
use Illuminate\Support\Str;
/**
* We will send a case note in the actions by email
* @param object $httpData
@@ -251,8 +255,8 @@ function getVarsGrid($proUid, $dynUid)
$dynaformFields = array();
if (is_file(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') && filesize(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') > 0) {
$dyn = new dynaFormHandler(PATH_DATA . '/sites/' . SYS_SYS . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml');
if (is_file(PATH_DATA . '/sites/' . config("system.workspace") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') && filesize(PATH_DATA . '/sites/' . config("system.workspace") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml') > 0) {
$dyn = new dynaFormHandler(PATH_DATA . '/sites/' . config("system.workspace") . '/xmlForms/' . $proUid . '/' . $dynUid . '.xml');
$dynaformFields[] = $dyn->getFields();
}
@@ -361,3 +365,46 @@ function eprintln ($s = "", $c = null)
print "$s\n";
}
}
/**
* Initialize the user logged session
*/
function initUserSession($usrUid, $usrName)
{
$_SESSION['USER_LOGGED'] = $usrUid;
$_SESSION['USR_USERNAME'] = $usrName;
$_SESSION['USR_CSRF_TOKEN'] = Str::random(40);
}
/**
* Verify token for an incoming request.
*
* @param type $request
* @throws TokenMismatchException
*/
function verifyCsrfToken($request)
{
$headers = getallheaders();
$token = isset($request['_token'])
? $request['_token']
: (isset($headers['X-CSRF-TOKEN'])
? $headers['X-CSRF-TOKEN']
: null);
$match = is_string($_SESSION['USR_CSRF_TOKEN'])
&& is_string($token)
&& !empty($_SESSION['USR_CSRF_TOKEN'])
&& hash_equals($_SESSION['USR_CSRF_TOKEN'], $token);
if (!$match) {
throw new TokenMismatchException();
}
}
/**
* Get the current user CSRF token.
*
* @return string
*/
function csrfToken()
{
return isset($_SESSION['USR_CSRF_TOKEN']) ? $_SESSION['USR_CSRF_TOKEN'] : '';
}