R-1055
Case counters are not working on Single Sign On Server HOR-1055 Case counters are not working on Single Sign On Server HOR-1055 Case counters are not working on Single Sign On Server
This commit is contained in:
@@ -12,6 +12,11 @@ switch ($action) {
|
||||
case 'getProcess':
|
||||
getProcess();
|
||||
break;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
case 'getAllCountersEnterprise':
|
||||
getAllCountersEnterprise();
|
||||
break;
|
||||
/*----------------------------------********---------------------------------*/
|
||||
default: //this is the starting call
|
||||
getLoadTreeMenuData();
|
||||
break;
|
||||
@@ -271,6 +276,20 @@ function getProcess ()
|
||||
echo G::json_encode( $response );
|
||||
}
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
function getAllCountersEnterprise()
|
||||
{
|
||||
try {
|
||||
$userUid = (isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '') ? $_SESSION['USER_LOGGED'] : null;
|
||||
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $lists->getCounters($userUid);
|
||||
echo G::json_encode($response);
|
||||
} catch (\Exception $e) {
|
||||
throw (new Exception($e->getMessage()));
|
||||
}
|
||||
}
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
function getAllCounters ()
|
||||
{
|
||||
$userUid = (isset( $_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '') ? $_SESSION['USER_LOGGED'] : null;
|
||||
|
||||
@@ -124,46 +124,13 @@ if ($oServerConf->isRtl( SYS_LANG )) {
|
||||
|
||||
$urlProxy = 'casesMenuLoader?action=getAllCounters&r=';
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$urlProxy = System::getHttpServerHostnameRequestsFrontEnd() . '/api/1.0/' . SYS_SYS . '/system/counters-lists?r=';
|
||||
$clientId = 'x-pm-local-client';
|
||||
$client = getClientCredentials($clientId);
|
||||
$authCode = getAuthorizationCode($client);
|
||||
$debug = false; //System::isDebugMode();
|
||||
|
||||
$loader = Maveriks\Util\ClassLoader::getInstance();
|
||||
$loader->add(PATH_TRUNK . 'vendor/bshaffer/oauth2-server-php/src/', "OAuth2");
|
||||
|
||||
$request = array(
|
||||
'grant_type' => 'authorization_code',
|
||||
'code' => $authCode
|
||||
);
|
||||
$server = array(
|
||||
'REQUEST_METHOD' => 'POST'
|
||||
);
|
||||
$headers = array(
|
||||
"PHP_AUTH_USER" => $client['CLIENT_ID'],
|
||||
"PHP_AUTH_PW" => $client['CLIENT_SECRET'],
|
||||
"Content-Type" => "multipart/form-data;",
|
||||
"Authorization" => "Basic " . base64_encode($client['CLIENT_ID'] . ":" . $client['CLIENT_SECRET'])
|
||||
);
|
||||
|
||||
$request = new \OAuth2\Request(array(), $request, array(), array(), array(), $server, null, $headers);
|
||||
$oauthServer = new \ProcessMaker\Services\OAuth2\Server();
|
||||
$response = $oauthServer->postToken($request, true);
|
||||
|
||||
$clientToken = $response->getParameters();
|
||||
$clientToken["client_id"] = $client['CLIENT_ID'];
|
||||
$clientToken["client_secret"] = $client['CLIENT_SECRET'];
|
||||
$urlProxy = 'casesMenuLoader?action=getAllCountersEnterprise&r=';
|
||||
/*----------------------------------********---------------------------------*/
|
||||
|
||||
|
||||
$oHeadPublisher->assign('regionTreePanel', $regionTreePanel);
|
||||
$oHeadPublisher->assign('regionDebug', $regionDebug);
|
||||
$oHeadPublisher->assign("defaultOption", $defaultOption); //User menu permissions
|
||||
$oHeadPublisher->assign('urlProxy', $urlProxy); //sending the urlProxy to make
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$oHeadPublisher->assign( 'credentials', $clientToken );
|
||||
/*----------------------------------********---------------------------------*/
|
||||
$oHeadPublisher->assign("_nodeId", isset($confDefaultOption) ? $confDefaultOption : "PM_USERS"); //User menu permissions
|
||||
$oHeadPublisher->assign("FORMATS", $conf->getFormats());
|
||||
|
||||
@@ -171,7 +138,6 @@ $_SESSION["current_ux"] = "NORMAL";
|
||||
|
||||
G::RenderPage("publish", "extJs");
|
||||
|
||||
|
||||
/*----------------------------------********---------------------------------*/
|
||||
function getClientCredentials($clientId)
|
||||
{
|
||||
|
||||
@@ -566,7 +566,6 @@ function updateCasesView(viewList) {
|
||||
}
|
||||
|
||||
function updateCasesTree() {
|
||||
//treeMenuItems.root.reload();
|
||||
document.getElementById('refreshNotifiers').src = '/images/ext/default/grid/loading.gif';
|
||||
|
||||
itemsTypes = Array('CASES_INBOX', 'CASES_DRAFT', 'CASES_CANCELLED', 'CASES_SENT', 'CASES_PAUSED', 'CASES_COMPLETED', 'CASES_SELFSERVICE');
|
||||
@@ -575,13 +574,6 @@ function updateCasesTree() {
|
||||
}
|
||||
Ext.Ajax.request({
|
||||
url: urlProxy + Math.random(),
|
||||
/*----------------------------------********---------------------------------*/
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': 'Bearer ' + credentials.access_token
|
||||
},
|
||||
method: 'GET',
|
||||
/*----------------------------------********---------------------------------*/
|
||||
success: function (response) {
|
||||
result = Ext.util.JSON.decode(response.responseText);
|
||||
|
||||
@@ -605,12 +597,11 @@ function updateCasesTree() {
|
||||
else continue;
|
||||
}
|
||||
document.getElementById('refreshNotifiers').src = '/images/refresh.gif';
|
||||
|
||||
},
|
||||
failure: function(){},
|
||||
failure: function () {
|
||||
},
|
||||
params: {'updateCasesTree': true}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
setFlag = function (val) {
|
||||
|
||||
Reference in New Issue
Block a user