HOR-2019
HOR-2019
This commit is contained in:
@@ -93,17 +93,36 @@ class ProcessUser extends BaseProcessUser
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateUserAccess($proUid, $usrUid, $type)
|
public function validateUserAccess($proUid, $usrUid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$oCriteria = new Criteria();
|
$oCriteria = new Criteria();
|
||||||
$oCriteria->add( ProcessUserPeer::PRO_UID, $proUid );
|
$oCriteria->add( ProcessUserPeer::PRO_UID, $proUid );
|
||||||
|
$oCriteria->add( ProcessUserPeer::PU_TYPE, 'SUPERVISOR' );
|
||||||
$oCriteria->add( ProcessUserPeer::USR_UID, $usrUid );
|
$oCriteria->add( ProcessUserPeer::USR_UID, $usrUid );
|
||||||
$oCriteria->add( ProcessUserPeer::PU_TYPE, $type );
|
$dataset = ProcessUserPeer::doSelectRS( $oCriteria );
|
||||||
$data = ProcessUserPeer::doSelectOne( $oCriteria );
|
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
if (! is_null( $data )) {
|
//If the user is in Assigned supervisors list
|
||||||
|
if($dataset->next()){
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
//If the user is in a group in Assigned supervisors list
|
||||||
|
$oCriteria = new Criteria();
|
||||||
|
$oCriteria->add( ProcessUserPeer::PRO_UID, $proUid );
|
||||||
|
$oCriteria->add( ProcessUserPeer::PU_TYPE, 'GROUP_SUPERVISOR');
|
||||||
|
$dataset = ProcessUserPeer::doSelectRS( $oCriteria );
|
||||||
|
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||||
|
$oGroups = new Groups();
|
||||||
|
$aGroups = $oGroups->getActiveGroupsForAnUser($usrUid);
|
||||||
|
while ($dataset->next()) {
|
||||||
|
$row = $dataset->getRow();
|
||||||
|
$groupUid = $row['USR_UID'];
|
||||||
|
if (in_array($groupUid, $aGroups)) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (Exception $oError) {
|
} catch (Exception $oError) {
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ while ($rsCriteria->next()) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$processUser = new ProcessUser();
|
$processUser = new ProcessUser();
|
||||||
$userAccess = $processUser->validateUserAccess($aFields['PRO_UID'], $_SESSION['USER_LOGGED'], 'SUPERVISOR');
|
$userAccess = $processUser->validateUserAccess($aFields['PRO_UID'], $_SESSION['USER_LOGGED']);
|
||||||
if(!$userAccess) {
|
if(!$userAccess) {
|
||||||
$flag = false;
|
$flag = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ switch ($RBAC->userCanAccess( 'PM_SUPERVISOR' )) {
|
|||||||
|
|
||||||
//If the user does not have the permission and the user can be access from url
|
//If the user does not have the permission and the user can be access from url
|
||||||
$processUser = new ProcessUser();
|
$processUser = new ProcessUser();
|
||||||
$userAccess = $processUser->validateUserAccess($_GET['PRO_UID'], $_SESSION['USER_LOGGED'], 'SUPERVISOR');
|
$userAccess = $processUser->validateUserAccess($_GET['PRO_UID'], $_SESSION['USER_LOGGED']);
|
||||||
if(!$userAccess) {
|
if(!$userAccess) {
|
||||||
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
|
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
|
||||||
G::header( 'location: ../login/login' );
|
G::header( 'location: ../login/login' );
|
||||||
@@ -59,10 +59,6 @@ if ((int) $_SESSION['INDEX'] < 1) {
|
|||||||
G::LoadClass( 'case' );
|
G::LoadClass( 'case' );
|
||||||
G::LoadClass( 'derivation' );
|
G::LoadClass( 'derivation' );
|
||||||
|
|
||||||
/* GET , POST & $_SESSION Vars */
|
|
||||||
//$_SESSION['STEP_POSITION'] = (int)$_GET['POSITION'];
|
|
||||||
|
|
||||||
|
|
||||||
/* Menues */
|
/* Menues */
|
||||||
$G_MAIN_MENU = 'processmaker';
|
$G_MAIN_MENU = 'processmaker';
|
||||||
$G_SUB_MENU = 'cases';
|
$G_SUB_MENU = 'cases';
|
||||||
|
|||||||
Reference in New Issue
Block a user