Bug 0014738: Fix. Users with PM_SUPERVISOR permission are not display in the list of selection of supervisors
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
namespace ProcessMaker\BusinessModel;
|
namespace ProcessMaker\BusinessModel;
|
||||||
|
|
||||||
use \G;
|
use \G;
|
||||||
|
use Luracast\Restler\User;
|
||||||
|
|
||||||
class ProcessSupervisor
|
class ProcessSupervisor
|
||||||
{
|
{
|
||||||
@@ -201,13 +202,21 @@ class ProcessSupervisor
|
|||||||
$sDelimiter = \DBAdapter::getStringDelimiter();
|
$sDelimiter = \DBAdapter::getStringDelimiter();
|
||||||
$oCriteria = new \Criteria('workflow');
|
$oCriteria = new \Criteria('workflow');
|
||||||
$oCriteria->addSelectColumn(\UsersPeer::USR_UID);
|
$oCriteria->addSelectColumn(\UsersPeer::USR_UID);
|
||||||
|
$oCriteria->addSelectColumn(\UsersPeer::USR_ROLE);
|
||||||
$oCriteria->add(\UsersPeer::USR_UID, $aUIDS, \Criteria::NOT_IN);
|
$oCriteria->add(\UsersPeer::USR_UID, $aUIDS, \Criteria::NOT_IN);
|
||||||
$oDataset = \UsersPeer::doSelectRS($oCriteria);
|
$oDataset = \UsersPeer::doSelectRS($oCriteria);
|
||||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
$aUIDS = array();
|
$aUIDS = array();
|
||||||
while ($aRow = $oDataset->getRow()) {
|
while ($aRow = $oDataset->getRow()) {
|
||||||
$aUIDS [] = $aRow ['USR_UID'];
|
require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Roles.php");
|
||||||
|
$userRole = new \ProcessMaker\BusinessModel\User();
|
||||||
|
$permission = $userRole->loadUserRolePermission('PROCESSMAKER', $aRow['USR_UID']);
|
||||||
|
foreach ($permission as $key => $value) {
|
||||||
|
if ($value["PER_CODE"] == 'PM_SUPERVISOR') {
|
||||||
|
$aUIDS [] = $aRow ['USR_UID'];
|
||||||
|
}
|
||||||
|
}
|
||||||
$oDataset->next();
|
$oDataset->next();
|
||||||
}
|
}
|
||||||
$oCriteria = new \Criteria('workflow');
|
$oCriteria = new \Criteria('workflow');
|
||||||
@@ -218,7 +227,6 @@ class ProcessSupervisor
|
|||||||
$oCriteria->addSelectColumn(\UsersPeer::USR_EMAIL);
|
$oCriteria->addSelectColumn(\UsersPeer::USR_EMAIL);
|
||||||
$oCriteria->add(\UsersPeer::USR_UID, $aUIDS, \Criteria::IN);
|
$oCriteria->add(\UsersPeer::USR_UID, $aUIDS, \Criteria::IN);
|
||||||
$oCriteria->addAscendingOrderByColumn(\UsersPeer::USR_FIRSTNAME);
|
$oCriteria->addAscendingOrderByColumn(\UsersPeer::USR_FIRSTNAME);
|
||||||
$oCriteria->add(\UsersPeer::USR_ROLE, 'PROCESSMAKER_ADMIN', \Criteria::EQUAL);
|
|
||||||
$oCriteria->add(\UsersPeer::USR_STATUS, 'ACTIVE');
|
$oCriteria->add(\UsersPeer::USR_STATUS, 'ACTIVE');
|
||||||
$oDataset = \UsersPeer::doSelectRS($oCriteria);
|
$oDataset = \UsersPeer::doSelectRS($oCriteria);
|
||||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|||||||
@@ -210,34 +210,36 @@ class User
|
|||||||
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Users.php");
|
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Users.php");
|
||||||
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
||||||
$form = $arrayData;
|
$form = $arrayData;
|
||||||
if ($form['USR_REPLACED_BY'] != '') {
|
if (array_key_exists('USR_REPLACED_BY', $form)) {
|
||||||
$oReplacedBy = \UsersPeer::retrieveByPK($form['USR_REPLACED_BY']);
|
if ($form['USR_REPLACED_BY'] != '') {
|
||||||
if (is_null($oReplacedBy)) {
|
$oReplacedBy = \UsersPeer::retrieveByPK($form['USR_REPLACED_BY']);
|
||||||
throw new \Exception('usr_replaced_by:'.$form['USR_REPLACED_BY'].' '.\G::LoadTranslation('ID_AUTHENTICATION_SOURCE_INVALID'));
|
if (is_null($oReplacedBy)) {
|
||||||
|
throw new \Exception('usr_replaced_by:'.$form['USR_REPLACED_BY'].' '.\G::LoadTranslation('ID_AUTHENTICATION_SOURCE_INVALID'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($form['USR_COUNTRY'] != '') {
|
if (array_key_exists('USR_COUNTRY', $form)) {
|
||||||
$oCountry = \IsoCountryPeer::retrieveByPK($form['USR_COUNTRY']);
|
if ($form['USR_COUNTRY'] != '') {
|
||||||
if (is_null($oCountry)) {
|
$oCountry = \IsoCountryPeer::retrieveByPK($form['USR_COUNTRY']);
|
||||||
throw new \Exception('Invalid value for usr_country: '.$form['USR_COUNTRY']);
|
if (is_null($oCountry)) {
|
||||||
|
throw new \Exception('Invalid value for usr_country: '.$form['USR_COUNTRY']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($form['USR_CITY'] != '') {
|
if (array_key_exists('USR_CITY', $form)) {
|
||||||
$oCity = \IsoSubdivisionPeer::retrieveByPK($form['USR_COUNTRY'], $form['USR_CITY']);
|
if ($form['USR_CITY'] != '') {
|
||||||
if (is_null($oCity)) {
|
$oCity = \IsoSubdivisionPeer::retrieveByPK($form['USR_COUNTRY'], $form['USR_CITY']);
|
||||||
throw new \Exception('Invalid value for usr_city: '.$form['USR_CITY']);
|
if (is_null($oCity)) {
|
||||||
|
throw new \Exception('Invalid value for usr_city: '.$form['USR_CITY']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($form['USR_LOCATION'] != '') {
|
if (array_key_exists('USR_LOCATION', $form)) {
|
||||||
$oLocation = \IsoLocationPeer::retrieveByPK($form['USR_COUNTRY'], $form['USR_LOCATION']);
|
if ($form['USR_LOCATION'] != '') {
|
||||||
if (is_null($oLocation)) {
|
$oLocation = \IsoLocationPeer::retrieveByPK($form['USR_COUNTRY'], $form['USR_LOCATION']);
|
||||||
throw new \Exception('Invalid value for usr_location: '.$form['USR_LOCATION']);
|
if (is_null($oLocation)) {
|
||||||
}
|
throw new \Exception('Invalid value for usr_location: '.$form['USR_LOCATION']);
|
||||||
}
|
}
|
||||||
if ($form['USR_COUNTRY'] != '') {
|
|
||||||
$oReplacedBy = \IsoCountryPeer::retrieveByPK($form['USR_COUNTRY']);
|
|
||||||
if (is_null($oReplacedBy)) {
|
|
||||||
throw new \Exception('Invalid value for usr_country: '.$form['USR_COUNTRY']);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (isset($arrayData['USR_UID'])) {
|
if (isset($arrayData['USR_UID'])) {
|
||||||
@@ -245,14 +247,20 @@ class User
|
|||||||
} else {
|
} else {
|
||||||
$form['USR_UID'] = '';
|
$form['USR_UID'] = '';
|
||||||
}
|
}
|
||||||
$sConfirm = $this->testPassword($form['USR_NEW_PASS']);
|
if (array_key_exists('USR_NEW_PASS', $form)) {
|
||||||
if ($sConfirm['STATUS'] != 1) {
|
$sConfirm = $this->testPassword($form['USR_NEW_PASS']);
|
||||||
throw new \Exception('usr_new_pass. '.$sConfirm['DESCRIPTION']);
|
if ($sConfirm['STATUS'] != 1) {
|
||||||
|
throw new \Exception('usr_new_pass. '.$sConfirm['DESCRIPTION']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if ($form['USR_NEW_PASS'] != $form['USR_CNF_PASS']) {
|
if (array_key_exists('USR_NEW_PASS', $form)) {
|
||||||
throw new \Exception('usr_new_pass or usr_cnf_pass. '.\G::LoadTranslation('ID_NEW_PASS_SAME_OLD_PASS'));
|
if ($form['USR_NEW_PASS'] != $form['USR_CNF_PASS']) {
|
||||||
|
throw new \Exception('usr_new_pass or usr_cnf_pass. '.\G::LoadTranslation('ID_NEW_PASS_SAME_OLD_PASS'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (array_key_exists('USR_NEW_PASS', $form)) {
|
||||||
|
$form['USR_PASSWORD'] = md5($form['USR_NEW_PASS']);
|
||||||
}
|
}
|
||||||
$form['USR_PASSWORD'] = md5($form['USR_NEW_PASS']);
|
|
||||||
if (!isset($form['USR_CITY'])) {
|
if (!isset($form['USR_CITY'])) {
|
||||||
$form['USR_CITY'] = '';
|
$form['USR_CITY'] = '';
|
||||||
}
|
}
|
||||||
@@ -264,7 +272,11 @@ class User
|
|||||||
}
|
}
|
||||||
$criteria = new \Criteria();
|
$criteria = new \Criteria();
|
||||||
$criteria->addSelectColumn(\UsersPeer::USR_USERNAME);
|
$criteria->addSelectColumn(\UsersPeer::USR_USERNAME);
|
||||||
$criteria->add(\UsersPeer::USR_USERNAME, utf8_encode($arrayData['USR_USERNAME']));
|
if (array_key_exists('USR_USERNAME', $form)) {
|
||||||
|
$criteria->add(\UsersPeer::USR_USERNAME, utf8_encode($arrayData['USR_USERNAME']));
|
||||||
|
} else {
|
||||||
|
throw new \Exception('usr_name. '.\G::LoadTranslation('ID_MSG_ERROR_USR_USERNAME'));
|
||||||
|
}
|
||||||
if (\UsersPeer::doCount($criteria) > 0) {
|
if (\UsersPeer::doCount($criteria) > 0) {
|
||||||
throw new \Exception('usr_username. '.\G::LoadTranslation('ID_USERNAME_ALREADY_EXISTS', array('USER_ID' => $arrayData['USR_USERNAME'])));
|
throw new \Exception('usr_username. '.\G::LoadTranslation('ID_USERNAME_ALREADY_EXISTS', array('USER_ID' => $arrayData['USR_USERNAME'])));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user