PM-1036 Bloquear el acceso a ProcessMaker Enterprise cuando la licencia expira SOLVED

This commit is contained in:
Julio Cesar Laura
2014-12-03 13:42:09 -04:00
parent 1658317331
commit 6fbe1fd4d2
7 changed files with 57 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']);

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

@@ -22,6 +22,7 @@
* Coral Gables, FL, 33134, USA, or email info@colosa.com. * Coral Gables, FL, 33134, USA, or email info@colosa.com.
* *
*/ */
//Browser Compatibility //Browser Compatibility
$browserSupported = G::checkBrowserCompatibility(); $browserSupported = G::checkBrowserCompatibility();
if ($browserSupported==false){ if ($browserSupported==false){
@@ -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;

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';