コード例 #1
0
list($iRelation, $sUserGroup) = explode('|', $sValue['GROUP_USER']);
$sObjectUID = '';
switch ($sValue['OP_OBJ_TYPE']) {
    case 'ANY':
        /*case 'ANY_DYNAFORM':
          case 'ANY_INPUT':
          case 'ANY_OUTPUT':*/
        $sObjectUID = '';
        break;
    case 'DYNAFORM':
        $sObjectUID = $sValue['DYNAFORMS'];
        break;
    case 'INPUT':
        $sObjectUID = $sValue['INPUTS'];
        break;
    case 'OUTPUT':
        $sObjectUID = $sValue['OUTPUTS'];
        break;
}
require_once 'classes/model/ObjectPermission.php';
$oOP = new ObjectPermission();
$aData = array('OP_UID' => G::generateUniqueID(), 'PRO_UID' => $sValue['PRO_UID'], 'TAS_UID' => $sValue['TAS_UID'], 'USR_UID' => (string) $sUserGroup, 'OP_USER_RELATION' => $iRelation, 'OP_TASK_SOURCE' => $sValue['OP_TASK_SOURCE'], 'OP_PARTICIPATE' => $sValue['OP_PARTICIPATE'], 'OP_OBJ_TYPE' => $sValue['OP_OBJ_TYPE'], 'OP_OBJ_UID' => $sObjectUID, 'OP_ACTION' => $sValue['OP_ACTION'], 'OP_CASE_STATUS' => $sValue['OP_CASE_STATUS']);
$oOP->fromArray($aData, BasePeer::TYPE_FIELDNAME);
$oOP->save();
G::LoadClass('processMap');
$oProcessMap = new ProcessMap();
$oProcessMap->getObjectsPermissionsCriteria($sValue['PRO_UID']);
$infoProcess = new Processes();
$resultProcess = $infoProcess->getProcessRow($sValue['PRO_UID']);
$participation = $sValue['OP_PARTICIPATE'] == 1 ? "YES" : "NO";
G::auditLog('ProcessPermissions', 'Add Permission (group or user: '******'|', $sValue['GROUP_USER'])) . ', permission: ' . $sValue['OP_ACTION'] . ', status case: ' . $sValue['OP_CASE_STATUS'] . ', type: ' . $sValue['OP_OBJ_TYPE'] . ', participation required: ' . $participation . ') in Process "' . $resultProcess['PRO_TITLE'] . '"');
コード例 #2
0
 /**
  * Save Process Permission
  *
  * @var array $data. Data for Process Permission
  * @var string $op_uid. Uid for Process Permission
  *
  * @access public
  * @author Brayan Pereyra (Cochalo) <*****@*****.**>
  * @copyright Colosa - Bolivia
  *
  * @return void
  */
 public function saveProcessPermission($data, $op_uid = '')
 {
     try {
         $data = array_change_key_case($data, CASE_UPPER);
         $this->validateProUid($data['PRO_UID']);
         if ($op_uid != '') {
             $op_uid = $this->validateOpUid($op_uid);
         }
         if ($data['OP_USER_RELATION'] == "1") {
             $this->validateUsrUid($data['USR_UID']);
         } else {
             $this->validateGrpUid($data['USR_UID']);
         }
         if (isset($data['TAS_UID']) && $data['TAS_UID'] != '') {
             $this->validateTasUid($data['TAS_UID']);
         } else {
             $data['TAS_UID'] = '';
         }
         if (isset($data['OP_TASK_SOURCE']) && $data['OP_TASK_SOURCE'] != '') {
             $this->validateTasUid($data['OP_TASK_SOURCE']);
         } else {
             $data['OP_TASK_SOURCE'] = '';
         }
         $sObjectUID = '';
         switch ($data['OP_OBJ_TYPE']) {
             case 'ANY':
                 //case 'ANY_DYNAFORM':CASES_NOTES
                 //case 'ANY_INPUT':
                 //case 'ANY_OUTPUT':
                 $sObjectUID = '';
                 break;
             case 'DYNAFORM':
                 $data['DYNAFORMS'] = $data['DYNAFORMS'] == 0 ? '' : $data['DYNAFORMS'];
                 if ($data['DYNAFORMS'] != '') {
                     $this->validateDynUid($data['DYNAFORMS']);
                 }
                 $sObjectUID = $data['DYNAFORMS'];
                 break;
             case 'INPUT':
                 $data['INPUTS'] = $data['INPUTS'] == 0 ? '' : $data['INPUTS'];
                 if ($data['INPUTS'] != '') {
                     $this->validateInpUid($data['INPUTS']);
                 }
                 $sObjectUID = $data['INPUTS'];
                 break;
             case 'OUTPUT':
                 $data['OUTPUTS'] = $data['OUTPUTS'] == 0 ? '' : $data['OUTPUTS'];
                 if ($data['OUTPUTS'] != '') {
                     $this->validateOutUid($data['OUTPUTS']);
                 }
                 $sObjectUID = $data['OUTPUTS'];
                 break;
         }
         $oOP = new \ObjectPermission();
         $permissionUid = $op_uid != '' ? $op_uid : G::generateUniqueID();
         $data['OP_UID'] = $permissionUid;
         $data['OP_OBJ_UID'] = $sObjectUID;
         if ($op_uid == '') {
             $oOP->fromArray($data, \BasePeer::TYPE_FIELDNAME);
             $oOP->save();
             $daraRes = $oOP->load($permissionUid);
             $daraRes = array_change_key_case($daraRes, CASE_LOWER);
             return $daraRes;
         } else {
             $data['TAS_UID'] = $data['TAS_UID'] != '' ? $data['TAS_UID'] : '0';
             $data['OP_TASK_SOURCE'] = $data['OP_TASK_SOURCE'] != '' ? $data['OP_TASK_SOURCE'] : '0';
             $data['OP_PARTICIPATE'] = $data['OP_PARTICIPATE'] != '' ? $data['OP_PARTICIPATE'] : 0;
             $data['OP_OBJ_TYPE'] = $data['OP_OBJ_TYPE'] != '' ? $data['OP_OBJ_TYPE'] : '0';
             $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);
         }
     } catch (Exception $e) {
         throw $e;
     }
 }