PMCORE-561
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
namespace ProcessMaker\Model;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use RbacUsers;
|
||||
use RBAC;
|
||||
|
||||
/**
|
||||
* Class Process
|
||||
@@ -57,4 +59,35 @@ class Process extends Model
|
||||
|
||||
return ($query->get()->values()->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* Obtains the list of private processes assigned to the user
|
||||
*
|
||||
* @param string $userUid
|
||||
* @return array
|
||||
*/
|
||||
public static function getProcessPrivateListByUser($userUid)
|
||||
{
|
||||
$query = Process::query()
|
||||
->select()
|
||||
->where('PRO_CREATE_USER', $userUid)
|
||||
->where('PRO_TYPE_PROCESS', 'PRIVATE');
|
||||
|
||||
return ($query->get()->values()->toArray());
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the private processes to public
|
||||
*
|
||||
* @param array $privateProcesses
|
||||
* @return void
|
||||
*/
|
||||
public static function convertPrivateProcessesToPublic($privateProcesses)
|
||||
{
|
||||
$admin = RBAC::ADMIN_USER_UID;
|
||||
|
||||
$processes = array_column($privateProcesses, 'PRO_ID');
|
||||
Process::whereIn('PRO_ID', $processes)
|
||||
->update(['PRO_TYPE_PROCESS' => 'PUBLIC', 'PRO_CREATE_USER' => $admin]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use Exception;
|
||||
use Luracast\Restler\RestException;
|
||||
use ProcessMaker\Project\Bpmn;
|
||||
use ProcessMaker\Services\Api;
|
||||
use \ProcessMaker\Project\Adapter;
|
||||
use \ProcessMaker\Util;
|
||||
use \ProcessMaker\Util\DateTime;
|
||||
use \ProcessMaker\BusinessModel\Validator;
|
||||
use \ProcessMaker\BusinessModel\Migrator\GranularExporter;
|
||||
use \ProcessMaker\BusinessModel\Migrator\ExportObjects;
|
||||
use \ProcessMaker\Util\IO\HttpStream;
|
||||
use \ProcessMaker\Util\Common;
|
||||
use \ProcessMaker\BusinessModel\Validator;
|
||||
use \ProcessMaker\Project\Adapter;
|
||||
use ProcessMaker\Project\Adapter\BpmnWorkflow;
|
||||
use Exception;
|
||||
use ProcessMaker\Project\Bpmn;
|
||||
use ProcessMaker\Services\Api;
|
||||
use \ProcessMaker\Util\Common;
|
||||
use \ProcessMaker\Util\DateTime;
|
||||
use \ProcessMaker\Util\IO\HttpStream;
|
||||
use RbacUsers;
|
||||
|
||||
/**
|
||||
* @package Services\Api\ProcessMaker
|
||||
@@ -296,6 +296,14 @@ class Project extends Api
|
||||
|
||||
$response = $process->getProcess($prj_uid);
|
||||
|
||||
$rbacUser = new RbacUsers();
|
||||
$res = $rbacUser->load($response['pro_create_user']);
|
||||
if (!empty($res)) {
|
||||
$response['pro_create_username'] = $res['USR_USERNAME'];
|
||||
$response['pro_create_firstname'] = $res['USR_FIRSTNAME'];
|
||||
$response['pro_create_lastname'] = $res['USR_LASTNAME'];
|
||||
}
|
||||
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
Reference in New Issue
Block a user