HOR-4478
This commit is contained in:
@@ -5783,6 +5783,7 @@ class Cases
|
||||
$resultCaseNotes = 0;
|
||||
$resultSummary = 0;
|
||||
$resultMessages = [];
|
||||
$resultReassignCases = [];
|
||||
|
||||
foreach ($permissions as $row) {
|
||||
$userUid = $row['USR_UID'];
|
||||
@@ -5939,11 +5940,17 @@ class Cases
|
||||
);
|
||||
$resultMessages = array_merge($resultMessages, $listMessage);
|
||||
break;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
case 'REASSIGN_MY_CASES':
|
||||
$listReassign = $objectPermission->objectPermissionByReassignCases($appUid, $proUid, $tasUid);
|
||||
$resultReassignCases = array_merge($resultReassignCases, $listReassign);
|
||||
break;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return array(
|
||||
return [
|
||||
"DYNAFORMS" => $resultDynaforms,
|
||||
"INPUT_DOCUMENTS" => $resultInputs,
|
||||
"ATTACHMENTS" => $resultAttachments,
|
||||
@@ -5951,9 +5958,10 @@ class Cases
|
||||
"CASES_NOTES" => $resultCaseNotes,
|
||||
"MSGS_HISTORY" => $resultMessages
|
||||
/*----------------------------------********---------------------------------*/
|
||||
, "REASSIGN_MY_CASES" => $resultReassignCases
|
||||
, "SUMMARY_FORM" => $resultSummary
|
||||
/*----------------------------------********---------------------------------*/
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -15,6 +15,9 @@ use ProcessMaker\BusinessModel\Cases\InputDocument;
|
||||
|
||||
class ObjectPermission extends BaseObjectPermission
|
||||
{
|
||||
const OP_PARTICIPATE_NO = 0;
|
||||
const OP_PARTICIPATE_YES = 1;
|
||||
const OP_PARTICIPATE_NONE = 2;
|
||||
/**
|
||||
* Get the fields related to the user uid
|
||||
*
|
||||
@@ -161,32 +164,21 @@ class ObjectPermission extends BaseObjectPermission
|
||||
* @param string $proUid the uid of the process
|
||||
* @param string $tasUid the uid of the task
|
||||
* @param string $action for the object permissions VIEW, BLOCK, RESEND
|
||||
* this parameter is no used for the permission REASSIGN_MY_CASES
|
||||
* @param array $caseData for review the case status DRAFT, TODO, COMPLETED, PAUSED
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function verifyObjectPermissionPerUser ($usrUid, $proUid, $tasUid = '', $action = '', $caseData = array())
|
||||
{
|
||||
$userPermissions = array();
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(ObjectPermissionPeer::USR_UID, $usrUid)->addOr(
|
||||
$oCriteria->getNewCriterion(ObjectPermissionPeer::USR_UID, '')->addOr(
|
||||
$oCriteria->getNewCriterion(ObjectPermissionPeer::USR_UID, '0')
|
||||
)
|
||||
)
|
||||
);
|
||||
$oCriteria->add(ObjectPermissionPeer::PRO_UID, $proUid);
|
||||
$oCriteria->add(ObjectPermissionPeer::OP_ACTION, $action);
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, $tasUid)->addOr(
|
||||
$oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, '')->addOr(
|
||||
$oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, '0')
|
||||
)
|
||||
)
|
||||
);
|
||||
$userPermissions = [];
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(ObjectPermissionPeer::USR_UID, ['','0',$usrUid], Criteria::IN);
|
||||
$criteria->add(ObjectPermissionPeer::PRO_UID, $proUid);
|
||||
$criteria->add(ObjectPermissionPeer::OP_ACTION, ['','0',$action], Criteria::IN);
|
||||
$criteria->add(ObjectPermissionPeer::TAS_UID, ['','0',$tasUid], Criteria::IN);
|
||||
|
||||
$rs = ObjectPermissionPeer::doSelectRS($oCriteria);
|
||||
$rs = ObjectPermissionPeer::doSelectRS($criteria);
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
while ($rs->next()) {
|
||||
@@ -219,19 +211,13 @@ class ObjectPermission extends BaseObjectPermission
|
||||
$groupPermissions = array();
|
||||
|
||||
foreach ($records as $group) {
|
||||
$oCriteria = new Criteria('workflow');
|
||||
$oCriteria->add(ObjectPermissionPeer::USR_UID, $group);
|
||||
$oCriteria->add(ObjectPermissionPeer::PRO_UID, $proUid);
|
||||
$oCriteria->add(ObjectPermissionPeer::OP_ACTION, $action);
|
||||
$oCriteria->add(
|
||||
$oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, $tasUid)->addOr(
|
||||
$oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, '')->addOr(
|
||||
$oCriteria->getNewCriterion(ObjectPermissionPeer::TAS_UID, '0')
|
||||
)
|
||||
)
|
||||
);
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->add(ObjectPermissionPeer::USR_UID, $group);
|
||||
$criteria->add(ObjectPermissionPeer::PRO_UID, $proUid);
|
||||
$criteria->add(ObjectPermissionPeer::OP_ACTION, ['','0',$action], Criteria::IN);
|
||||
$criteria->add(ObjectPermissionPeer::TAS_UID, ['','0',$tasUid], Criteria::IN);
|
||||
|
||||
$rs = ObjectPermissionPeer::doSelectRS($oCriteria);
|
||||
$rs = ObjectPermissionPeer::doSelectRS($criteria);
|
||||
$rs->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
while ($rs->next()) {
|
||||
$row = $rs->getRow();
|
||||
@@ -425,6 +411,44 @@ class ObjectPermission extends BaseObjectPermission
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify the access to the permission REASSIGN_MY_CASES over the case
|
||||
* Check if the case is TO_DO and if the $tasUid is not empty we will to consider the thread in this task
|
||||
*
|
||||
* @param string $appUid the uid of the case
|
||||
* @param string $proUid the uid of the process
|
||||
* @param string $tasUid the uid of the target Task
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function objectPermissionByReassignCases($appUid, $proUid, $tasUid = '')
|
||||
{
|
||||
$result = [];
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$criteria = new Criteria('workflow');
|
||||
$criteria->addSelectColumn(ApplicationPeer::APP_UID);
|
||||
$criteria->add(ApplicationPeer::APP_UID, $appUid, Criteria::EQUAL);
|
||||
$criteria->add(ApplicationPeer::PRO_UID, $proUid, Criteria::EQUAL);
|
||||
$criteria->add(ApplicationPeer::APP_STATUS, 'TO_DO', Criteria::EQUAL);
|
||||
|
||||
//Review if the target task is OPEN
|
||||
if (!empty($tasUid)) {
|
||||
$criteria->addJoin(AppDelegationPeer::APP_NUMBER, ApplicationPeer::APP_NUMBER, Criteria::LEFT_JOIN);
|
||||
$criteria->add(AppDelegationPeer::TAS_UID, $tasUid, Criteria::EQUAL);
|
||||
$criteria->add(AppDelegationPeer::DEL_THREAD_STATUS, 'OPEN', Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$dataset = ApplicationPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
if ($row = $dataset->getRow()) {
|
||||
$result[] = $row['APP_UID'];
|
||||
}
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if the user has a objectPermission for some process
|
||||
*
|
||||
|
||||
@@ -79,7 +79,7 @@ class ObjectPermissionMapBuilder
|
||||
|
||||
$tMap->addColumn('OP_PARTICIPATE', 'OpParticipate', 'int', CreoleTypes::INTEGER, true, null);
|
||||
|
||||
$tMap->addColumn('OP_OBJ_TYPE', 'OpObjType', 'string', CreoleTypes::VARCHAR, true, 15);
|
||||
$tMap->addColumn('OP_OBJ_TYPE', 'OpObjType', 'string', CreoleTypes::VARCHAR, true, 20);
|
||||
|
||||
$tMap->addColumn('OP_OBJ_UID', 'OpObjUid', 'string', CreoleTypes::VARCHAR, true, 32);
|
||||
|
||||
@@ -115,7 +115,7 @@ class ObjectPermissionMapBuilder
|
||||
|
||||
$tMap->addValidator('OP_PARTICIPATE', 'required', 'propel.validator.RequiredValidator', '', 'Participation is required.');
|
||||
|
||||
$tMap->addValidator('OP_OBJ_TYPE', 'maxLength', 'propel.validator.MaxLengthValidator', '15', 'Object type can be no larger than 15 in size');
|
||||
$tMap->addValidator('OP_OBJ_TYPE', 'maxLength', 'propel.validator.MaxLengthValidator', '20', 'Object type can be no larger than 20 in size');
|
||||
|
||||
$tMap->addValidator('OP_OBJ_TYPE', 'required', 'propel.validator.RequiredValidator', '', 'Object type is required.');
|
||||
|
||||
|
||||
@@ -1998,7 +1998,7 @@
|
||||
<column name="OP_USER_RELATION" type="INTEGER" required="true" default="0"/>
|
||||
<column name="OP_TASK_SOURCE" type="VARCHAR" size="32" required="" default="0"/>
|
||||
<column name="OP_PARTICIPATE" type="INTEGER" required="true" default="0"/>
|
||||
<column name="OP_OBJ_TYPE" type="VARCHAR" size="15" required="true" default="0"/>
|
||||
<column name="OP_OBJ_TYPE" type="VARCHAR" size="20" required="true" default="0"/>
|
||||
<column name="OP_OBJ_UID" type="VARCHAR" size="32" required="true" default="0"/>
|
||||
<column name="OP_ACTION" type="VARCHAR" size="10" required="true" default="0"/>
|
||||
<column name="OP_CASE_STATUS" type="VARCHAR" size="10" required="false" default="0"/>
|
||||
@@ -2031,7 +2031,7 @@
|
||||
<rule name="required" message="Participation is required."/>
|
||||
</validator>
|
||||
<validator column="OP_OBJ_TYPE">
|
||||
<rule name="maxLength" value="15" message="Object type can be no larger than ${value} in size"/>
|
||||
<rule name="maxLength" value="20" message="Object type can be no larger than ${value} in size"/>
|
||||
<rule name="required" message="Object type is required."/>
|
||||
</validator>
|
||||
<validator column="OP_OBJ_UID">
|
||||
|
||||
@@ -19109,6 +19109,12 @@ msgstr "After routing notify the next assigned user(s)"
|
||||
msgid "Notify users of case"
|
||||
msgstr "Notify users of case"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_NOT_ABLE_REASSIGN
|
||||
#: LABEL/ID_NOT_ABLE_REASSIGN
|
||||
msgid "You are not able to reassign cases of this process."
|
||||
msgstr "You are not able to reassign cases of this process."
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_NOT_AVAILABLE_DATABASE
|
||||
#: LABEL/ID_NOT_AVAILABLE_DATABASE
|
||||
@@ -21743,6 +21749,12 @@ msgstr "Case #{APP_NUMBER} was reassigned to user {USER}."
|
||||
msgid "Reassign All Cases by Task"
|
||||
msgstr "Reassign All Cases by Task"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_REASSIGN_CASE
|
||||
#: LABEL/ID_REASSIGN_CASE
|
||||
msgid "Reassign Case"
|
||||
msgstr "Reassign Case"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_REASSIGN_CASES
|
||||
#: LABEL/ID_REASSIGN_CASES
|
||||
@@ -21755,6 +21767,12 @@ msgstr "Reassign Cases"
|
||||
msgid "Do you want to reassign the case?"
|
||||
msgstr "Do you want to reassign the case?"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_REASSIGN_MY_CASES
|
||||
#: LABEL/ID_REASSIGN_MY_CASES
|
||||
msgid "Reassign my cases"
|
||||
msgstr "Reassign my cases"
|
||||
|
||||
# TRANSLATION
|
||||
# LABEL/ID_REASSIGN_TO
|
||||
#: LABEL/ID_REASSIGN_TO
|
||||
|
||||
@@ -60049,6 +60049,7 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_NOTIFY','en','Notify','2016-10-20') ,
|
||||
( 'LABEL','ID_NOTIFY_USERS_AFTER_ASSIGN','en','After routing notify the next assigned user(s)','2014-01-15') ,
|
||||
( 'LABEL','ID_NOTIFY_USERS_CASE','en','Notify users of case','2014-01-15') ,
|
||||
( 'LABEL','ID_NOT_ABLE_REASSIGN','en','You are not able to reassign cases of this process.','2018-05-15') ,
|
||||
( 'LABEL','ID_NOT_AVAILABLE_DATABASE','en','Not available.','2015-04-21') ,
|
||||
( 'LABEL','ID_NOT_CREATE_TABLE','en','Could not create the table with the name','2014-01-15') ,
|
||||
( 'LABEL','ID_NOT_DEFINED','en','Not defined','2014-01-15') ,
|
||||
@@ -60499,8 +60500,10 @@ INSERT INTO TRANSLATION (TRN_CATEGORY,TRN_ID,TRN_LANG,TRN_VALUE,TRN_UPDATE_DATE
|
||||
( 'LABEL','ID_REASSIGNMENT_PAUSED_ERROR','en','The case is paused and can''t be reasigned.','2016-08-12') ,
|
||||
( 'LABEL','ID_REASSIGNMENT_SUCCESS','en','Case #{APP_NUMBER} was reassigned to user {USER}.','2014-01-15') ,
|
||||
( 'LABEL','ID_REASSIGN_ALL_CASES_BY_TASK','en','Reassign All Cases by Task','2014-01-15') ,
|
||||
( 'LABEL','ID_REASSIGN_CASE','en','Reassign Case','2018-05-15') ,
|
||||
( 'LABEL','ID_REASSIGN_CASES','en','Reassign Cases','2014-01-15') ,
|
||||
( 'LABEL','ID_REASSIGN_CONFIRM','en','Do you want to reassign the case?','2017-10-18') ,
|
||||
( 'LABEL','ID_REASSIGN_MY_CASES','en','Reassign my cases','2018-05-17') ,
|
||||
( 'LABEL','ID_REASSIGN_TO','en','Reassign','2014-01-15') ,
|
||||
( 'LABEL','ID_REASSIGN_USERS','en','User Reassignment','2014-01-15') ,
|
||||
( 'LABEL','ID_REBUILDING_TRANSLATIONS','en','Rebuilding translations','2014-01-15') ,
|
||||
|
||||
@@ -952,7 +952,7 @@ CREATE TABLE `OBJECT_PERMISSION`
|
||||
`OP_USER_RELATION` INTEGER default 0 NOT NULL,
|
||||
`OP_TASK_SOURCE` VARCHAR(32) default '0',
|
||||
`OP_PARTICIPATE` INTEGER default 0 NOT NULL,
|
||||
`OP_OBJ_TYPE` VARCHAR(15) default '0' NOT NULL,
|
||||
`OP_OBJ_TYPE` VARCHAR(20) default '0' NOT NULL,
|
||||
`OP_OBJ_UID` VARCHAR(32) default '0' NOT NULL,
|
||||
`OP_ACTION` VARCHAR(10) default '0' NOT NULL,
|
||||
`OP_CASE_STATUS` VARCHAR(10) default '0',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php
|
||||
|
||||
use ProcessMaker\BusinessModel\Cases as BmCases;
|
||||
use ProcessMaker\Plugins\PluginRegistry;
|
||||
|
||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
@@ -23,27 +24,41 @@ if (isset($_REQUEST['action']) && $_REQUEST['action'] == "verifySession") {
|
||||
print G::json_encode($response);
|
||||
die();
|
||||
} else {
|
||||
$response = new stdclass();
|
||||
|
||||
//Check if the user is a supervisor to this Process
|
||||
/** Action: Reassign from openCase */
|
||||
global $RBAC;
|
||||
if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1) {
|
||||
$proUid = $_SESSION['PROCESS'];
|
||||
$appUid = $_SESSION['APPLICATION'];
|
||||
$tasUid = $_SESSION['TASK'];
|
||||
|
||||
$response = new stdclass();
|
||||
$cases = new BmCases();
|
||||
$userAuthorization = $cases->userAuthorization(
|
||||
$RBAC->aUserInfo['USER_INFO']['USR_UID'],
|
||||
$proUid,
|
||||
$appUid,
|
||||
['PM_REASSIGNCASE', 'PM_REASSIGNCASE_SUPERVISOR'],
|
||||
['REASSIGN_MY_CASES' => ''],
|
||||
true,
|
||||
$tasUid
|
||||
);
|
||||
|
||||
if (
|
||||
$userAuthorization['rolesPermissions']['PM_REASSIGNCASE'] ||
|
||||
($userAuthorization['rolesPermissions']['PM_REASSIGNCASE_SUPERVISOR'] && $userAuthorization['supervisor']) ||
|
||||
in_array($appUid, $userAuthorization['objectPermissions']['REASSIGN_MY_CASES'])
|
||||
) {
|
||||
$response->reassigncase = true;
|
||||
$response->message = '';
|
||||
} elseif ($RBAC->userCanAccess('PM_REASSIGNCASE_SUPERVISOR') == 1) {
|
||||
} else {
|
||||
$response->reassigncase = false;
|
||||
$response->message = G::LoadTranslation('ID_NOT_ABLE_REASSIGN');
|
||||
$processUser = new ProcessUser();
|
||||
$listProcess = $processUser->getProUidSupervisor($_SESSION['USER_LOGGED']);
|
||||
if (in_array($_SESSION['PROCESS'], $listProcess)) {
|
||||
$response->reassigncase = true;
|
||||
}
|
||||
}
|
||||
|
||||
print G::json_encode($response);
|
||||
die();
|
||||
}
|
||||
}
|
||||
|
||||
class Ajax
|
||||
{
|
||||
public function getCaseMenu($params)
|
||||
@@ -144,61 +159,83 @@ class Ajax
|
||||
return $options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the options menu from action
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getActionOptions()
|
||||
{
|
||||
$APP_UID = $_SESSION['APPLICATION'];
|
||||
$appUid = $_SESSION['APPLICATION'];
|
||||
$index = $_SESSION['INDEX'];
|
||||
$proUid = $_SESSION['PROCESS'];
|
||||
$tasUid = $_SESSION['TASK'];
|
||||
|
||||
$c = new Criteria('workflow');
|
||||
$c->clearSelectColumns();
|
||||
$c->addSelectColumn(AppThreadPeer::APP_THREAD_PARENT);
|
||||
$c->add(AppThreadPeer::APP_UID, $APP_UID);
|
||||
$c->add(AppThreadPeer::APP_UID, $appUid);
|
||||
$c->add(AppThreadPeer::APP_THREAD_STATUS, 'OPEN');
|
||||
$cant = AppThreadPeer::doCount($c);
|
||||
|
||||
$oCase = new Cases();
|
||||
$aFields = $oCase->loadCase($_SESSION['APPLICATION'], $_SESSION['INDEX']);
|
||||
$aFields = $oCase->loadCase($appUid, $index);
|
||||
|
||||
global $RBAC;
|
||||
|
||||
$options = array();
|
||||
$options = [];
|
||||
|
||||
switch ($aFields['APP_STATUS']) {
|
||||
case 'DRAFT':
|
||||
if (!AppDelay::isPaused($_SESSION['APPLICATION'], $_SESSION['INDEX'])) {
|
||||
$options[] = array('text' => G::LoadTranslation('ID_PAUSED_CASE'), 'fn' => 'setUnpauseCaseDate');
|
||||
if (!AppDelay::isPaused($appUid, $index)) {
|
||||
$options[] = ['text' => G::LoadTranslation('ID_PAUSED_CASE'), 'fn' => 'setUnpauseCaseDate'];
|
||||
} else {
|
||||
$options[] = array('text' => G::LoadTranslation('ID_UNPAUSE'), 'fn' => 'unpauseCase');
|
||||
$options[] = ['text' => G::LoadTranslation('ID_UNPAUSE'), 'fn' => 'unpauseCase'];
|
||||
}
|
||||
|
||||
$options[] = array('text' => G::LoadTranslation('ID_DELETE'), 'fn' => 'deleteCase');
|
||||
$options[] = ['text' => G::LoadTranslation('ID_DELETE'), 'fn' => 'deleteCase'];
|
||||
|
||||
if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1 || $RBAC->userCanAccess('PM_REASSIGNCASE_SUPERVISOR') == 1) {
|
||||
if (!AppDelay::isPaused($_SESSION['APPLICATION'], $_SESSION['INDEX'])) {
|
||||
$options[] = array('text' => G::LoadTranslation('ID_REASSIGN'), 'fn' => 'getUsersToReassign');
|
||||
if (!AppDelay::isPaused($appUid, $index)) {
|
||||
$options[] = ['text' => G::LoadTranslation('ID_REASSIGN'), 'fn' => 'getUsersToReassign'];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'TO_DO':
|
||||
if (!AppDelay::isPaused($_SESSION['APPLICATION'], $_SESSION['INDEX'])) {
|
||||
$options[] = array('text' => G::LoadTranslation('ID_PAUSED_CASE'), 'fn' => 'setUnpauseCaseDate');
|
||||
if (!AppDelay::isPaused($appUid, $index)) {
|
||||
$options[] = ['text' => G::LoadTranslation('ID_PAUSED_CASE'), 'fn' => 'setUnpauseCaseDate'];
|
||||
if ($cant == 1) {
|
||||
if ($RBAC->userCanAccess('PM_CANCELCASE') == 1) {
|
||||
$options[] = array('text' => G::LoadTranslation('ID_CANCEL'), 'fn' => 'cancelCase');
|
||||
$options[] = ['text' => G::LoadTranslation('ID_CANCEL'), 'fn' => 'cancelCase'];
|
||||
} else {
|
||||
$options[] = array('text' => G::LoadTranslation('ID_CANCEL'), 'fn' => 'cancelCase', 'hide' => 'hiden');
|
||||
$options[] = ['text' => G::LoadTranslation('ID_CANCEL'), 'fn' => 'cancelCase', 'hide' => 'hiden'];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$options[] = array('text' => G::LoadTranslation('ID_UNPAUSE'), 'fn' => 'unpauseCase');
|
||||
$options[] = ['text' => G::LoadTranslation('ID_UNPAUSE'), 'fn' => 'unpauseCase'];
|
||||
}
|
||||
if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1 || $RBAC->userCanAccess('PM_REASSIGNCASE_SUPERVISOR') == 1) {
|
||||
if (!AppDelay::isPaused($_SESSION['APPLICATION'], $_SESSION['INDEX'])) {
|
||||
$options[] = array('text' => G::LoadTranslation('ID_REASSIGN'), 'fn' => 'getUsersToReassign');
|
||||
$cases = new BmCases();
|
||||
$userAuthorization = $cases->userAuthorization(
|
||||
$RBAC->aUserInfo['USER_INFO']['USR_UID'],
|
||||
$proUid,
|
||||
$appUid,
|
||||
[],
|
||||
['REASSIGN_MY_CASES' => ''],
|
||||
false,
|
||||
$tasUid
|
||||
);
|
||||
if (
|
||||
$RBAC->userCanAccess('PM_REASSIGNCASE') == 1
|
||||
|| $RBAC->userCanAccess('PM_REASSIGNCASE_SUPERVISOR') == 1
|
||||
|| in_array($appUid, $userAuthorization['objectPermissions']['REASSIGN_MY_CASES'])
|
||||
) {
|
||||
if (!AppDelay::isPaused($appUid, $index)) {
|
||||
$options[] = ['text' => G::LoadTranslation('ID_REASSIGN'), 'fn' => 'getUsersToReassign'];
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 'CANCELLED':
|
||||
$options[] = array('text' => G::LoadTranslation('ID_REACTIVATE'), 'fn' => 'reactivateCase');
|
||||
$options[] = ['text' => G::LoadTranslation('ID_REACTIVATE'), 'fn' => 'reactivateCase'];
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -217,9 +254,10 @@ class Ajax
|
||||
}
|
||||
|
||||
if ($aTask['TAS_TYPE'] == 'ADHOC') {
|
||||
$options[] = array('text' => G::LoadTranslation('ID_ADHOC_ASSIGNMENT'), 'fn' => 'adhocAssignmentUsers');
|
||||
$options[] = ['text' => G::LoadTranslation('ID_ADHOC_ASSIGNMENT'), 'fn' => 'adhocAssignmentUsers'];
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
|
||||
@@ -550,7 +588,7 @@ class Ajax
|
||||
$response = [];
|
||||
|
||||
try {
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$case = new BmCases();
|
||||
|
||||
$result = $case->getUsersToReassign($_SESSION['USER_LOGGED'], $taskUid, ['filter' => $search], $sortField, $sortDir, $start, $limit);
|
||||
|
||||
|
||||
@@ -184,12 +184,13 @@ if ($licensedFeatures->verifyfeature('r19Vm5DK1UrT09MenlLYjZxejlhNUZ1b1NhV0JHWjB
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
//menu permissions
|
||||
/** Define actions menu in the cases list */
|
||||
$cnt = '';
|
||||
$reassignCase = ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1) ? 'true' : 'false';
|
||||
$reassignCaseSup = ($RBAC->userCanAccess('PM_REASSIGNCASE_SUPERVISOR') == 1) ? 'true' : 'false';
|
||||
$oHeadPublisher->assign('varReassignCase', $reassignCase);
|
||||
$oHeadPublisher->assign('varReassignCaseSupervisor', $reassignCaseSup);
|
||||
|
||||
$c = new Configurations();
|
||||
$oHeadPublisher->addExtJsScript('app/main', true);
|
||||
$oHeadPublisher->addExtJsScript('cases/casesList', false); //adding a javascript file .js
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
if (!isset($_SESSION['USER_LOGGED'])) {
|
||||
$response = new stdClass();
|
||||
$response->message = G::LoadTranslation('ID_LOGIN_AGAIN');
|
||||
@@ -146,8 +147,10 @@ if ($actionAjax == "verifySession") {
|
||||
print G::json_encode($response);
|
||||
die();
|
||||
} else {
|
||||
$response = new stdclass();
|
||||
/** Action: Reassign from casesList */
|
||||
GLOBAL $RBAC;
|
||||
$response = new stdclass();
|
||||
|
||||
//Check if the user is a supervisor to this Process
|
||||
if ($RBAC->userCanAccess('PM_REASSIGNCASE') == 1) {
|
||||
$response->reassigncase = true;
|
||||
@@ -160,7 +163,6 @@ if ($actionAjax == "verifySession") {
|
||||
$listProcess = $processUser->getProUidSupervisor($_SESSION['USER_LOGGED']);
|
||||
$response->processeslist = G::json_encode($listProcess);
|
||||
}
|
||||
|
||||
print G::json_encode($response);
|
||||
die();
|
||||
}
|
||||
|
||||
@@ -3349,6 +3349,7 @@ class Cases
|
||||
* @param array $rolesPermissions, the roles that we need to review
|
||||
* @param array $objectPermissions, the permissions that we need to review
|
||||
* @param boolean $objectSupervisor, if we need to get all the objects supervisor
|
||||
* @param string $tasUid
|
||||
* @return array
|
||||
*/
|
||||
public function userAuthorization(
|
||||
@@ -3357,7 +3358,8 @@ class Cases
|
||||
$appUid,
|
||||
$rolesPermissions = [],
|
||||
$objectPermissions = [],
|
||||
$objectSupervisor = false
|
||||
$objectSupervisor = false,
|
||||
$tasUid = ''
|
||||
) {
|
||||
$arrayAccess = [];
|
||||
|
||||
@@ -3389,7 +3391,7 @@ class Cases
|
||||
if (count($objectPermissions) > 0) {
|
||||
$case = new ClassesCases();
|
||||
foreach ($objectPermissions as $key => $value) {
|
||||
$resPermission = $case->getAllObjectsFrom($proUid, $appUid, '', $usrUid, $value);
|
||||
$resPermission = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, $value);
|
||||
if (isset($resPermission[$key])) {
|
||||
$arrayAccess['objectPermissions'][$key] = $resPermission[$key];
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
|
||||
use Behat\Behat\Exception\Exception;
|
||||
use \G;
|
||||
use \Criteria;
|
||||
use \ObjectPermissionPeer;
|
||||
use \Exception as StandardException;
|
||||
use BasePeer;
|
||||
use Criteria;
|
||||
use G;
|
||||
use ObjectPermission;
|
||||
use ObjectPermissionPeer;
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
@@ -13,6 +14,7 @@ use \Exception as StandardException;
|
||||
*/
|
||||
class ProcessPermissions
|
||||
{
|
||||
const DOES_NOT_APPLY = 'N/A';
|
||||
/**
|
||||
* Get list for Process Permissions
|
||||
*
|
||||
@@ -20,8 +22,6 @@ class ProcessPermissions
|
||||
* @var string $op_uid. Uid for Process Permission
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
@@ -42,6 +42,14 @@ class ProcessPermissions
|
||||
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset->next();
|
||||
while ($aRow = $oDataset->getRow()) {
|
||||
//Participated
|
||||
if ($aRow['OP_PARTICIPATE'] == 0) {
|
||||
$participated = G::LoadTranslation('ID_NO');
|
||||
} else {
|
||||
$participated = G::LoadTranslation('ID_YES');
|
||||
}
|
||||
//Obtain action (permission)
|
||||
$action = G::LoadTranslation('ID_' . $aRow['OP_ACTION']);
|
||||
//Obtain task target
|
||||
if (($aRow['TAS_UID'] != '') && ($aRow['TAS_UID'] != '0')) {
|
||||
try {
|
||||
@@ -87,32 +95,20 @@ class ProcessPermissions
|
||||
//Obtain object and type
|
||||
switch ($aRow['OP_OBJ_TYPE']) {
|
||||
case 'ALL':
|
||||
$sObjectType = G::LoadTranslation('ID_ALL');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
$objectType = G::LoadTranslation('ID_ALL');
|
||||
$object = G::LoadTranslation('ID_ALL');
|
||||
break;
|
||||
case 'ANY': //For backward compatibility (some process with ANY instead of ALL
|
||||
$sObjectType = G::LoadTranslation('ID_ALL');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
$objectType = G::LoadTranslation('ID_ALL');
|
||||
$object = G::LoadTranslation('ID_ALL');
|
||||
break;
|
||||
/* case 'ANY_DYNAFORM':
|
||||
$sObjectType = G::LoadTranslation('ID_ANY_DYNAFORM');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
break;
|
||||
case 'ANY_INPUT':
|
||||
$sObjectType = G::LoadTranslation('ID_ANY_INPUT');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
break;
|
||||
case 'ANY_OUTPUT':
|
||||
$sObjectType = G::LoadTranslation('ID_ANY_OUTPUT');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
break; */
|
||||
case 'DYNAFORM':
|
||||
$sObjectType = G::LoadTranslation('ID_DYNAFORM');
|
||||
$objectType = G::LoadTranslation('ID_DYNAFORM');
|
||||
if (($aRow['OP_OBJ_UID'] != '') && ($aRow['OP_OBJ_UID'] != '0')) {
|
||||
$oDynaform = new \Dynaform();
|
||||
try {
|
||||
$aFields = $oDynaform->load($aRow['OP_OBJ_UID']);
|
||||
$sObject = $aFields['DYN_TITLE'];
|
||||
$object = $aFields['DYN_TITLE'];
|
||||
} catch (\Exception $errorNotExists) {
|
||||
error_log($errorNotExists->getMessage() . ' - ' . G::LoadTranslation('ID_PROCESS_PERMISSIONS') .
|
||||
' - ' . $aRow['OP_OBJ_TYPE'] . ' - ' . $aRow['OP_OBJ_UID']);
|
||||
@@ -120,16 +116,16 @@ class ProcessPermissions
|
||||
continue 2;
|
||||
}
|
||||
} else {
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
$object = G::LoadTranslation('ID_ALL');
|
||||
}
|
||||
break;
|
||||
case 'INPUT':
|
||||
$sObjectType = G::LoadTranslation('ID_INPUT_DOCUMENT');
|
||||
$objectType = G::LoadTranslation('ID_INPUT_DOCUMENT');
|
||||
if (($aRow['OP_OBJ_UID'] != '') && ($aRow['OP_OBJ_UID'] != '0')) {
|
||||
$oInputDocument = new \InputDocument();
|
||||
try {
|
||||
$aFields = $oInputDocument->load($aRow['OP_OBJ_UID']);
|
||||
$sObject = $aFields['INP_DOC_TITLE'];
|
||||
$object = $aFields['INP_DOC_TITLE'];
|
||||
} catch (\Exception $errorNotExists) {
|
||||
error_log($errorNotExists->getMessage() . ' - ' . G::LoadTranslation('ID_PROCESS_PERMISSIONS') .
|
||||
' - ' . $aRow['OP_OBJ_TYPE'] . ' - ' . $aRow['OP_OBJ_UID']);
|
||||
@@ -137,16 +133,16 @@ class ProcessPermissions
|
||||
continue 2;
|
||||
}
|
||||
} else {
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
$object = G::LoadTranslation('ID_ALL');
|
||||
}
|
||||
break;
|
||||
case 'OUTPUT':
|
||||
$sObjectType = G::LoadTranslation('ID_OUTPUT_DOCUMENT');
|
||||
$objectType = G::LoadTranslation('ID_OUTPUT_DOCUMENT');
|
||||
if (($aRow['OP_OBJ_UID'] != '') && ($aRow['OP_OBJ_UID'] != '0')) {
|
||||
$oOutputDocument = new \OutputDocument();
|
||||
try {
|
||||
$aFields = $oOutputDocument->load($aRow['OP_OBJ_UID']);
|
||||
$sObject = $aFields['OUT_DOC_TITLE'];
|
||||
$object = $aFields['OUT_DOC_TITLE'];
|
||||
} catch (\Exception $errorNotExists) {
|
||||
error_log($errorNotExists->getMessage() . ' - ' . G::LoadTranslation('ID_PROCESS_PERMISSIONS') .
|
||||
' - ' . $aRow['OP_OBJ_TYPE'] . ' - ' . $aRow['OP_OBJ_UID']);
|
||||
@@ -154,30 +150,32 @@ class ProcessPermissions
|
||||
continue 2;
|
||||
}
|
||||
} else {
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
$object = G::LoadTranslation('ID_ALL');
|
||||
}
|
||||
break;
|
||||
case 'CASES_NOTES':
|
||||
$sObjectType = G::LoadTranslation('ID_CASES_NOTES');
|
||||
$sObject = 'N/A';
|
||||
$objectType = G::LoadTranslation('ID_CASES_NOTES');
|
||||
$object = self::DOES_NOT_APPLY;
|
||||
break;
|
||||
case 'MSGS_HISTORY':
|
||||
$sObjectType = G::LoadTranslation('MSGS_HISTORY');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
$objectType = G::LoadTranslation('MSGS_HISTORY');
|
||||
$object = G::LoadTranslation('ID_ALL');
|
||||
break;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
case 'REASSIGN_MY_CASES':
|
||||
$objectType = G::LoadTranslation('ID_REASSIGN_MY_CASES');
|
||||
$object = self::DOES_NOT_APPLY;
|
||||
$aRow['OP_ACTION'] = self::DOES_NOT_APPLY;
|
||||
$participated = self::DOES_NOT_APPLY;
|
||||
break;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
default:
|
||||
$sObjectType = G::LoadTranslation('ID_ALL');
|
||||
$sObject = G::LoadTranslation('ID_ALL');
|
||||
$objectType = G::LoadTranslation('ID_ALL');
|
||||
$object = G::LoadTranslation('ID_ALL');
|
||||
|
||||
break;
|
||||
}
|
||||
//Participated
|
||||
if ($aRow['OP_PARTICIPATE'] == 0) {
|
||||
$sParticipated = G::LoadTranslation('ID_NO');
|
||||
} else {
|
||||
$sParticipated = G::LoadTranslation('ID_YES');
|
||||
}
|
||||
//Obtain action (permission)
|
||||
$sAction = G::LoadTranslation('ID_' . $aRow['OP_ACTION']);
|
||||
|
||||
//Add to array
|
||||
$arrayTemp = array();
|
||||
$arrayTemp = array_merge($aRow, array(
|
||||
@@ -185,10 +183,10 @@ class ProcessPermissions
|
||||
'TASK_TARGET' => $sTaskTarget,
|
||||
'GROUP_USER' => $sUserGroup,
|
||||
'TASK_SOURCE' => $sTaskSource,
|
||||
'OBJECT_TYPE' => $sObjectType,
|
||||
'OBJECT' => $sObject,
|
||||
'PARTICIPATED' => $sParticipated,
|
||||
'ACTION' => $sAction,
|
||||
'OBJECT_TYPE' => $objectType,
|
||||
'OBJECT' => $object,
|
||||
'PARTICIPATED' => $participated,
|
||||
'ACTION' => $action,
|
||||
'OP_CASE_STATUS' => $aRow['OP_CASE_STATUS'])
|
||||
);
|
||||
$aObjectsPermissions[] = array_change_key_case($arrayTemp, CASE_LOWER);
|
||||
@@ -213,7 +211,7 @@ class ProcessPermissions
|
||||
*
|
||||
* @access public
|
||||
*
|
||||
* @return void
|
||||
* @return void|array
|
||||
* @throws Exception
|
||||
*/
|
||||
public function saveProcessPermission($data, $opUid = '')
|
||||
@@ -226,7 +224,7 @@ class ProcessPermissions
|
||||
$opUid = $this->validateOpUid($opUid);
|
||||
}
|
||||
if (empty($data['USR_UID']) || (isset($data['USR_UID']) && $data['USR_UID'] === "null")) {
|
||||
throw (new StandardException(G::LoadTranslation("ID_SELECT_USER_OR_GROUP")));
|
||||
throw (new Exception(G::LoadTranslation("ID_SELECT_USER_OR_GROUP")));
|
||||
}
|
||||
if ($data['OP_USER_RELATION'] == "1") {
|
||||
$this->validateUsrUid($data['USR_UID']);
|
||||
@@ -244,50 +242,59 @@ class ProcessPermissions
|
||||
$data['OP_TASK_SOURCE'] = '';
|
||||
}
|
||||
|
||||
$sObjectUID = '';
|
||||
$opCaseStatus = !empty($data['OP_CASE_STATUS']) ? $data['OP_CASE_STATUS'] : '0';
|
||||
$opObjectUid = '';
|
||||
switch ($data['OP_OBJ_TYPE']) {
|
||||
case 'ANY':
|
||||
//case 'ANY_DYNAFORM':CASES_NOTES
|
||||
//case 'ANY_INPUT':
|
||||
//case 'ANY_OUTPUT':
|
||||
$sObjectUID = '';
|
||||
$opObjectUid = '';
|
||||
break;
|
||||
case 'DYNAFORM':
|
||||
$data['DYNAFORMS'] = $data['DYNAFORMS'] == 0 ? '': $data['DYNAFORMS'];
|
||||
if ($data['DYNAFORMS'] != '') {
|
||||
$this->validateDynUid($data['DYNAFORMS']);
|
||||
}
|
||||
$sObjectUID = $data['DYNAFORMS'];
|
||||
$opObjectUid = $data['DYNAFORMS'];
|
||||
break;
|
||||
case 'ATTACHED':
|
||||
$sObjectUID = '';
|
||||
$opObjectUid = '';
|
||||
break;
|
||||
case 'INPUT':
|
||||
$data['INPUTS'] = $data['INPUTS'] == 0 ? '': $data['INPUTS'];
|
||||
if ($data['INPUTS'] != '') {
|
||||
$this->validateInpUid($data['INPUTS']);
|
||||
}
|
||||
$sObjectUID = $data['INPUTS'];
|
||||
$opObjectUid = $data['INPUTS'];
|
||||
break;
|
||||
case 'OUTPUT':
|
||||
$data['OUTPUTS'] = $data['OUTPUTS'] == 0 ? '': $data['OUTPUTS'];
|
||||
if ($data['OUTPUTS'] != '') {
|
||||
$this->validateOutUid($data['OUTPUTS']);
|
||||
}
|
||||
$sObjectUID = $data['OUTPUTS'];
|
||||
$opObjectUid = $data['OUTPUTS'];
|
||||
break;
|
||||
case 'REASSIGN_MY_CASES':
|
||||
$opCaseStatus = 'TO_DO';
|
||||
$data['OP_ACTION'] = '';
|
||||
break;
|
||||
}
|
||||
$oOP = new \ObjectPermission();
|
||||
$objectPermission = new ObjectPermission();
|
||||
$permissionUid = ($opUid != '') ? $opUid : G::generateUniqueID();
|
||||
$data['OP_UID'] = $permissionUid;
|
||||
$data['OP_OBJ_UID'] = $sObjectUID;
|
||||
$opParticipate = empty($data['OP_PARTICIPATE']) ? ObjectPermission::OP_PARTICIPATE_NO : $data['OP_PARTICIPATE'];
|
||||
$data['OP_PARTICIPATE'] = $opParticipate;
|
||||
$data['OP_CASE_STATUS'] = $opCaseStatus;
|
||||
$data['OP_OBJ_UID'] = $opObjectUid;
|
||||
|
||||
if ($opUid == '') {
|
||||
$oOP->fromArray( $data, \BasePeer::TYPE_FIELDNAME );
|
||||
$oOP->save();
|
||||
$daraRes = $oOP->load($permissionUid);
|
||||
$daraRes = array_change_key_case($daraRes, CASE_LOWER);
|
||||
return $daraRes;
|
||||
if (empty($opUid)) {
|
||||
$objectPermission->fromArray($data, BasePeer::TYPE_FIELDNAME);
|
||||
$objectPermission->save();
|
||||
$newPermission = $objectPermission->load($permissionUid);
|
||||
$newPermission = array_change_key_case($newPermission, CASE_LOWER);
|
||||
|
||||
return $newPermission;
|
||||
} else {
|
||||
$data['TAS_UID'] = $data['TAS_UID'] != '' ? $data['TAS_UID'] : '0';
|
||||
$data['OP_TASK_SOURCE'] = $data['OP_TASK_SOURCE'] != '' ? $data['OP_TASK_SOURCE'] : '0';
|
||||
@@ -296,7 +303,8 @@ class ProcessPermissions
|
||||
$data['OP_OBJ_UID'] = $data['OP_OBJ_UID'] != '' ? $data['OP_OBJ_UID'] : '0';
|
||||
$data['OP_ACTION'] = $data['OP_ACTION'] != '' ? $data['OP_ACTION'] : '0';
|
||||
$data['OP_CASE_STATUS'] = $data['OP_CASE_STATUS'] != '' ? $data['OP_CASE_STATUS'] : '0';
|
||||
$oOP->update($data);
|
||||
|
||||
$objectPermission->update($data);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
throw $e;
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Project;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
use Exception;
|
||||
use Luracast\Restler\RestException;
|
||||
use ProcessMaker\BusinessModel\ProcessPermissions as BmProcessPermissions;
|
||||
use ProcessMaker\Services\Api;
|
||||
|
||||
/**
|
||||
* Project\ProcessPermissions Api Controller
|
||||
@@ -17,20 +19,18 @@ class ProcessPermissions extends Api
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*
|
||||
* @url GET /:prj_uid/process-permissions
|
||||
*/
|
||||
public function doGetProcessPermissions($prj_uid)
|
||||
{
|
||||
try {
|
||||
$processPermissions = new \ProcessMaker\BusinessModel\ProcessPermissions();
|
||||
$processPermissions = new BmProcessPermissions();
|
||||
$response = $processPermissions->getProcessPermissions($prj_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -39,20 +39,18 @@ class ProcessPermissions extends Api
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $ob_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @return array
|
||||
* @throws RestException
|
||||
*
|
||||
* @url GET /:prj_uid/process-permission/:ob_uid
|
||||
*/
|
||||
public function doGetProcessPermission($prj_uid, $ob_uid)
|
||||
{
|
||||
try {
|
||||
$processPermissions = new \ProcessMaker\BusinessModel\ProcessPermissions();
|
||||
$processPermissions = new BmProcessPermissions();
|
||||
$response = $processPermissions->getProcessPermissions($prj_uid, $ob_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -75,11 +73,11 @@ class ProcessPermissions extends Api
|
||||
public function doPostProcessPermission($prj_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$hiddenFields = array('task_target', 'group_user', 'task_source',
|
||||
$hiddenFields = ['task_target', 'group_user', 'task_source',
|
||||
'object_type', 'object', 'participated', 'action'
|
||||
);
|
||||
];
|
||||
$request_data['pro_uid'] = $prj_uid;
|
||||
$processPermissions = new \ProcessMaker\BusinessModel\ProcessPermissions();
|
||||
$processPermissions = new BmProcessPermissions();
|
||||
$response = $processPermissions->saveProcessPermission($request_data);
|
||||
foreach ($response as $key => $eventData) {
|
||||
if (in_array($key, $hiddenFields)) {
|
||||
@@ -87,13 +85,13 @@ class ProcessPermissions extends Api
|
||||
}
|
||||
}
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update process permisson.
|
||||
* Update process permission.
|
||||
*
|
||||
* @url PUT /:prj_uid/process-permission/:ob_uid
|
||||
*
|
||||
@@ -104,7 +102,7 @@ class ProcessPermissions extends Api
|
||||
* @param string $op_user_relation {@from body} {@choice 1,2}
|
||||
* @param string $op_case_status {@from body} {@choice ALL,DRAFT,TO_DO,PAUSED,COMPLETED}
|
||||
* @param string $op_participate {@from body} {@choice 0,1}
|
||||
* @param string $op_obj_type {@from body} {@choice ANY,DYNAFORM,ATTACHMENT,INPUT,OUTPUT,CASES_NOTES,MSGS_HISTORY,SUMMARY_FORM}
|
||||
* @param string $op_obj_type {@from body} {@choice ANY,DYNAFORM,ATTACHMENT,INPUT,OUTPUT,CASES_NOTES,MSGS_HISTORY,SUMMARY_FORM,REASSIGN_MY_CASES}
|
||||
* @param string $op_action {@from body} {@choice VIEW,BLOCK,DELETE,RESEND}
|
||||
* @param string $tas_uid {@from body}
|
||||
* @param string $op_task_source {@from body}
|
||||
@@ -124,10 +122,10 @@ class ProcessPermissions extends Api
|
||||
$request_data,
|
||||
$usr_uid,
|
||||
$op_user_relation,
|
||||
$op_case_status,
|
||||
$op_participate,
|
||||
$op_case_status = 'ALL',
|
||||
$op_participate = '0',
|
||||
$op_obj_type,
|
||||
$op_action,
|
||||
$op_action = 'VIEW',
|
||||
$tas_uid = '',
|
||||
$op_task_source = '',
|
||||
$dynaforms = '',
|
||||
@@ -136,10 +134,11 @@ class ProcessPermissions extends Api
|
||||
) {
|
||||
try {
|
||||
$request_data['pro_uid'] = $prj_uid;
|
||||
$processPermissions = new \ProcessMaker\BusinessModel\ProcessPermissions();
|
||||
$request_data['op_action'] = $op_action;
|
||||
$processPermissions = new BmProcessPermissions();
|
||||
$response = $processPermissions->saveProcessPermission($request_data, $ob_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
@@ -153,14 +152,14 @@ class ProcessPermissions extends Api
|
||||
* @param string $ob_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @return void
|
||||
* @throws RestException
|
||||
*/
|
||||
public function doDeleteProcessPermission($prj_uid, $ob_uid)
|
||||
{
|
||||
try {
|
||||
$processPermissions = new \ProcessMaker\BusinessModel\ProcessPermissions();
|
||||
$response = $processPermissions->deleteProcessPermission($ob_uid, $prj_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
$processPermissions = new BmProcessPermissions();
|
||||
$processPermissions->deleteProcessPermission($ob_uid, $prj_uid);
|
||||
} catch (Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1824,7 +1824,7 @@ Ext.onReady ( function() {
|
||||
});
|
||||
|
||||
winReassignInCasesList = new Ext.Window({
|
||||
title: '',
|
||||
title: _('ID_REASSIGN_CASE'),
|
||||
width: 450,
|
||||
height: 350,
|
||||
layout:'auto',
|
||||
|
||||
@@ -1127,7 +1127,7 @@ Ext.onReady(function(){
|
||||
});
|
||||
|
||||
var winReassignInCasesList = new Ext.Window({
|
||||
title: '',
|
||||
title: _('ID_REASSIGN_CASE'),
|
||||
width: 450,
|
||||
height: 350,
|
||||
layout: 'auto',
|
||||
|
||||
Reference in New Issue
Block a user