Merge branch 'master' of bitbucket.org:colosa/processmaker into master-core

This commit is contained in:
Freddy Daniel Rojas Valda
2014-12-03 14:00:29 -04:00
9 changed files with 146 additions and 31 deletions

View File

@@ -315,6 +315,15 @@ class RBAC
*/ */
public function VerifyLogin ($strUser, $strPass) public function VerifyLogin ($strUser, $strPass)
{ {
/*----------------------------------********---------------------------------*/
if (!class_exists('pmLicenseManager')) {
G::LoadClass('pmLicenseManager');
}
$licenseManager =& pmLicenseManager::getSingleton();
if (in_array(md5($licenseManager->result), array('38afd7ae34bd5e3e6fc170d8b09178a3', 'ba2b45bdc11e2a4a6e86aab2ac693cbb'))) {
return -7;
}
/*----------------------------------********---------------------------------*/
if (strlen( $strPass ) == 0) { if (strlen( $strPass ) == 0) {
return - 2; return - 2;

View File

@@ -230,6 +230,9 @@ class Roles extends BaseRoles {
return $aRow; return $aRow;
} }
if (!isset($aData['ROL_NAME'])) {
$aData['ROL_NAME'] = '';
}
$rol_name = $aData['ROL_NAME']; $rol_name = $aData['ROL_NAME'];
unset($aData['ROL_NAME']); unset($aData['ROL_NAME']);
@@ -534,7 +537,7 @@ class Roles extends BaseRoles {
$rol = $this->load($ROL_UID); $rol = $this->load($ROL_UID);
$oUsersRbac = new RbacUsers(); $oUsersRbac = new RbacUsers();
$user = $oUsersRbac->load($USR_UID); $user = $oUsersRbac->load($USR_UID);
G::auditLog("DeleteUserToRole", "Delete user ".$user['USR_USERNAME']." (".$USR_UID.") to Role ".$rol['ROL_NAME']." (".$ROL_UID.") "); G::auditLog("DeleteUserToRole", "Delete user ".$user['USR_USERNAME']." (".$USR_UID.") to Role ".$rol['ROL_NAME']." (".$ROL_UID.") ");
} }
@@ -647,7 +650,7 @@ class Roles extends BaseRoles {
$o->setPerUid($PER_UID); $o->setPerUid($PER_UID);
$permission = $o->getPermissionName($PER_UID); $permission = $o->getPermissionName($PER_UID);
$role = $this->load($ROL_UID); $role = $this->load($ROL_UID);
G::auditLog("DeletePermissionToRole", "Delete Permission ".$permission." (".$PER_UID.") from Role ".$role['ROL_NAME']." (".$ROL_UID.") "); G::auditLog("DeletePermissionToRole", "Delete Permission ".$permission." (".$PER_UID.") from Role ".$role['ROL_NAME']." (".$ROL_UID.") ");
} }

View File

@@ -45,7 +45,6 @@ class pmLicenseManager
$application->set_server_vars($server_array); $application->set_server_vars($server_array);
$application->DATE_STRING = 'Y-m-d H:i:s'; $application->DATE_STRING = 'Y-m-d H:i:s';
$results = $application->validate(); $results = $application->validate();
$application->make_secure();
$validStatus = array( $validStatus = array(
'OK', 'OK',
'EXPIRED', 'EXPIRED',
@@ -116,7 +115,7 @@ class pmLicenseManager
public static function getSingleton() public static function getSingleton()
{ {
if (self::$instance == null) { if (self::$instance == null) {
self::$instance = new pmLicenseManager (); self::$instance = new pmLicenseManager();
} }
return self::$instance; return self::$instance;
} }
@@ -354,7 +353,7 @@ class pmLicenseManager
} }
} }
public function installLicense($path, $redirect = true) public function installLicense($path, $redirect = true, $includeExpired = true)
{ {
$application = new license_application ( $path, false, true, false, true, true ); $application = new license_application ( $path, false, true, false, true, true );
@@ -362,6 +361,14 @@ class pmLicenseManager
//if the result is ok then it is saved into DB //if the result is ok then it is saved into DB
$res = $results ['RESULT']; $res = $results ['RESULT'];
if ($res == 'EMPTY') {
return false;
}
if (!$includeExpired) {
if ($res == 'EXPIRED') {
return false;
}
}
if (( $res != 'OK') && ($res != 'EXPIRED' ) && ($res != 'TMINUS') ) { if (( $res != 'OK') && ($res != 'EXPIRED' ) && ($res != 'TMINUS') ) {
G::SendTemporalMessage ( 'ID_ISNT_LICENSE', 'tmp-info', 'labels' ); G::SendTemporalMessage ( 'ID_ISNT_LICENSE', 'tmp-info', 'labels' );
return false; return false;
@@ -382,21 +389,6 @@ class pmLicenseManager
*/ */
public function getActiveLicense() public function getActiveLicense()
{ {
//Autoinstall license if exists in data folder and move to license folder
$dirData = PATH_DATA;
$dirDataSite = PATH_DATA_SITE;
$dirDataSiteLic = PATH_DATA_SITE . "licenses";
G::verifyPath($dirDataSiteLic, true);
$licfile = glob($dirDataSite . "*.dat");
if (count($licfile) > 0 && is_file($licfile[0])) {
$file = $licfile[0];
@copy($file, $dirDataSiteLic . PATH_SEP . basename($file));
$this->installLicense($dirDataSiteLic . PATH_SEP . basename($file), false);
@unlink($file);
}
//get license from database, table LICENSE_MANAGER //get license from database, table LICENSE_MANAGER
try { try {
$aRow = array(); $aRow = array();

View File

@@ -92,6 +92,9 @@ try {
case -6: case -6:
$errLabel = 'ID_ROLE_INACTIVE'; $errLabel = 'ID_ROLE_INACTIVE';
break; break;
case -7:
$errLabel = 'ID_LECA';
break;
} }
//to avoid empty string in user field. This will avoid a weird message "this row doesn't exist" //to avoid empty string in user field. This will avoid a weird message "this row doesn't exist"

View File

@@ -0,0 +1,77 @@
<?php
$aInfoLoadFile = array();
$aInfoLoadFile['name'] = $_FILES['form']['name']['licenseFile'];
$aInfoLoadFile['tmp_name'] = $_FILES['form']['tmp_name']['licenseFile'];
$aux = pathinfo($aInfoLoadFile['name']);
//validating the extention before to upload it
if ($aux['extension'] != 'dat') {
G::SendTemporalMessage('ID_WARNING_ENTERPRISE_LICENSE_MSG_DAT', 'warning');
} else {
$dir = PATH_DATA_SITE;
G::uploadFile($aInfoLoadFile["tmp_name"], $dir, $aInfoLoadFile["name"]);
//reading the file that was uploaded
if (!class_exists('pmLicenseManager')) {
G::LoadClass('pmLicenseManager');
}
$licenseManager =& pmLicenseManager::getSingleton();
$response = $licenseManager->installLicense($dir . $aInfoLoadFile["name"], false, false);
if ($response) {
$licenseManager = new pmLicenseManager();
preg_match("/^license_(.*).dat$/", $licenseManager->file, $matches);
$realId = urlencode($matches[1]);
$addonLocation = "http://{$licenseManager->server}/syspmLicenseSrv/en/green/services/addonsStore?action=getInfo&licId=$realId";
///////
$cnn = Propel::getConnection("workflow");
$oCriteriaSelect = new Criteria("workflow");
$oCriteriaSelect->add(AddonsStorePeer::STORE_ID, $licenseManager->id);
$oCriteriaUpdate = new Criteria("workflow");
$oCriteriaUpdate->add(AddonsStorePeer::STORE_ID, $licenseManager->id);
$oCriteriaUpdate->add(AddonsStorePeer::STORE_LOCATION, $addonLocation);
BasePeer::doUpdate($oCriteriaSelect, $oCriteriaUpdate, $cnn);
//plugin.singleton //are all the plugins that are enabled in the SYS_SYS
$pluginRegistry = &PMPluginRegistry::getSingleton();
$arrayAddon = array();
//ee //all plugins enterprise installed in /processmaker/workflow/engine/plugins (no matter if they are enabled/disabled)
if (file_exists(PATH_DATA_SITE . "ee")) {
$arrayAddon = unserialize(trim(file_get_contents(PATH_DATA_SITE . "ee")));
}
foreach ($arrayAddon as $addon) {
$sFileName = substr($addon["sFilename"], 0, strpos($addon["sFilename"], "-"));
if (file_exists(PATH_PLUGINS . $sFileName . ".php")) {
$addonDetails = $pluginRegistry->getPluginDetails($sFileName . ".php");
$enabled = 0;
if ($addonDetails) {
$enabled = ($addonDetails->enabled)? 1 : 0;
}
if ($enabled == 1 && !in_array($sFileName, $licenseManager->features)) {
require_once (PATH_PLUGINS . $sFileName . ".php");
$pluginRegistry->disablePlugin($sFileName);
}
}
}
file_put_contents(PATH_DATA_SITE . "plugin.singleton", $pluginRegistry->serializeInstance());
G::SendTemporalMessage('ID_NLIC', 'info');
} else {
G::SendTemporalMessage('ID_WARNING_ENTERPRISE_LICENSE_MSG', 'warning');
}
}
G::header('Location: ../login/login');
die();

View File

@@ -22,12 +22,13 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
//Browser Compatibility
$browserSupported = G::checkBrowserCompatibility(); //Browser Compatibility
if ($browserSupported==false){ $browserSupported = G::checkBrowserCompatibility();
if(!isset($_SESSION['G_MESSAGE']) || $_SESSION['G_MESSAGE'] == ""){ if ($browserSupported==false){
G::SendTemporalMessage ('ID_CURRENT_BROWSER_NOT_SUPPORTED', 'warning'); if(!isset($_SESSION['G_MESSAGE']) || $_SESSION['G_MESSAGE'] == ""){
} G::SendTemporalMessage ('ID_CURRENT_BROWSER_NOT_SUPPORTED', 'warning');
}
} }
$aFields = array(); $aFields = array();
@@ -134,6 +135,19 @@ $_SESSION['FAILED_LOGINS'] = $sFailedLogins;
$_SESSION["USERNAME_PREVIOUS1"] = $usernamePrevious1; $_SESSION["USERNAME_PREVIOUS1"] = $usernamePrevious1;
$_SESSION["USERNAME_PREVIOUS2"] = $usernamePrevious2; $_SESSION["USERNAME_PREVIOUS2"] = $usernamePrevious2;
/*----------------------------------********---------------------------------*/
if (!class_exists('pmLicenseManager')) {
G::LoadClass('pmLicenseManager');
}
$licenseManager =& pmLicenseManager::getSingleton();
if (in_array(md5($licenseManager->result), array('38afd7ae34bd5e3e6fc170d8b09178a3', 'ba2b45bdc11e2a4a6e86aab2ac693cbb'))) {
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/licenseExpired', '', array(), 'licenseUpdate');
G::RenderPage('publish');
die();
}
/*----------------------------------********---------------------------------*/
//translation //translation
//$Translations = G::getModel("Translation"); //$Translations = G::getModel("Translation");
//require_once "classes/model/Translation.php"; //require_once "classes/model/Translation.php";

View File

@@ -833,6 +833,10 @@ Ext.onReady(function() {
sw = 0; sw = 0;
msg = _('ID_SELECT_PLUGIN'); msg = _('ID_SELECT_PLUGIN');
} }
if (Ext.getCmp("PLUGIN_FILENAME").value.indexOf('enterprise-') > -1) {
sw = 0;
msg = _('ID_ENTERPRISE_PACK_CANT_UPLOAD');
}
if (sw == 1) { if (sw == 1) {
swReloadTask = 0; swReloadTask = 0;
@@ -913,7 +917,7 @@ Ext.onReady(function() {
} }
] ]
}); });
var pnlSupport = new Ext.FormPanel({ var pnlSupport = new Ext.FormPanel({
frame: true, frame: true,
height: 160, height: 160,
@@ -1539,7 +1543,7 @@ Ext.onReady(function() {
"cellclick": function (grid, rowIndex, columnIndex, e) { "cellclick": function (grid, rowIndex, columnIndex, e) {
var record = grid.getStore().getAt(rowIndex); var record = grid.getStore().getAt(rowIndex);
var fieldName = grid.getColumnModel().getDataIndex(columnIndex); var fieldName = grid.getColumnModel().getDataIndex(columnIndex);
if (fieldName != "status") { if (fieldName != "status") {
return; return;
} }
@@ -1622,7 +1626,7 @@ Ext.onReady(function() {
); );
addonsGrid.addListener("rowcontextmenu", onMessageMnuContext, this); addonsGrid.addListener("rowcontextmenu", onMessageMnuContext, this);
addonsFeatureGrid.on("rowcontextmenu", addonsFeatureGrid.on("rowcontextmenu",
function (grid, rowIndex, evt) { function (grid, rowIndex, evt) {
var sm = grid.getSelectionModel(); var sm = grid.getSelectionModel();
@@ -1630,7 +1634,7 @@ Ext.onReady(function() {
}, },
this this
); );
addonsFeatureGrid.addListener("rowcontextmenu", onMessageMnuContext, this); addonsFeatureGrid.addListener("rowcontextmenu", onMessageMnuContext, this);
/////// ///////

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm type="xmlform" name="login/licenseExpired" width="450" enabletemplate="0">
<thetitle type="title" required="0" readonly="0" optgroup="0">
<en><![CDATA[Your license has expired or the System does not have a license. To use the ProcessMaker Enterprise Edition upload a valid license]]></en>
</thetitle>
<licenseFile type="file" required="1" readonly="0" optgroup="0">
<en>License File</en>
</licenseFile>
<updateButton type="submit" required="0" readonly="0" optgroup="0">
<en>Update License</en>
</updateButton>
</dynaForm>

View File

@@ -892,7 +892,8 @@ if (! defined( 'EXECUTE_BY_CRON' )) {
$noLoginFiles[] = 'cases_NextStep'; $noLoginFiles[] = 'cases_NextStep';
$noLoginFiles[] = 'genericAjax'; $noLoginFiles[] = 'genericAjax';
$noLoginFiles[] = 'casesSaveDataView'; $noLoginFiles[] = 'casesSaveDataView';
$noLoginFiles[] = "propelTableAjax"; $noLoginFiles[] = 'propelTableAjax';
$noLoginFiles[] = 'licenseUpdate';
$noLoginFolders[] = 'services'; $noLoginFolders[] = 'services';
$noLoginFolders[] = 'tracker'; $noLoginFolders[] = 'tracker';