conflicts
This commit is contained in:
@@ -59,6 +59,7 @@ class ActionsByEmail
|
||||
$configuration['ABE_SUBJECT_FIELD'] = $configuration['ABE_SUBJECT_FIELD'];
|
||||
$configuration['ABE_EMAIL_FIELD'] = $configuration['ABE_EMAIL_FIELD'];
|
||||
$configuration['ABE_ACTION_FIELD'] = $configuration['ABE_ACTION_FIELD'];
|
||||
$configuration['ABE_MAILSERVER_OR_MAILCURRENT'] = $configuration['ABE_MAILSERVER_OR_MAILCURRENT'];
|
||||
$configuration['ABE_CASE_NOTE_IN_RESPONSE'] = $configuration['ABE_CASE_NOTE_IN_RESPONSE'] ? '["1"]' : '[]';
|
||||
}
|
||||
$configuration['feature'] = 'ActionsByEmail';
|
||||
|
||||
@@ -49,16 +49,25 @@ class Cases
|
||||
* Verify if does not exist the Case in table APPLICATION
|
||||
*
|
||||
* @param string $applicationUid Unique id of Case
|
||||
* @param string $delIndex Delegation index
|
||||
* @param string $fieldNameForException Field name for the exception
|
||||
*
|
||||
* return void Throw exception if does not exist the Case in table APPLICATION
|
||||
*/
|
||||
public function throwExceptionIfNotExistsCase($applicationUid, $fieldNameForException)
|
||||
public function throwExceptionIfNotExistsCase($applicationUid, $delIndex, $fieldNameForException)
|
||||
{
|
||||
try {
|
||||
$obj = \ApplicationPeer::retrieveByPK($applicationUid);
|
||||
|
||||
if (is_null($obj)) {
|
||||
$flag = is_null($obj);
|
||||
|
||||
if (!$flag && $delIndex > 0) {
|
||||
$obj = \AppDelegationPeer::retrieveByPK($applicationUid, $delIndex);
|
||||
|
||||
$flag = is_null($obj);
|
||||
}
|
||||
|
||||
if ($flag) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_CASE_DOES_NOT_EXIST2", array($fieldNameForException, $applicationUid)));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
@@ -440,7 +449,7 @@ class Cases
|
||||
\G::LoadClass("wsBase");
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsCase($applicationUid, $this->getFieldNameByFormatFieldName("APP_UID"));
|
||||
$this->throwExceptionIfNotExistsCase($applicationUid, 0, $this->getFieldNameByFormatFieldName("APP_UID"));
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
@@ -536,7 +545,7 @@ class Cases
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsCase($applicationUid, $this->getFieldNameByFormatFieldName("APP_UID"));
|
||||
$this->throwExceptionIfNotExistsCase($applicationUid, 0, $this->getFieldNameByFormatFieldName("APP_UID"));
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
@@ -1586,6 +1595,16 @@ class Cases
|
||||
Validator::isString($usr_uid, '$usr_uid');
|
||||
Validator::usrUid($usr_uid, '$usr_uid');
|
||||
|
||||
$arrayResult = $this->getStatusInfo($app_uid);
|
||||
|
||||
if ($arrayResult["APP_STATUS"] == "CANCELLED") {
|
||||
throw new \Exception(\G::LoadTranslation("ID_CASE_CANCELLED", array($app_uid)));
|
||||
}
|
||||
|
||||
if ($arrayResult["APP_STATUS"] == "COMPLETED") {
|
||||
throw new \Exception(\G::LoadTranslation("ID_CASE_IS_COMPLETED", array($app_uid)));
|
||||
}
|
||||
|
||||
$appCacheView = new \AppCacheView();
|
||||
$isProcessSupervisor = $appCacheView->getProUidSupervisor($usr_uid);
|
||||
$criteria = new \Criteria("workflow");
|
||||
@@ -1805,7 +1824,7 @@ class Cases
|
||||
$arrayTask = array();
|
||||
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsCase($applicationUid, $this->getFieldNameByFormatFieldName("APP_UID"));
|
||||
$this->throwExceptionIfNotExistsCase($applicationUid, 0, $this->getFieldNameByFormatFieldName("APP_UID"));
|
||||
|
||||
//Set variables
|
||||
$process = new \Process();
|
||||
@@ -2363,14 +2382,16 @@ class Cases
|
||||
* Get status info Case
|
||||
*
|
||||
* @param string $applicationUid Unique id of Case
|
||||
* @param int $del_index {@min 1}
|
||||
* @param string $userUid Unique id of User
|
||||
*
|
||||
* return array Return an array with status info Case, array empty otherwise
|
||||
*/
|
||||
public function getStatusInfo($applicationUid)
|
||||
public function getStatusInfo($applicationUid, $delIndex = 0, $userUid = "")
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsCase($applicationUid, $this->getFieldNameByFormatFieldName("APP_UID"));
|
||||
$this->throwExceptionIfNotExistsCase($applicationUid, $delIndex, $this->getFieldNameByFormatFieldName("APP_UID"));
|
||||
|
||||
//Get data
|
||||
//Status is PAUSED
|
||||
@@ -2388,6 +2409,14 @@ class Cases
|
||||
$criteria->getNewCriterion(\AppDelayPeer::APP_DISABLE_ACTION_USER, 0, \Criteria::EQUAL))
|
||||
);
|
||||
|
||||
if ($delIndex != 0) {
|
||||
$criteria->add(\AppDelayPeer::APP_DEL_INDEX, $delIndex, \Criteria::EQUAL);
|
||||
}
|
||||
|
||||
if ($userUid != "") {
|
||||
$criteria->add(\AppDelayPeer::APP_DELEGATION_USER, $userUid, \Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$rsCriteria = \AppDelayPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
@@ -2421,6 +2450,14 @@ class Cases
|
||||
$criteria->getNewCriterion(\AppThreadPeer::APP_THREAD_STATUS, "OPEN"))
|
||||
);
|
||||
|
||||
if ($delIndex != 0) {
|
||||
$criteria->add(\AppDelegationPeer::DEL_INDEX, $delIndex, \Criteria::EQUAL);
|
||||
}
|
||||
|
||||
if ($userUid != "") {
|
||||
$criteria->add(\AppDelegationPeer::USR_UID, $userUid, \Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$rsCriteria = \ApplicationPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
@@ -2445,6 +2482,14 @@ class Cases
|
||||
$criteria->add(\ApplicationPeer::APP_STATUS, array("CANCELLED", "COMPLETED"), \Criteria::IN);
|
||||
$criteria->add(\AppDelegationPeer::DEL_LAST_INDEX, 1, \Criteria::EQUAL);
|
||||
|
||||
if ($delIndex != 0) {
|
||||
$criteria->add(\AppDelegationPeer::DEL_INDEX, $delIndex, \Criteria::EQUAL);
|
||||
}
|
||||
|
||||
if ($userUid != "") {
|
||||
$criteria->add(\AppDelegationPeer::USR_UID, $userUid, \Criteria::EQUAL);
|
||||
}
|
||||
|
||||
$rsCriteria = \ApplicationPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
|
||||
@@ -3,6 +3,169 @@ namespace ProcessMaker\BusinessModel\Cases;
|
||||
|
||||
class OutputDocument
|
||||
{
|
||||
/**
|
||||
* Check if the user has permissions
|
||||
*
|
||||
* @param string $applicationUid Unique id of Case
|
||||
* @param string $delIndex Delegation index
|
||||
* @param string $userUid Unique id of User
|
||||
* @param string $appDocumentUid
|
||||
*
|
||||
* return void Throw exception the user does not have permission to delete
|
||||
*/
|
||||
public function throwExceptionIfHaventPermissionToDelete($applicationUid, $delIndex, $userUid, $appDocumentUid)
|
||||
{
|
||||
try {
|
||||
//Verify data inbox
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$arrayResult = $case->getStatusInfo($applicationUid, $delIndex, $userUid);
|
||||
|
||||
$flagInbox = 1;
|
||||
|
||||
if (empty($arrayResult) || !preg_match("/^(?:TO_DO|DRAFT)$/", $arrayResult["APP_STATUS"])) {
|
||||
$flagInbox = 0;
|
||||
}
|
||||
|
||||
//Verify data permission
|
||||
$flagPermission = 0;
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\AppDocumentPeer::DOC_UID);
|
||||
|
||||
$criteria->add(\AppDocumentPeer::APP_DOC_UID, $appDocumentUid, \Criteria::EQUAL);
|
||||
$criteria->add(\AppDocumentPeer::APP_UID, $applicationUid, \Criteria::EQUAL);
|
||||
$criteria->add(\AppDocumentPeer::APP_DOC_TYPE, "OUTPUT", \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \AppDocumentPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($rsCriteria->next()) {
|
||||
$row = $rsCriteria->getRow();
|
||||
|
||||
$outputDocumentUid = $row["DOC_UID"];
|
||||
|
||||
$application = \ApplicationPeer::retrieveByPK($applicationUid);
|
||||
|
||||
//Criteria
|
||||
$criteria2 = new \Criteria("workflow");
|
||||
|
||||
$criteria2->addSelectColumn(\ObjectPermissionPeer::OP_UID);
|
||||
|
||||
$criteria2->add(\ObjectPermissionPeer::PRO_UID, $application->getProUid(), \Criteria::EQUAL);
|
||||
$criteria2->add(\ObjectPermissionPeer::OP_OBJ_TYPE, "OUTPUT", \Criteria::EQUAL);
|
||||
$criteria2->add(
|
||||
$criteria2->getNewCriterion(\ObjectPermissionPeer::OP_OBJ_UID, $outputDocumentUid, \Criteria::EQUAL)->addOr(
|
||||
$criteria2->getNewCriterion(\ObjectPermissionPeer::OP_OBJ_UID, "0", \Criteria::EQUAL))->addOr(
|
||||
$criteria2->getNewCriterion(\ObjectPermissionPeer::OP_OBJ_UID, "", \Criteria::EQUAL))
|
||||
);
|
||||
$criteria2->add(\ObjectPermissionPeer::OP_ACTION, "DELETE", \Criteria::EQUAL);
|
||||
|
||||
//User
|
||||
$criteriaU = clone $criteria2;
|
||||
|
||||
$criteriaU->add(\ObjectPermissionPeer::OP_USER_RELATION, 1, \Criteria::EQUAL);
|
||||
$criteriaU->add(\ObjectPermissionPeer::USR_UID, $userUid, \Criteria::EQUAL);
|
||||
|
||||
$rsCriteriaU = \ObjectPermissionPeer::doSelectRS($criteriaU);
|
||||
$rsCriteriaU->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($rsCriteriaU->next()) {
|
||||
$flagPermission = 1;
|
||||
}
|
||||
|
||||
//Group
|
||||
if ($flagPermission == 0) {
|
||||
$criteriaG = clone $criteria2;
|
||||
|
||||
$criteriaG->add(\ObjectPermissionPeer::OP_USER_RELATION, 2, \Criteria::EQUAL);
|
||||
|
||||
$criteriaG->addJoin(\ObjectPermissionPeer::USR_UID, \GroupUserPeer::GRP_UID, \Criteria::LEFT_JOIN);
|
||||
$criteriaG->add(\GroupUserPeer::USR_UID, $userUid, \Criteria::EQUAL);
|
||||
|
||||
$rsCriteriaG = \ObjectPermissionPeer::doSelectRS($criteriaG);
|
||||
$rsCriteriaG->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if ($rsCriteriaG->next()) {
|
||||
$flagPermission = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($flagInbox == 1) {
|
||||
if ($flagPermission == 0) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_USER_NOT_HAVE_PERMISSION_DELETE_OUTPUT_DOCUMENT", array($userUid)));
|
||||
}
|
||||
} else {
|
||||
if ($flagPermission == 0) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_USER_NOT_HAVE_PERMISSION_DELETE_OUTPUT_DOCUMENT", array($userUid)));
|
||||
}
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if does not exists the inbox
|
||||
*
|
||||
* @param string $applicationUid Unique id of Case
|
||||
* @param string $delIndex Delegation index
|
||||
* @param string $userUid Unique id of User
|
||||
*
|
||||
* return void Throw exception if not exists in inbox
|
||||
*/
|
||||
public function throwExceptionIfCaseNotIsInInbox($applicationUid, $delIndex, $userUid)
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$arrayResult = $case->getStatusInfo($applicationUid, $delIndex, $userUid);
|
||||
|
||||
if (empty($arrayResult) || !preg_match("/^(?:TO_DO|DRAFT)$/", $arrayResult["APP_STATUS"])) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_USER_NOT_HAVE_PERMISSION", array($userUid)));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if not exists OuputDocument in Steps
|
||||
*
|
||||
* @param string $applicationUid Unique id of Case
|
||||
* @param string $delIndex Delegation index
|
||||
* @param string $outDocUuid
|
||||
*
|
||||
* return void Throw exception if not exists OuputDocument in Steps
|
||||
*/
|
||||
public function throwExceptionIfOuputDocumentNotExistsInSteps($applicacionUid, $delIndex, $outputDocumentUid)
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
$appDelegation = \AppDelegationPeer::retrieveByPK($applicacionUid, $delIndex);
|
||||
|
||||
$taskUid = $appDelegation->getTasUid();
|
||||
|
||||
$criteria = new \Criteria("workflow");
|
||||
|
||||
$criteria->addSelectColumn(\StepPeer::STEP_UID);
|
||||
|
||||
$criteria->add(\StepPeer::TAS_UID, $taskUid, \Criteria::EQUAL);
|
||||
$criteria->add(\StepPeer::STEP_TYPE_OBJ, "OUTPUT_DOCUMENT", \Criteria::EQUAL);
|
||||
$criteria->add(\StepPeer::STEP_UID_OBJ, $outputDocumentUid, \Criteria::EQUAL);
|
||||
|
||||
$rsCriteria = \StepPeer::doSelectRS($criteria);
|
||||
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
|
||||
if (!$rsCriteria->next()) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_CASES_OUTPUT_DOES_NOT_EXIST", array($outputDocumentUid)));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get data of Cases OutputDocument
|
||||
*
|
||||
|
||||
@@ -581,7 +581,10 @@ class FilesManager
|
||||
try {
|
||||
$oProcessFiles = \ProcessFilesPeer::retrieveByPK($prfUid);
|
||||
$fcontent = file_get_contents($oProcessFiles->getPrfPath());
|
||||
$sFile = end(explode("/",$oProcessFiles->getPrfPath()));
|
||||
$pth = $oProcessFiles->getPrfPath();
|
||||
$pth = str_replace("\\","/",$pth);
|
||||
$prfPath = explode("/",$pth);
|
||||
$sFile = end($prfPath);
|
||||
$path = $oProcessFiles->getPrfPath();
|
||||
$sPath = str_replace($sFile,'',$path);
|
||||
$sSubDirectory = substr(str_replace($sProcessUID,'',substr($sPath,(strpos($sPath, $sProcessUID)))),0,-1);
|
||||
|
||||
@@ -271,11 +271,23 @@ class Light
|
||||
{
|
||||
try {
|
||||
$oCase = new \Cases();
|
||||
$oUser = new \Users();
|
||||
|
||||
$this->lookinginforContentProcess( $proUid );
|
||||
|
||||
$aData = $oCase->startCase( $taskUid, $userId );
|
||||
|
||||
$aUserLog = $oUser->loadDetailed($userId);
|
||||
$_SESSION['APPLICATION'] = $aData['APPLICATION'];
|
||||
$_SESSION['INDEX'] = $aData['INDEX'];
|
||||
$_SESSION['PROCESS'] = $aData['PROCESS'];
|
||||
$_SESSION['TASK'] = $taskUid;
|
||||
$_SESSION["USER_LOGGED"] = $userId;
|
||||
$_SESSION["USR_USERNAME"] = $aUserLog['USR_USERNAME'];
|
||||
|
||||
$aFields = $oCase->loadCase( $aData['APPLICATION'], $aData['INDEX'] );
|
||||
$oCase->updateCase( $aData['APPLICATION'], $aFields );
|
||||
|
||||
$response = array();
|
||||
$response['caseId'] = $aData['APPLICATION'];
|
||||
$response['caseIndex'] = $aData['INDEX'];
|
||||
@@ -1232,6 +1244,16 @@ class Light
|
||||
$fields = \System::getSysInfo();
|
||||
$response['version'] = $fields['PM_VERSION'];
|
||||
|
||||
$conf = new \Configurations();
|
||||
$confEnvironment = $conf->getFormats();
|
||||
|
||||
$response['environment'] = array();
|
||||
if (is_array($confEnvironment)){
|
||||
$response['environment']['format'] = isset($confEnvironment['format'])?$confEnvironment['format']:'';
|
||||
$response['environment']['dateFormat'] = isset($confEnvironment['dateFormat'])?$confEnvironment['dateFormat']:'';
|
||||
$response['environment']['casesListDateFormat'] = isset($confEnvironment['casesListDateFormat'])?$confEnvironment['casesListDateFormat']:'';
|
||||
}
|
||||
|
||||
$Translations = new \Translation;
|
||||
$translationsTable = $Translations->getTranslationEnvironments();
|
||||
$languagesList = array ();
|
||||
|
||||
@@ -399,7 +399,9 @@ abstract class Importer
|
||||
unset($arrayWorkflowTables["process"]["PRO_CREATE_USER"]);
|
||||
unset($arrayWorkflowTables["process"]["PRO_CREATE_DATE"]);
|
||||
unset($arrayWorkflowTables["process"]["PRO_UPDATE_DATE"]);
|
||||
|
||||
unset($arrayWorkflowTables["process"]["PRO_CATEGORY"]);
|
||||
unset($arrayWorkflowTables["process"]["PRO_CATEGORY_LABEL"]);
|
||||
|
||||
$workflow->update($arrayWorkflowTables["process"]);
|
||||
|
||||
//Process-Files upgrade
|
||||
|
||||
@@ -56,26 +56,35 @@ class OutputDocument extends Api
|
||||
{
|
||||
try {
|
||||
$outputDocument = new \ProcessMaker\BusinessModel\Cases\OutputDocument();
|
||||
$outputDocument->throwExceptionIfHaventPermissionToDelete($app_uid, 0, $this->getUserId(), $app_doc_uid);
|
||||
$outputDocument->removeOutputDocument($app_doc_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:app_uid/output-document
|
||||
* @url POST /:app_uid/:del_index/output-document/:out_doc_uid
|
||||
*
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
* @param string $out_doc_uid {@min 32}{@max 32}
|
||||
* @param string $app_uid {@min 32}{@max 32}
|
||||
* @param int $del_index {@min 1}
|
||||
* @param string $out_doc_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doPostOutputDocument($app_uid, $out_doc_uid)
|
||||
public function doPostOutputDocument($app_uid, $del_index, $out_doc_uid)
|
||||
{
|
||||
try {
|
||||
$userUid = $this->getUserId();
|
||||
|
||||
$case = new \ProcessMaker\BusinessModel\Cases();
|
||||
$outputDocument = new \ProcessMaker\BusinessModel\Cases\OutputDocument();
|
||||
$outputDocument->throwExceptionIfCaseNotIsInInbox($app_uid, $del_index, $userUid);
|
||||
$outputDocument->throwExceptionIfOuputDocumentNotExistsInSteps($app_uid, $del_index, $out_doc_uid);
|
||||
$response = $outputDocument->addCasesOutputDocument($app_uid, $out_doc_uid, $userUid);
|
||||
|
||||
//Return
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,5 +347,37 @@ class Project extends Api
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:prj_uid/update-route-order
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doPutUpdateRouteOrder($prj_uid, $request_data)
|
||||
{
|
||||
try {
|
||||
$oRoute = new \Route();
|
||||
$result = $oRoute->updateRouteOrder($request_data);
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url PUT /:prj_uid/update-route-order-from-project
|
||||
*
|
||||
* @param string $prj_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doPutUpdateRouteOrderFromProject($prj_uid)
|
||||
{
|
||||
try {
|
||||
$oRoute = new \Route();
|
||||
$result = $oRoute->updateRouteOrderFromProject($prj_uid);
|
||||
return $result;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,6 @@ class ProcessPermissions extends Api
|
||||
/**
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
@@ -40,7 +39,6 @@ class ProcessPermissions extends Api
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $ob_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
@@ -75,7 +73,6 @@ class ProcessPermissions extends Api
|
||||
* @param string $inputs {@from body}
|
||||
* @param string $outputs {@from body}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
@@ -134,7 +131,6 @@ class ProcessPermissions extends Api
|
||||
* @param string $inputs {@from body}
|
||||
* @param string $outputs {@from body}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
@@ -172,7 +168,6 @@ class ProcessPermissions extends Api
|
||||
* @param string $prj_uid {@min 1} {@max 32}
|
||||
* @param string $ob_uid {@min 1} {@max 32}
|
||||
*
|
||||
* @access public
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
|
||||
@@ -296,14 +296,5 @@ class PmPdo implements \OAuth2\Storage\AuthorizationCodeInterface,
|
||||
return array_merge($a, array_change_key_case($a, $case));
|
||||
}
|
||||
|
||||
public function loadPostEnvironment($request = null)
|
||||
{
|
||||
if (!defined('SYS_LANG')) {
|
||||
$acceptLanguage =$request->headers('ACCEPT_LANGUAGE');
|
||||
$lang = (!is_null($acceptLanguage) && strlen($acceptLanguage)<=2)?$acceptLanguage:'en';
|
||||
define("SYS_LANG", $lang);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -285,8 +285,6 @@ class Server implements iAuthenticate
|
||||
$request = \OAuth2\Request::createFromGlobals();
|
||||
}
|
||||
|
||||
$this->storage->loadPostEnvironment($request);
|
||||
|
||||
$response = $this->server->handleTokenRequest($request); //Set/Get token //PmPdo->setAccessToken()
|
||||
|
||||
$token = $response->getParameters();
|
||||
@@ -334,7 +332,6 @@ class Server implements iAuthenticate
|
||||
public function __isAllowed()
|
||||
{
|
||||
$request = \OAuth2\Request::createFromGlobals();
|
||||
$this->storage->loadPostEnvironment($request);
|
||||
$allowed = $this->server->verifyResourceRequest($request);
|
||||
$token = $this->server->getAccessTokenData($request);
|
||||
self::$userId = $token['user_id'];
|
||||
@@ -394,5 +391,29 @@ class Server implements iAuthenticate
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public static function loadPostEnvironment($request = null)
|
||||
{
|
||||
$acceptLanguage = 'en';
|
||||
if ($request == null) {
|
||||
$request = \OAuth2\Request::createFromGlobals();
|
||||
$acceptLanguage = $request->headers('ACCEPT_LANGUAGE');
|
||||
}
|
||||
|
||||
if (!defined('SYS_LANG')) {
|
||||
$Translations = new \Translation;
|
||||
$translationsTable = $Translations->getTranslationEnvironments();
|
||||
$inLang = false;
|
||||
foreach ($translationsTable as $locale) {
|
||||
if ($locale['LOCALE'] == $acceptLanguage){
|
||||
$inLang = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
$lang = $inLang?$acceptLanguage:'en';
|
||||
define("SYS_LANG", $lang);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user