Merged in bugfix/HOR-4499 (pull request #6447)
HOR-4499 Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -63,11 +63,13 @@ if (isset( $arrayConfig["DEFAULT_CASES_MENU"] )) {
|
||||
}
|
||||
|
||||
if (isset($_SESSION['__OPEN_APPLICATION_UID__'])) {
|
||||
$openAppUid = $_SESSION['__OPEN_APPLICATION_UID__'];
|
||||
unset($_SESSION['__OPEN_APPLICATION_UID__']);
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
|
||||
$confDefaultOption = 'CASES_SEARCH';
|
||||
$action = 'search';
|
||||
$arrayResult = $case->getStatusInfo($_SESSION['__OPEN_APPLICATION_UID__'], 0, $_SESSION['USER_LOGGED']);
|
||||
$arrayResult = $case->getStatusInfo($openAppUid, 0, $_SESSION['USER_LOGGED']);
|
||||
$arrayDelIndex = [];
|
||||
|
||||
if (!empty($arrayResult)) {
|
||||
@@ -86,7 +88,7 @@ if (isset($_SESSION['__OPEN_APPLICATION_UID__'])) {
|
||||
|
||||
$arrayDelIndex = $arrayResult['DEL_INDEX'];
|
||||
} else {
|
||||
$arrayResultData = $case->getStatusInfo($_SESSION['__OPEN_APPLICATION_UID__']);
|
||||
$arrayResultData = $case->getStatusInfo($openAppUid);
|
||||
$supervisor = new \ProcessMaker\BusinessModel\ProcessSupervisor();
|
||||
$isSupervisor = $supervisor->isUserProcessSupervisor($arrayResultData['PRO_UID'], $_SESSION['USER_LOGGED']);
|
||||
if ($isSupervisor) {
|
||||
@@ -94,9 +96,9 @@ if (isset($_SESSION['__OPEN_APPLICATION_UID__'])) {
|
||||
$arrayDelIndex = $arrayResultData['DEL_INDEX'];
|
||||
} else {
|
||||
$_SESSION['PROCESS'] = $arrayResultData['PRO_UID'];
|
||||
$_GET['APP_UID'] = $_SESSION['__OPEN_APPLICATION_UID__'];
|
||||
$_GET['APP_UID'] = $openAppUid;
|
||||
$_SESSION['ACTION'] = 'jump';
|
||||
$_SESSION['APPLICATION'] = $_SESSION['__OPEN_APPLICATION_UID__'];
|
||||
$_SESSION['APPLICATION'] = $openAppUid;
|
||||
$_SESSION['INDEX'] = $arrayResultData['DEL_INDEX'][0];
|
||||
require_once(PATH_METHODS . 'cases' . PATH_SEP . 'cases_Resume.php');
|
||||
exit();
|
||||
@@ -104,14 +106,12 @@ if (isset($_SESSION['__OPEN_APPLICATION_UID__'])) {
|
||||
}
|
||||
|
||||
if (count($arrayDelIndex) == 1) {
|
||||
$defaultOption = '../cases/open?APP_UID=' . $_SESSION['__OPEN_APPLICATION_UID__'] .
|
||||
$defaultOption = '../cases/open?APP_UID=' . $openAppUid .
|
||||
'&DEL_INDEX=' . $arrayDelIndex[0] . '&action=' . $action;
|
||||
} else {
|
||||
$defaultOption = '../cases/casesListExtJs?action=' . $action .
|
||||
'&openApplicationUid=' . $_SESSION['__OPEN_APPLICATION_UID__'];
|
||||
'&openApplicationUid=' . $openAppUid;
|
||||
}
|
||||
|
||||
unset($_SESSION['__OPEN_APPLICATION_UID__']);
|
||||
} else {
|
||||
if (isset($_GET['id'])) {
|
||||
$defaultOption = '../cases/open?APP_UID=' . $_GET['id'] . '&DEL_INDEX=' . $_GET['i'];
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace ProcessMaker\Services\Api;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
use Exception;
|
||||
use G;
|
||||
use Luracast\Restler\RestException;
|
||||
use ProcessMaker\BusinessModel\Role as BmRole;
|
||||
use ProcessMaker\BusinessModel\User;
|
||||
use ProcessMaker\Services\Api;
|
||||
use ProcessMaker\Util\DateTime;
|
||||
|
||||
/**
|
||||
* Role Api Controller
|
||||
@@ -14,86 +20,102 @@ class Role extends Api
|
||||
private $role;
|
||||
|
||||
private $arrayFieldIso8601 = [
|
||||
"rol_create_date",
|
||||
"rol_update_date"
|
||||
'rol_create_date',
|
||||
'rol_update_date'
|
||||
];
|
||||
|
||||
/**
|
||||
* Constructor of the class
|
||||
* Role constructor.
|
||||
*
|
||||
* return void
|
||||
* @throws RestException
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
try {
|
||||
$user = new \ProcessMaker\BusinessModel\User();
|
||||
$user = new User();
|
||||
|
||||
$usrUid = $this->getUserId();
|
||||
|
||||
if (!$user->checkPermission($usrUid, "PM_USERS")) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_USER_NOT_HAVE_PERMISSION", array($usrUid)));
|
||||
if (!$user->checkPermission($usrUid, 'PM_USERS')) {
|
||||
throw new Exception(G::LoadTranslation('ID_USER_NOT_HAVE_PERMISSION', [$usrUid]));
|
||||
}
|
||||
|
||||
$this->role = new \ProcessMaker\BusinessModel\Role();
|
||||
|
||||
$this->role = new BmRole();
|
||||
$this->role->setFormatFieldNameInUppercase(false);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all roles
|
||||
*
|
||||
* @url GET
|
||||
*
|
||||
* @param string $filter
|
||||
* @param int $start
|
||||
* @param int $limit
|
||||
*
|
||||
* @return mixed
|
||||
* @throws RestException
|
||||
*
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_USERS}
|
||||
* @url GET
|
||||
*/
|
||||
public function index($filter = null, $start = null, $limit = null)
|
||||
{
|
||||
try {
|
||||
$response = $this->role->getRoles(array("filter" => $filter), null, null, $start, $limit);
|
||||
$response = $this->role->getRoles(['filter' => $filter], null, null, $start, $limit);
|
||||
|
||||
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_USERS}
|
||||
* load information role
|
||||
*
|
||||
* @url GET /:rol_uid
|
||||
*
|
||||
* @param string $rol_uid {@min 32}{@max 32}
|
||||
*
|
||||
* @return mixed
|
||||
* @throws RestException
|
||||
*
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_USERS}
|
||||
*/
|
||||
public function doGet($rol_uid)
|
||||
{
|
||||
try {
|
||||
$response = $this->role->getRole($rol_uid);
|
||||
|
||||
return \ProcessMaker\Util\DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (\Exception $e) {
|
||||
return DateTime::convertUtcToIso8601($response, $this->arrayFieldIso8601);
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_USERS}
|
||||
* Create rol
|
||||
*
|
||||
* @url POST
|
||||
* @status 201
|
||||
*
|
||||
* @param array $request_data
|
||||
*
|
||||
* @status 201
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_USERS}
|
||||
*/
|
||||
public function doPost(array $request_data)
|
||||
{
|
||||
try {
|
||||
$arrayData = $this->role->create($request_data);
|
||||
|
||||
$response = $arrayData;
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
return $this->role->create($request_data);
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
@@ -103,8 +125,8 @@ class Role extends Api
|
||||
*
|
||||
* @url PUT /:rol_uid
|
||||
*
|
||||
* @param string $rol_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
* @param string $rol_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @throws RestException
|
||||
*
|
||||
@@ -114,24 +136,29 @@ class Role extends Api
|
||||
public function doPut($rol_uid, array $request_data)
|
||||
{
|
||||
try {
|
||||
$arrayData = $this->role->update($rol_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
$this->role->update($rol_uid, $request_data);
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_USERS}
|
||||
* Delete role
|
||||
*
|
||||
* @url DELETE /:rol_uid
|
||||
*
|
||||
* @param string $rol_uid {@min 32}{@max 32}
|
||||
*
|
||||
* @throws RestException
|
||||
*
|
||||
* @access protected
|
||||
* @class AccessControl {@permission PM_USERS}
|
||||
*/
|
||||
public function doDelete($rol_uid)
|
||||
{
|
||||
try {
|
||||
$this->role->delete($rol_uid);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -635,8 +635,11 @@ DoSearch = function(){
|
||||
};
|
||||
|
||||
//Render Date Function
|
||||
render_date = function(v){
|
||||
return _DF(v);
|
||||
render_date = function(date){
|
||||
if (date != null) {
|
||||
return _DF(date);
|
||||
}
|
||||
return date;
|
||||
};
|
||||
|
||||
//Update Page Size Configuration
|
||||
|
||||
Reference in New Issue
Block a user