Merged in marcoAntonioNina/processmaker/BUG-15561 (pull request #811)

BUG-15561 Cambiar el algoritmo o metodo de cifrado... IMPROVEMENT
This commit is contained in:
Julio Cesar Laura Avendaño
2014-09-23 10:50:34 -04:00
23 changed files with 2174 additions and 1936 deletions

View File

@@ -1,5 +1,5 @@
<?php
require_once (PATH_PLUGINS . "enterprise" . PATH_SEP . "classes" . PATH_SEP . "class.enterpriseUtils.php");
require_once ("classes" . PATH_SEP . "class.enterpriseUtils.php");
if (!defined("PM_VERSION")) {
if (file_exists(PATH_METHODS . "login/version-pmos.php")) {
@@ -13,7 +13,7 @@ class enterpriseClass extends PMPlugin
{
public function __construct()
{
set_include_path(PATH_PLUGINS . 'enterprise' . PATH_SEPARATOR . get_include_path());
set_include_path(PATH_CORE . 'methods' . PATH_SEP . 'enterprise' . PATH_SEPARATOR . get_include_path());
}
public function getFieldsForPageSetup()
@@ -117,9 +117,48 @@ class enterpriseClass extends PMPlugin
}
}
}
public function setHashPassword ($object)
{
$type = array('md5', 'sha256');
if (!in_array($object->hash, $type)) {
throw new Exception( 'Type: ' . $object->hash. ' No valid.');
return false;
}
G::LoadClass( "configuration" );
$config = new Configurations();
$typeEncrypt = $config->getConfiguration('ENTERPRISE_SETTING_ENCRYPT', '');
if ($typeEncrypt == null) {
$typeEncrypt = array('current' => $object->hash, 'previous' => 'md5');
} else {
$typeEncrypt['previous'] = $typeEncrypt['current'];
$typeEncrypt['current'] = $object->hash;
}
if ($object->hash != $typeEncrypt['previous']) {
$config->aConfig = $typeEncrypt;
$config->saveConfig('ENTERPRISE_SETTING_ENCRYPT', '');
}
require_once 'classes/model/RbacUsersPeer.php';
require_once 'classes/model/UsersProperties.php';
$userProperty = new UsersProperties();
$criteria = new Criteria($object->workspace->dbInfo['DB_RBAC_NAME']);
$criteria->add(RbacUsersPeer::USR_STATUS, 0, Criteria::NOT_EQUAL);
$dataset = RbacUsersPeer::doSelectRS($criteria);
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
while ($dataset->next()) {
$row = $dataset->getRow();
$property = $userProperty->loadOrCreateIfNotExists($row['USR_UID'], array());
$property['USR_LOGGED_NEXT_TIME'] = 1;
$userProperty->update($property);
}
}
}
if (!class_exists("pmLicenseManager")) {
require_once (PATH_PLUGINS . 'enterprise/class.pmLicenseManager.php');
require_once ("classes" . PATH_SEP . "class.pmLicenseManager.php");
}

View File

@@ -43,8 +43,7 @@ define('PM_SINGLE_SIGN_ON', 1014);
define('PM_GET_CASES_AJAX_LISTENER', 1015);
define('PM_BEFORE_CREATE_USER', 1016);
define('PM_AFTER_LOGIN', 1017);
define('PM_HASH_PASSWORD', 1018);
/**
* @package workflow.engine.classes

View File

@@ -985,7 +985,7 @@ class PMPluginRegistry
$classFile = '';
foreach ($this->_aFolders as $row => $folder) {
$fname = PATH_PLUGINS . $folder->sFolderName . PATH_SEP . 'class.' . $folder->sFolderName . '.php';
$fname = $folder->sNamespace == 'enterprise' ? PATH_CORE . 'classes' . PATH_SEP . 'class.' . $folder->sFolderName . '.php' : PATH_PLUGINS . $folder->sFolderName . PATH_SEP . 'class.' . $folder->sFolderName . '.php';
if ($detail->sNamespace == $folder->sNamespace && file_exists( $fname )) {
$found = true;
$classFile = $fname;
@@ -1021,11 +1021,12 @@ class PMPluginRegistry
if ($triggerId == $detail->sTriggerId) {
//review all folders registered for this namespace
foreach ($this->_aFolders as $row => $folder) {
$fname = PATH_PLUGINS . $folder->sFolderName . PATH_SEP . 'class.' . $folder->sFolderName . '.php';
$fname = $folder->sNamespace == 'enterprise' ? PATH_CORE . 'classes' . PATH_SEP . 'class.' . $folder->sFolderName . '.php' : PATH_PLUGINS . $folder->sFolderName . PATH_SEP . 'class.' . $folder->sFolderName . '.php';
if ($detail->sNamespace == $folder->sNamespace && file_exists( $fname )) {
$found = true;
}
}
}
}
return $found;

View File

@@ -1189,7 +1189,7 @@ class wsBase
$arrayData = array ();
$arrayData["USR_USERNAME"] = $userName;
$arrayData["USR_PASSWORD"] = md5( $password );
$arrayData["USR_PASSWORD"] = Bootstrap::hasPassword( $password );
$arrayData["USR_FIRSTNAME"] = $firstName;
$arrayData["USR_LASTNAME"] = $lastName;
$arrayData["USR_EMAIL"] = $email;
@@ -1380,7 +1380,7 @@ class wsBase
}
if (! empty( $password )) {
$arrayData["USR_PASSWORD"] = md5( $password );
$arrayData["USR_PASSWORD"] = Bootstrap::hasPassword( $password );
}
//Update user

View File

@@ -1624,5 +1624,12 @@ class workspaceTools
}
}
public function changeHashPassword ($workspace,$response) {
G::LoadClass("patch");
$this->initPropel( true );
$oPluginRegistry =& PMPluginRegistry::getSingleton();
$oPluginRegistry->executeTriggers ( PM_HASH_PASSWORD , $response );
}
}