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 {
|
||||
$oCriteria = new Criteria();
|
||||
$oCriteria->add( ProcessUserPeer::PRO_UID, $proUid );
|
||||
$oCriteria->add( ProcessUserPeer::PU_TYPE, 'SUPERVISOR' );
|
||||
$oCriteria->add( ProcessUserPeer::USR_UID, $usrUid );
|
||||
$oCriteria->add( ProcessUserPeer::PU_TYPE, $type );
|
||||
$data = ProcessUserPeer::doSelectOne( $oCriteria );
|
||||
if (! is_null( $data )) {
|
||||
$dataset = ProcessUserPeer::doSelectRS( $oCriteria );
|
||||
$dataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
|
||||
//If the user is in Assigned supervisors list
|
||||
if($dataset->next()){
|
||||
return true;
|
||||
} 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;
|
||||
}
|
||||
} catch (Exception $oError) {
|
||||
|
||||
@@ -135,7 +135,7 @@ while ($rsCriteria->next()) {
|
||||
}
|
||||
|
||||
$processUser = new ProcessUser();
|
||||
$userAccess = $processUser->validateUserAccess($aFields['PRO_UID'], $_SESSION['USER_LOGGED'], 'SUPERVISOR');
|
||||
$userAccess = $processUser->validateUserAccess($aFields['PRO_UID'], $_SESSION['USER_LOGGED']);
|
||||
if(!$userAccess) {
|
||||
$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
|
||||
$processUser = new ProcessUser();
|
||||
$userAccess = $processUser->validateUserAccess($_GET['PRO_UID'], $_SESSION['USER_LOGGED'], 'SUPERVISOR');
|
||||
$userAccess = $processUser->validateUserAccess($_GET['PRO_UID'], $_SESSION['USER_LOGGED']);
|
||||
if(!$userAccess) {
|
||||
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
|
||||
G::header( 'location: ../login/login' );
|
||||
@@ -59,10 +59,6 @@ if ((int) $_SESSION['INDEX'] < 1) {
|
||||
G::LoadClass( 'case' );
|
||||
G::LoadClass( 'derivation' );
|
||||
|
||||
/* GET , POST & $_SESSION Vars */
|
||||
//$_SESSION['STEP_POSITION'] = (int)$_GET['POSITION'];
|
||||
|
||||
|
||||
/* Menues */
|
||||
$G_MAIN_MENU = 'processmaker';
|
||||
$G_SUB_MENU = 'cases';
|
||||
|
||||
Reference in New Issue
Block a user