Permission

HOR-1720

HOR-1720

.
This commit is contained in:
Paula V. Quispe
2016-08-29 10:12:08 -04:00
parent 593eb6df6b
commit 70dd6bae4e
11 changed files with 213 additions and 85 deletions

View File

@@ -57,6 +57,22 @@ if(isset($_REQUEST['action']) && $_REQUEST['action'] == "verifySession" ) {
die();
} else {
$response = new stdclass();
//Check if the user is a supervisor to this Process
GLOBAL $RBAC;
if($RBAC->userCanAccess('PM_REASSIGNCASE') == 1){
$response->reassigncase = true;
$response->message = '';
} elseif ($RBAC->userCanAccess('PM_REASSIGNCASE_SUPERVISOR') == 1) {
$response->reassigncase = false;
$response->message = G::LoadTranslation('ID_NOT_ABLE_REASSIGN');
$oAppCache = new AppCacheView();
$aProcesses = $oAppCache->getProUidSupervisor($_SESSION['USER_LOGGED']);
if(in_array($_SESSION['PROCESS'], $aProcesses)){
$response->reassigncase = true;
}
}
print G::json_encode( $response );
die();
}
@@ -193,7 +209,7 @@ class Ajax
$options[] = Array('text' => G::LoadTranslation('ID_DELETE'), 'fn' => 'deleteCase');
if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1) {
if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1 || $RBAC->userCanAccess('PM_REASSIGNCASE_SUPERVISOR') == 1) {
if (!AppDelay::isPaused($_SESSION['APPLICATION'], $_SESSION['INDEX'])) {
$options[] = Array('text' => G::LoadTranslation('ID_REASSIGN'), 'fn' => 'getUsersToReassign');
}
@@ -212,7 +228,7 @@ class Ajax
} else {
$options[] = Array('text' => G::LoadTranslation('ID_UNPAUSE'), 'fn' => 'unpauseCase');
}
if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1 || $RBAC->userCanAccess('PM_SUPERVISOR') == 1) {
if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1 || $RBAC->userCanAccess('PM_REASSIGNCASE_SUPERVISOR') == 1) {
if (!AppDelay::isPaused($_SESSION['APPLICATION'], $_SESSION['INDEX'])) {
$options[] = Array('text' => G::LoadTranslation('ID_REASSIGN'), 'fn' => 'getUsersToReassign');
}

View File

@@ -189,9 +189,10 @@ if ($licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjB
//menu permissions
$cnt = '';
$menuPerms = '';
$menuPerms = $menuPerms . ($RBAC->userCanAccess( 'PM_REASSIGNCASE' ) == 1) ? 'R' : ''; //can reassign case
$oHeadPublisher->assign( '___p34315105', $menuPerms ); // user menu permissions
$reassignCase = ($RBAC->userCanAccess( 'PM_REASSIGNCASE' ) == 1) ? 'true' : 'false';
$reassignCaseSup = ($RBAC->userCanAccess( 'PM_REASSIGNCASE_SUPERVISOR' ) == 1) ? 'true':'false';
$oHeadPublisher->assign( 'varReassignCase', $reassignCase );
$oHeadPublisher->assign( 'varReassignCaseSupervisor', $reassignCaseSup );
G::LoadClass( 'configuration' );
$c = new Configurations();
$oHeadPublisher->addExtJsScript( 'app/main', true );

View File

@@ -144,6 +144,21 @@ if ($actionAjax == "processListExtJs") {
$cProcess->addAnd($filters);
}
if($action==='to_revise') {
$oAppCache = new AppCacheView();
$aProcesses = $oAppCache->getProUidSupervisor($_SESSION['USER_LOGGED']);
$cProcess->add(ProcessPeer::PRO_UID, $aProcesses, Criteria::IN);
}
if($action==='to_reassign') {
if($RBAC->userCanAccess('PM_REASSIGNCASE') == 1) {
} elseif($RBAC->userCanAccess('PM_REASSIGNCASE_SUPERVISOR') == 1) {
$oAppCache = new AppCacheView();
$aProcesses = $oAppCache->getProUidSupervisor($_SESSION['USER_LOGGED']);
$cProcess->add(ProcessPeer::PRO_UID, $aProcesses, Criteria::IN);
}
}
$cProcess->addAscendingOrderByColumn(ProcessPeer::PRO_TITLE);
$oDataset = ProcessPeer::doSelectRS($cProcess);
@@ -156,6 +171,34 @@ if ($actionAjax == "processListExtJs") {
return print G::json_encode($processes);
}
if ($actionAjax == "verifySession") {
if (!isset($_SESSION['USER_LOGGED'])) {
$response = new stdclass();
$response->message = G::LoadTranslation('ID_LOGIN_AGAIN');
$response->lostSession = true;
print G::json_encode( $response );
die();
} else {
$response = new stdclass();
GLOBAL $RBAC;
//Check if the user is a supervisor to this Process
if($RBAC->userCanAccess('PM_REASSIGNCASE') == 1){
$response->reassigncase = true;
$response->message = '';
$response->processeslist = '';
} elseif ($RBAC->userCanAccess('PM_REASSIGNCASE_SUPERVISOR') == 1) {
$response->reassigncase = true;
$response->message = G::LoadTranslation('ID_NOT_ABLE_REASSIGN');
$oAppCache = new AppCacheView();
$aProcesses = $oAppCache->getProUidSupervisor($_SESSION['USER_LOGGED']);
$response->processeslist = G::json_encode( $aProcesses );
}
print G::json_encode( $response );
die();
}
}
if ($actionAjax == "getUsersToReassign") {
$taskUid = $_POST['taskUid'];
$search = $_POST['search'];