Code Style
This commit is contained in:
@@ -5664,48 +5664,55 @@ class Cases
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain all user permits for Dynaforms, Input and output documents
|
* Obtain all user permits for Dynaforms, Input and output documents
|
||||||
|
* function getAllObjects ($proUid, $appUid, $tasUid, $usrUid)
|
||||||
*
|
*
|
||||||
* function getAllObjects ($PRO_UID, $APP_UID, $TAS_UID, $USR_UID)
|
|
||||||
* @author Erik Amaru Ortiz <erik@colosa.com>
|
|
||||||
* @access public
|
* @access public
|
||||||
* @param Process ID, Application ID, Task ID and User ID
|
* @param string $proUid, Process ID
|
||||||
* @return Array within all user permitions all objects' types
|
* @param string $appUid, Application ID,
|
||||||
|
* @param string $tasUid, Task ID
|
||||||
|
* @param string $usrUid, User ID
|
||||||
|
* @param integer $delIndex, User ID
|
||||||
|
*
|
||||||
|
* @return array within all user permissions all objects' types
|
||||||
*/
|
*/
|
||||||
public function getAllObjects($PRO_UID, $APP_UID, $TAS_UID = '', $USR_UID = '', $delIndex = 0)
|
public function getAllObjects($proUid, $appUid, $tasUid = '', $usrUid = '', $delIndex = 0)
|
||||||
{
|
{
|
||||||
$ACTIONS = array('VIEW', 'BLOCK', 'DELETE'); //TO COMPLETE
|
$permissionAction = ['VIEW', 'BLOCK', 'DELETE']; //TO COMPLETE
|
||||||
$MAIN_OBJECTS = array();
|
$mainObjects = [];
|
||||||
$RESULT_OBJECTS = array();
|
$resultObjects = [];
|
||||||
|
|
||||||
foreach ($ACTIONS as $action) {
|
foreach ($permissionAction as $action) {
|
||||||
$MAIN_OBJECTS[$action] = $this->getAllObjectsFrom($PRO_UID, $APP_UID, $TAS_UID, $USR_UID, $action, $delIndex);
|
$mainObjects[$action] = $this->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, $action, $delIndex);
|
||||||
}
|
}
|
||||||
/* ADDITIONAL OPERATIONS */
|
//We will review data with VIEW and BLOCK
|
||||||
/* * * BETWEN VIEW AND BLOCK** */
|
//Dynaforms BLOCK it means does not show in the list
|
||||||
$RESULT_OBJECTS['DYNAFORMS'] = G::arrayDiff(
|
$resultObjects['DYNAFORMS'] = G::arrayDiff(
|
||||||
$MAIN_OBJECTS['VIEW']['DYNAFORMS'], $MAIN_OBJECTS['BLOCK']['DYNAFORMS']
|
$mainObjects['VIEW']['DYNAFORMS'], $mainObjects['BLOCK']['DYNAFORMS']
|
||||||
);
|
);
|
||||||
$RESULT_OBJECTS['INPUT_DOCUMENTS'] = G::arrayDiff(
|
//Input BLOCK it means does not show in the list
|
||||||
$MAIN_OBJECTS['VIEW']['INPUT_DOCUMENTS'], $MAIN_OBJECTS['BLOCK']['INPUT_DOCUMENTS']
|
$resultObjects['INPUT_DOCUMENTS'] = G::arrayDiff(
|
||||||
|
$mainObjects['VIEW']['INPUT_DOCUMENTS'], $mainObjects['BLOCK']['INPUT_DOCUMENTS']
|
||||||
);
|
);
|
||||||
$RESULT_OBJECTS['OUTPUT_DOCUMENTS'] = array_merge_recursive(
|
//Output BLOCK it means does not show in the list
|
||||||
G::arrayDiff($MAIN_OBJECTS['VIEW']['OUTPUT_DOCUMENTS'], $MAIN_OBJECTS['BLOCK']['OUTPUT_DOCUMENTS']), G::arrayDiff($MAIN_OBJECTS['DELETE']['OUTPUT_DOCUMENTS'], $MAIN_OBJECTS['BLOCK']['OUTPUT_DOCUMENTS'])
|
$resultObjects['OUTPUT_DOCUMENTS'] = array_merge_recursive(
|
||||||
|
G::arrayDiff($mainObjects['VIEW']['OUTPUT_DOCUMENTS'], $mainObjects['BLOCK']['OUTPUT_DOCUMENTS']), G::arrayDiff($mainObjects['DELETE']['OUTPUT_DOCUMENTS'], $mainObjects['BLOCK']['OUTPUT_DOCUMENTS'])
|
||||||
);
|
);
|
||||||
$RESULT_OBJECTS['CASES_NOTES'] = G::arrayDiff(
|
//Case notes BLOCK it means does not show in the list
|
||||||
$MAIN_OBJECTS['VIEW']['CASES_NOTES'], $MAIN_OBJECTS['BLOCK']['CASES_NOTES']
|
$resultObjects['CASES_NOTES'] = G::arrayDiff(
|
||||||
|
$mainObjects['VIEW']['CASES_NOTES'], $mainObjects['BLOCK']['CASES_NOTES']
|
||||||
);
|
);
|
||||||
array_push($RESULT_OBJECTS["DYNAFORMS"], -1, -2);
|
array_push($resultObjects["DYNAFORMS"], -1, -2);
|
||||||
array_push($RESULT_OBJECTS['INPUT_DOCUMENTS'], -1);
|
array_push($resultObjects['INPUT_DOCUMENTS'], -1);
|
||||||
array_push($RESULT_OBJECTS['OUTPUT_DOCUMENTS'], -1);
|
array_push($resultObjects['OUTPUT_DOCUMENTS'], -1);
|
||||||
array_push($RESULT_OBJECTS['CASES_NOTES'], -1);
|
array_push($resultObjects['CASES_NOTES'], -1);
|
||||||
|
|
||||||
return $RESULT_OBJECTS;
|
return $resultObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtain all object permissions for Dynaforms, Input, Output and Message history
|
* Obtain all object permissions for Dynaforms, Input, Output and Message history
|
||||||
*
|
|
||||||
* This function return information about a specific object permissions or for all = ANY
|
* This function return information about a specific object permissions or for all = ANY
|
||||||
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $proUid
|
* @param string $proUid
|
||||||
* @param string $appUid
|
* @param string $appUid
|
||||||
@@ -5713,6 +5720,7 @@ class Cases
|
|||||||
* @param string $usrUid
|
* @param string $usrUid
|
||||||
* @param string $action some action [VIEW, BLOCK, RESEND]
|
* @param string $action some action [VIEW, BLOCK, RESEND]
|
||||||
* @param integer $delIndex
|
* @param integer $delIndex
|
||||||
|
*
|
||||||
* @return array within all user permissions all objects' types
|
* @return array within all user permissions all objects' types
|
||||||
*/
|
*/
|
||||||
public function getAllObjectsFrom($proUid, $appUid, $tasUid = '', $usrUid = '', $action = '', $delIndex = 0)
|
public function getAllObjectsFrom($proUid, $appUid, $tasUid = '', $usrUid = '', $action = '', $delIndex = 0)
|
||||||
@@ -5727,31 +5735,20 @@ class Cases
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$userPermissions = array();
|
$userPermissions = [];
|
||||||
$groupPermissions = array();
|
$groupPermissions = [];
|
||||||
$result = array(
|
|
||||||
"DYNAFORM" => array(),
|
|
||||||
"INPUT" => array(),
|
|
||||||
"ATTACHMENT" => array(),
|
|
||||||
"OUTPUT" => array(),
|
|
||||||
"CASES_NOTES" => 0,
|
|
||||||
"MSGS_HISTORY" => array()
|
|
||||||
/*----------------------------------********---------------------------------*/
|
|
||||||
, "SUMMARY_FORM" => 0
|
|
||||||
/*----------------------------------********---------------------------------*/
|
|
||||||
);
|
|
||||||
|
|
||||||
$oObjectPermission = new ObjectPermission();
|
$objectPermission = new ObjectPermission();
|
||||||
$userPermissions = $oObjectPermission->verifyObjectPermissionPerUser($usrUid, $proUid, $tasUid, $action, $caseData);
|
$userPermissions = $objectPermission->verifyObjectPermissionPerUser($usrUid, $proUid, $tasUid, $action, $caseData);
|
||||||
$groupPermissions = $oObjectPermission->verifyObjectPermissionPerGroup($usrUid, $proUid, $tasUid, $action, $caseData);
|
$groupPermissions = $objectPermission->verifyObjectPermissionPerGroup($usrUid, $proUid, $tasUid, $action, $caseData);
|
||||||
$permissions = array_merge($userPermissions, $groupPermissions);
|
$permissions = array_merge($userPermissions, $groupPermissions);
|
||||||
|
|
||||||
$resultDynaforms = [];
|
$resultDynaforms = [];
|
||||||
$resultInputs = [];
|
$resultInputs = [];
|
||||||
$resultAttachments = [];
|
$resultAttachments = [];
|
||||||
$resultOutputs = [];
|
$resultOutputs = [];
|
||||||
$resultCaseNotes = [];
|
$resultCaseNotes = 0;
|
||||||
$resultSummary = [];
|
$resultSummary = 0;
|
||||||
$resultMessages = [];
|
$resultMessages = [];
|
||||||
|
|
||||||
foreach ($permissions as $row) {
|
foreach ($permissions as $row) {
|
||||||
@@ -5766,28 +5763,28 @@ class Cases
|
|||||||
//The values of obCaseStatus is [ALL, COMPLETED, DRAFT, TO_DO, PAUSED]
|
//The values of obCaseStatus is [ALL, COMPLETED, DRAFT, TO_DO, PAUSED]
|
||||||
//If the case is todo and we need the participate
|
//If the case is todo and we need the participate
|
||||||
//but we did not participated did not validate nothing and return array empty
|
//but we did not participated did not validate nothing and return array empty
|
||||||
$sw_participate = false; // must be false for default
|
$swParticipate = false; // must be false for default
|
||||||
if ($obCaseStatus != 'COMPLETED' && $opParticipated == 1) {
|
if ($obCaseStatus != 'COMPLETED' && $opParticipated == 1) {
|
||||||
$oCriteriax = new Criteria('workflow');
|
$criteria = new Criteria('workflow');
|
||||||
$oCriteriax->add(AppDelegationPeer::USR_UID, $usrUid);
|
$criteria->add(AppDelegationPeer::USR_UID, $usrUid);
|
||||||
$oCriteriax->add(AppDelegationPeer::APP_UID, $appUid);
|
$criteria->add(AppDelegationPeer::APP_UID, $appUid);
|
||||||
$datasetx = AppDelegationPeer::doSelectRS($oCriteriax);
|
$dataset = AppDelegationPeer::doSelectRS($criteria);
|
||||||
$datasetx->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
$dataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
|
||||||
$datasetx->next();
|
$dataset->next();
|
||||||
$aRow = $datasetx->getRow();
|
$row = $dataset->getRow();
|
||||||
if (!is_array($aRow)) {
|
if (!is_array($row)) {
|
||||||
//The user was not participated in the case and the participation is required
|
//The user was not participated in the case and the participation is required
|
||||||
$sw_participate = true;
|
$swParticipate = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//If user can be see the objects process
|
//If user can be see the objects process
|
||||||
//We will be prepare the data relate to the Type can be ANY, DYNAFORM, INPUT, OUTPUT, ...
|
//We will be prepare the data relate to the Type can be ANY, DYNAFORM, INPUT, OUTPUT, ...
|
||||||
if (!$sw_participate) {
|
if (!$swParticipate) {
|
||||||
switch ($opType) {
|
switch ($opType) {
|
||||||
case 'ANY':
|
case 'ANY':
|
||||||
//For dynaforms
|
//For dynaforms
|
||||||
$listDynaform = $oObjectPermission->objectPermissionByDynaform(
|
$listDynaform = $objectPermission->objectPermissionByDynaform(
|
||||||
$appUid,
|
$appUid,
|
||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
$opObjUid,
|
$opObjUid,
|
||||||
@@ -5796,7 +5793,7 @@ class Cases
|
|||||||
$resultDynaforms = array_merge($resultDynaforms, $listDynaform);
|
$resultDynaforms = array_merge($resultDynaforms, $listDynaform);
|
||||||
|
|
||||||
//For Ouputs
|
//For Ouputs
|
||||||
$listOutput = $oObjectPermission->objectPermissionByOutputInput(
|
$listOutput = $objectPermission->objectPermissionByOutputInput(
|
||||||
$appUid,
|
$appUid,
|
||||||
$proUid,
|
$proUid,
|
||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
@@ -5807,7 +5804,7 @@ class Cases
|
|||||||
$resultOutputs = array_merge($resultOutputs, $listOutput);
|
$resultOutputs = array_merge($resultOutputs, $listOutput);
|
||||||
|
|
||||||
//For Inputs
|
//For Inputs
|
||||||
$listInput = $oObjectPermission->objectPermissionByOutputInput(
|
$listInput = $objectPermission->objectPermissionByOutputInput(
|
||||||
$appUid,
|
$appUid,
|
||||||
$proUid,
|
$proUid,
|
||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
@@ -5818,7 +5815,7 @@ class Cases
|
|||||||
$resultInputs = array_merge($resultInputs, $listInput);
|
$resultInputs = array_merge($resultInputs, $listInput);
|
||||||
|
|
||||||
//For Attachment
|
//For Attachment
|
||||||
$listAttchment = $oObjectPermission->objectPermissionByOutputInput(
|
$listAttchment = $objectPermission->objectPermissionByOutputInput(
|
||||||
$appUid,
|
$appUid,
|
||||||
$proUid,
|
$proUid,
|
||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
@@ -5834,7 +5831,7 @@ class Cases
|
|||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|
||||||
//Message History
|
//Message History
|
||||||
$listMessage = $oObjectPermission->objectPermissionMessage(
|
$listMessage = $objectPermission->objectPermissionMessage(
|
||||||
$appUid,
|
$appUid,
|
||||||
$proUid,
|
$proUid,
|
||||||
$userUid,
|
$userUid,
|
||||||
@@ -5847,7 +5844,7 @@ class Cases
|
|||||||
$resultMessages = array_merge($resultMessages, $listMessage);
|
$resultMessages = array_merge($resultMessages, $listMessage);
|
||||||
break;
|
break;
|
||||||
case 'DYNAFORM':
|
case 'DYNAFORM':
|
||||||
$listDynaform = $oObjectPermission->objectPermissionByDynaform(
|
$listDynaform = $objectPermission->objectPermissionByDynaform(
|
||||||
$appUid,
|
$appUid,
|
||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
$opObjUid,
|
$opObjUid,
|
||||||
@@ -5856,7 +5853,7 @@ class Cases
|
|||||||
$resultDynaforms = array_merge($resultDynaforms, $listDynaform);
|
$resultDynaforms = array_merge($resultDynaforms, $listDynaform);
|
||||||
break;
|
break;
|
||||||
case 'INPUT':
|
case 'INPUT':
|
||||||
$listInput= $oObjectPermission->objectPermissionByOutputInput(
|
$listInput = $objectPermission->objectPermissionByOutputInput(
|
||||||
$appUid,
|
$appUid,
|
||||||
$proUid,
|
$proUid,
|
||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
@@ -5867,7 +5864,7 @@ class Cases
|
|||||||
$resultInputs = array_merge($resultInputs, $listInput);
|
$resultInputs = array_merge($resultInputs, $listInput);
|
||||||
break;
|
break;
|
||||||
case 'ATTACHMENT':
|
case 'ATTACHMENT':
|
||||||
$listAttchment= $oObjectPermission->objectPermissionByOutputInput(
|
$listAttchment = $objectPermission->objectPermissionByOutputInput(
|
||||||
$appUid,
|
$appUid,
|
||||||
$proUid,
|
$proUid,
|
||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
@@ -5878,7 +5875,7 @@ class Cases
|
|||||||
$resultAttachments = array_merge($resultAttachments, $listAttchment);
|
$resultAttachments = array_merge($resultAttachments, $listAttchment);
|
||||||
break;
|
break;
|
||||||
case 'OUTPUT':
|
case 'OUTPUT':
|
||||||
$listOutput = $oObjectPermission->objectPermissionByOutputInput(
|
$listOutput = $objectPermission->objectPermissionByOutputInput(
|
||||||
$appUid,
|
$appUid,
|
||||||
$proUid,
|
$proUid,
|
||||||
$opTaskSource,
|
$opTaskSource,
|
||||||
@@ -5897,7 +5894,7 @@ class Cases
|
|||||||
break;
|
break;
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
case 'MSGS_HISTORY':
|
case 'MSGS_HISTORY':
|
||||||
$listMessage = $oObjectPermission->objectPermissionMessage(
|
$listMessage= $objectPermission->objectPermissionMessage(
|
||||||
$appUid,
|
$appUid,
|
||||||
$proUid,
|
$proUid,
|
||||||
$userUid,
|
$userUid,
|
||||||
|
|||||||
Reference in New Issue
Block a user