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

@@ -45,7 +45,6 @@ class pmLicenseManager
$application->set_server_vars($server_array);
$application->DATE_STRING = 'Y-m-d H:i:s';
$results = $application->validate();
$application->make_secure();
$validStatus = array(
'OK',
'EXPIRED',
@@ -116,7 +115,7 @@ class pmLicenseManager
public static function getSingleton()
{
if (self::$instance == null) {
self::$instance = new pmLicenseManager ();
self::$instance = new pmLicenseManager();
}
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 );
@@ -362,6 +361,14 @@ class pmLicenseManager
//if the result is ok then it is saved into DB
$res = $results ['RESULT'];
if ($res == 'EMPTY') {
return false;
}
if (!$includeExpired) {
if ($res == 'EXPIRED') {
return false;
}
}
if (( $res != 'OK') && ($res != 'EXPIRED' ) && ($res != 'TMINUS') ) {
G::SendTemporalMessage ( 'ID_ISNT_LICENSE', 'tmp-info', 'labels' );
return false;
@@ -382,21 +389,6 @@ class pmLicenseManager
*/
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
try {
$aRow = array();