Merged in luisfernandosl/processmaker/PM-2113 (pull request #2707)
PM-2113 "REST endpoint GET /cases/advanced-search" SOLVED
This commit is contained in:
@@ -85,6 +85,12 @@ class Cases
|
|||||||
Validator::usrUid($dataList["userId"], "userId");
|
Validator::usrUid($dataList["userId"], "userId");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$user = new \ProcessMaker\BusinessModel\User();
|
||||||
|
|
||||||
|
if (!$user->checkPermission($dataList["userId"], "PM_ALLCASES")) {
|
||||||
|
throw new \Exception(\G::LoadTranslation("ID_CASE_USER_NOT_HAVE_PERMISSION", array($dataList["userId"])));
|
||||||
|
}
|
||||||
|
|
||||||
G::LoadClass("applications");
|
G::LoadClass("applications");
|
||||||
$solrEnabled = false;
|
$solrEnabled = false;
|
||||||
$userUid = $dataList["userId"];
|
$userUid = $dataList["userId"];
|
||||||
|
|||||||
@@ -1116,4 +1116,33 @@ class User
|
|||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check permission
|
||||||
|
*
|
||||||
|
* @param string $userUid Unique uid of User
|
||||||
|
* @param string $permissionCode Permission code
|
||||||
|
*
|
||||||
|
* return bool
|
||||||
|
*/
|
||||||
|
public function checkPermission($userUid, $permissionCode)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$flagPermission = false;
|
||||||
|
|
||||||
|
$arrayUserRolePermission = $this->loadUserRolePermission("PROCESSMAKER", $userUid);
|
||||||
|
|
||||||
|
foreach ($arrayUserRolePermission as $value) {
|
||||||
|
if ($value["PER_CODE"] == $permissionCode) {
|
||||||
|
$flagPermission = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Return
|
||||||
|
return $flagPermission;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user