Merged in feature/PMCORE-4079 (pull request #8654)

PMCORE-4079

Approved-by: Julio Cesar Laura Avendaño
This commit is contained in:
Luciana Nuñez
2022-12-05 19:14:55 +00:00
committed by Julio Cesar Laura Avendaño
2 changed files with 16 additions and 12 deletions

View File

@@ -3007,11 +3007,14 @@ class WsBase
}
if (!in_array($userIdTarget, $userList)) {
$result = new WsResponse(34, G::loadTranslation('ID_TARGET_USER_DOES_NOT_HAVE_RIGHTS'));
$g->sessionVarRestore();
return $result;
$bmCase = new BmCases();
if (!$bmCase->isSupervisor($userIdTarget, $rows['APP_NUMBER'])){
$result = new WsResponse(34, G::loadTranslation('ID_TARGET_USER_DOES_NOT_HAVE_RIGHTS'));
$g->sessionVarRestore();
return $result;
}
}
/**

View File

@@ -1162,16 +1162,17 @@ class Cases
$appDelegation = new AppDelegation();
$delegation = $appDelegation->load($appUid, $index);
if (empty($delegation['USR_UID'])) {
$case = new ClassesCases();
$case->loadCase($appUid);
$classesCase = new ClassesCases();
$case = $classesCase->loadCase($appUid);
//Review if the user can be claim the case
if (!$case->isSelfService($userUid, $delegation['TAS_UID'], $appUid)) {
$message = preg_replace("#<br\s*/?>#i", "", G::LoadTranslation("ID_NO_PERMISSION_NO_PARTICIPATED"));
throw new Exception($message);
if (!$classesCase->isSelfService($userUid, $delegation['TAS_UID'], $appUid)) {
if (!$this->isSupervisor($userUid, $case['APP_NUMBER'])){
$message = preg_replace("#<br\s*/?>#i", "", G::LoadTranslation("ID_NO_PERMISSION_NO_PARTICIPATED"));
throw new Exception($message);
}
}
$case->setCatchUser($appUid, $index, $userUid);
$classesCase->setCatchUser($appUid, $index, $userUid);
} else {
throw new Exception(G::LoadTranslation("ID_CASE_USER_INVALID_CLAIM_CASE", [$userUid]));
}