PM-2835 "Adicionar los siguientes features..." SOLVED

Issue:
    Adicionar los siguientes features la posibilidad de seleccionarse en la licencia (features):
    - Code Scanner
    - Multiple Email Servers
    - Mobile Fields
Cause:
    Nueva validacion de licencia para features
Solution:
    - Se agrego validacion de licencia para los features especificados
    - Se completo el "Code Scanner" para procesos BPMN (import and triggers)
Note:
    QA debera hacer pruebas en procesos pm y pmx
This commit is contained in:
Victor Saisa Lopez
2015-06-05 15:44:28 -04:00
parent 788487f524
commit 617198ef17
7 changed files with 83 additions and 16 deletions

View File

@@ -124,6 +124,14 @@ function run_upgrade($command, $args)
$countWorkspace = 0;
$buildCacheView = array_key_exists("buildACV", $args);
foreach ($workspaces as $index => $workspace) {
if (!defined("SYS_SYS")) {
define("SYS_SYS", $workspace->name);
}
if (!defined("PATH_DATA_SITE")) {
define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP);
}
try {
$countWorkspace++;
CLI::logging("Upgrading workspaces ($countWorkspace/$count): " . CLI::info($workspace->name) . "\n");

View File

@@ -324,6 +324,14 @@ function database_upgrade($command, $args) {
$workspaces = get_workspaces_from_args($args);
$checkOnly = (strcmp($command, "check") == 0);
foreach ($workspaces as $workspace) {
if (!defined("SYS_SYS")) {
define("SYS_SYS", $workspace->name);
}
if (!defined("PATH_DATA_SITE")) {
define("PATH_DATA_SITE", PATH_DATA . "sites" . PATH_SEP . SYS_SYS . PATH_SEP);
}
if ($checkOnly)
print_r("Checking database in ".pakeColor::colorize($workspace->name, "INFO")."\n");
else

View File

@@ -148,7 +148,7 @@ class PMLicensedFeatures
"version" => ""
),
7 => array(
"description" => "-",
"description" => "Enables the code scanner feature.",
"enabled" => false,
"id" => "codeScanner",
"latest_version" => "",
@@ -165,7 +165,7 @@ class PMLicensedFeatures
"version" => ""
),
8 => array(
"description" => "-",
"description" => "Enables the multiple email configuration feature.",
"enabled" => false,
"id" => "multipleEmailServers",
"latest_version" => "",
@@ -182,7 +182,7 @@ class PMLicensedFeatures
"version" => ""
),
9 => array(
"description" => "-",
"description" => "Enables the mobile fields.",
"enabled" => false,
"id" => "mobileFields",
"latest_version" => "",

View File

@@ -29,19 +29,41 @@ ini_set("max_execution_time", 0);
/*----------------------------------********---------------------------------*/
if (PMLicensedFeatures::getSingleton()->verifyfeature("B0oWlBLY3hHdWY0YUNpZEtFQm5CeTJhQlIwN3IxMEkwaG4=") &&
isset($_FILES["PROCESS_FILENAME"]) &&
pathinfo($_FILES["PROCESS_FILENAME"]["name"], PATHINFO_EXTENSION) == "pm" &&
$_FILES["PROCESS_FILENAME"]["error"] == 0
$_FILES["PROCESS_FILENAME"]["error"] == 0 &&
preg_match("/^(?:pm|pmx)$/", pathinfo($_FILES["PROCESS_FILENAME"]["name"], PATHINFO_EXTENSION))
) {
//Check disabled code
$response = array();
try {
$fh = fopen($_FILES["PROCESS_FILENAME"]["tmp_name"], "rb");
$content = fread($fh, (int)(fread($fh, 9)));
$data = unserialize($content);
fclose($fh);
$arrayTrigger = array();
$projectTitle = "";
if (is_object($data) && isset($data->triggers) && is_array($data->triggers) && !empty($data->triggers)) {
switch (pathinfo($_FILES["PROCESS_FILENAME"]["name"], PATHINFO_EXTENSION)) {
case "pm":
$fh = fopen($_FILES["PROCESS_FILENAME"]["tmp_name"], "rb");
$content = fread($fh, (int)(fread($fh, 9)));
$data = unserialize($content);
fclose($fh);
if (is_object($data) && isset($data->triggers) && is_array($data->triggers) && !empty($data->triggers)) {
$arrayTrigger = $data->triggers;
$projectTitle = $data->process["PRO_TITLE"];
}
break;
case "pmx":
$importer = new XmlImporter();
$data = $importer->load($_FILES["PROCESS_FILENAME"]["tmp_name"]);
if (isset($data["tables"]["workflow"]["triggers"]) && is_array($data["tables"]["workflow"]["triggers"]) && !empty($data["tables"]["workflow"]["triggers"])) {
$arrayTrigger = $data["tables"]["workflow"]["triggers"];
$projectTitle = $data["tables"]["bpmn"]["project"][0]["prj_name"];
}
break;
}
if (!empty($arrayTrigger)) {
G::LoadClass("codeScanner");
$arraySystemConfiguration = System::getSystemConfiguration(PATH_CONFIG . "env.ini");
@@ -50,7 +72,7 @@ if (PMLicensedFeatures::getSingleton()->verifyfeature("B0oWlBLY3hHdWY0YUNpZEtFQm
$strFoundDisabledCode = "";
foreach ($data->triggers as $value) {
foreach ($arrayTrigger as $value) {
$arrayTriggerData = $value;
$arrayFoundDisabledCode = $cs->checkDisabledCode("SOURCE", $arrayTriggerData["TRI_WEBBOT"]);
@@ -69,7 +91,7 @@ if (PMLicensedFeatures::getSingleton()->verifyfeature("B0oWlBLY3hHdWY0YUNpZEtFQm
if ($strFoundDisabledCode != "") {
$response["status"] = "DISABLED-CODE";
$response["success"] = true;
$response["message"] = G::LoadTranslation("ID_DISABLED_CODE_PROCESS", array($data->process["PRO_TITLE"], "\n" . $strFoundDisabledCode));
$response["message"] = G::LoadTranslation("ID_DISABLED_CODE_PROCESS", array($projectTitle, "\n" . $strFoundDisabledCode));
echo G::json_encode($response);
exit(0);
@@ -444,5 +466,5 @@ if ($action == "uploadFileNewProcessExist") {
}
echo G::json_encode( $result );
exit();
exit(0);

View File

@@ -181,6 +181,31 @@ class Trigger
}
}
/*----------------------------------********---------------------------------*/
if (\PMLicensedFeatures::getSingleton()->verifyfeature("B0oWlBLY3hHdWY0YUNpZEtFQm5CeTJhQlIwN3IxMEkwaG4=") &&
isset($dataTrigger["TRI_WEBBOT"])
) {
//Check disabled code
\G::LoadClass("codeScanner");
$arraySystemConfiguration = \System::getSystemConfiguration(PATH_CONFIG . "env.ini");
$cs = new \CodeScanner((isset($arraySystemConfiguration["enable_blacklist"]) && (int)($arraySystemConfiguration["enable_blacklist"]) == 1)? "DISABLED_CODE" : "");
$arrayFoundDisabledCode = $cs->checkDisabledCode("SOURCE", $dataTrigger["TRI_WEBBOT"]);
if (!empty($arrayFoundDisabledCode)) {
$strCodeAndLine = "";
foreach ($arrayFoundDisabledCode["source"] as $key => $value) {
$strCodeAndLine .= (($strCodeAndLine != "")? ", " : "") . \G::LoadTranslation("ID_DISABLED_CODE_CODE_AND_LINE", array($key, implode(", ", $value)));
}
throw new \Exception(\G::LoadTranslation("ID_DISABLED_CODE_TRIGGER", array($strCodeAndLine)));
}
}
/*----------------------------------********---------------------------------*/
$dataTrigger['PRO_UID'] = $sProcessUID;
$oTrigger = new \Triggers();
if ($create) {

View File

@@ -27,7 +27,7 @@ abstract class Importer
const IMPORT_STAT_INVALID_SOURCE_FILE = 102; //Error, Invalid file type or the file have corrupt data.
const IMPORT_STAT_GROUP_ALREADY_EXISTS = 105; //Error, Group already exists.
public abstract function load();
public abstract function load($filename = null);
/**
* Verify if exists reserved words SQL

View File

@@ -24,9 +24,13 @@ class XmlImporter extends Importer
* )
* @throws \Exception
*/
public function load()
public function load($filename = null)
{
$this->dom->load($this->filename);
if (!is_null($filename) && !file_exists($filename)) {
throw new \Exception(\G::LoadTranslation("ID_INVALID_FILE"));
}
$this->dom->load((is_null($filename))? $this->filename : $filename);
$this->root = $this->dom->documentElement;
// validate version