Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
#813170
Hello,

I would like to search all cases in specific processes (including drafts and completed cases), which can be achieved using the Advanced Search functionality.
However, the Advanced Search requires the PM_ALLCASES permission which gives access to the list of all cases of all users in the current workspace.
Is it possible to limit the list only to the specific processes based on the group the user belongs to?
(i.e. the user from IT sees all the incidents from the process "Incidents" but doesn't see the sales requests from the process "Sales")
I don't want to show the list of cases in the processes that the user should not see.

Please help
Regards,
fibo2358
#813205
The short answer is NO.
You can create your own plugin to add an option to the Cases sidebar that displays the cases that you want. Here is a sample REST endpoint you can use in your plugin code:
viewtopic.php?f=44&t=730200&p=813110&hi ... er#p813110

The other option is to modify the source code for the Applications::getAll() function defined in processmaker/workflow/engine/classes/class.applications.php:192.

At the beginning of the function, you can add code like this:
Code: Select all
//set to the ID of process to which advanced searches are restricted:
$processIdToLimit = '1234567890abcde1234567890abcde';

//set to IDs of Users who are restricted to search in one process:
$aUsersToLimit = array(
     '1234567890abcde1234567890abcde',
     'abcde1234567890abcde1234567890',
     '789123456abcde3i423764183439845'
);

if (isset($_SESSION['USER_LOGGED']) and in_array($_SESSION['USER_LOGGED'], $aUsersToLimit)) {
   $process =  $processIdToLimit;
} 
#824551
Hi,

I tried what was suggested. But when i click on search, it stays stuck on loading, please wait.

Please see below my code.
Code: Select all
public function getAll(

         //set to the ID of process to which advanced searches are restricted:
		    $processIdToLimit = '5688171385c5889bbdfcd66067509052';

		    //set to IDs of Users who are restricted to search in one process:
		    $aUsersToLimit = {
		         '5316467285c585adf5a7992008289464',
		    }

		    if (isset($_SESSION['USER_LOGGED']) and in_array($_SESSION['USER_LOGGED'], $aUsersToLimit)) {
		       $process =  $processIdToLimit;
    }
        $userUid,
        $start = null,
        $limit = null,
        $action = null,
        $filter = null,
        $search = null,
        $process = null,
        $status = null,
        $type = null,
        $dateFrom = null,
        $dateTo = null,
        $callback = null,
        $dir = null,
        $sort = "APP_CACHE_VIEW.APP_NUMBER",
        $category = null,
        $configuration = true,
        $paged = true,
        $newerThan = '',
        $oldestThan = ''
    ){
#824566
You need to add the code to the start of the function body, not in the list of the function's parameters. (I'm guessing that you aren't a programmer.)

Do it this way:
Code: Select all
public function getAll(
        $userUid,
        $start = null,
        $limit = null,
        $action = null,
        $filter = null,
        $search = null,
        $process = null,
        $status = null,
        $type = null,
        $dateFrom = null,
        $dateTo = null,
        $callback = null,
        $dir = null,
        $sort = "APP_CACHE_VIEW.APP_NUMBER",
        $category = null,
        $configuration = true,
        $paged = true,
        $newerThan = '',
        $oldestThan = ''
    ) {
      //set to the ID of process to which advanced searches are restricted:
      $processIdToLimit = '5688171385c5889bbdfcd66067509052';

      //set to IDs of Users who are restricted to search in one process:
      $aUsersToLimit =  array(
	   '5316467285c585adf5a7992008289464'
      );

      if (isset($_SESSION['USER_LOGGED']) and in_array($_SESSION['USER_LOGGED'], $aUsersToLimit)) {
	   $process =  $processIdToLimit;
      }
Notice that you need to remove the comma after the user ID '5316467285c585adf5a7992008289464' because you only have one element in your array.

Hello. For rental housing, there are software solu[…]

Experience heightened pleasure with Cenforce 100 M[…]

Get an instant solution to move emails to MBOX for[…]

Most Demanding OST to PST Converter

The most demanding OST to PST Converter is TrijaT[…]