Merged in cochalo/processmaker/LISTS (pull request #1630)
Adicion de contadores de bandeja (y tiempo de acces token)
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
namespace ProcessMaker\BusinessModel;
|
||||
use \G;
|
||||
use \Criteria;
|
||||
use \UsersPeer;
|
||||
|
||||
/**
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
@@ -180,4 +182,45 @@ class Lists {
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get counters for lists
|
||||
*
|
||||
* @access public
|
||||
* @param array $userId, User Uid
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*/
|
||||
public function getCounters($userId)
|
||||
{
|
||||
$criteria = new Criteria();
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_INBOX);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_DRAFT);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_CANCELLED);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_PARTICIPATED);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_PAUSED);
|
||||
$criteria->addSelectColumn(UsersPeer::USR_TOTAL_COMPLETED);
|
||||
$criteria->add( UsersPeer::USR_UID, $userId, Criteria::EQUAL );
|
||||
$dataset = UsersPeer::doSelectRS($criteria);
|
||||
$dataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$dataset->next();
|
||||
$aRow = $dataset->getRow();
|
||||
|
||||
$oAppCache = new \AppCacheView();
|
||||
$totalUnassigned = $oAppCache->getListCounters('selfservice', $userId, false);
|
||||
|
||||
$response = array(
|
||||
array('count' => $aRow['USR_TOTAL_INBOX'], 'item' => 'CASES_INBOX'),
|
||||
array('count' => $aRow['USR_TOTAL_DRAFT'], 'item' => 'CASES_DRAFT'),
|
||||
array('count' => $aRow['USR_TOTAL_CANCELLED'], 'item' => 'CASES_CANCELLED'),
|
||||
array('count' => $aRow['USR_TOTAL_PARTICIPATED'], 'item' => 'CASES_SENT'),
|
||||
array('count' => $aRow['USR_TOTAL_PAUSED'], 'item' => 'CASES_PAUSED'),
|
||||
array('count' => $aRow['USR_TOTAL_COMPLETED'], 'item' => 'CASES_COMPLETED'),
|
||||
array('count' => $totalUnassigned, 'item' => 'CASES_SELFSERVICE')
|
||||
);
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
@@ -29,5 +29,27 @@ class System extends Api
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get count for all lists
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
|
||||
* @copyright Colosa - Bolivia
|
||||
*
|
||||
* @url GET /counters-lists
|
||||
*/
|
||||
public function doGetCountersLists()
|
||||
{
|
||||
try {
|
||||
$userId = $this->getUserId();
|
||||
$lists = new \ProcessMaker\BusinessModel\Lists();
|
||||
$response = $lists->getCounters($userId);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class Server implements iAuthenticate
|
||||
}
|
||||
|
||||
// Pass a storage object or array of storage objects to the OAuth2 server class
|
||||
$this->server = new \OAuth2\Server($this->storage, array('allow_implicit' => true));
|
||||
$this->server = new \OAuth2\Server($this->storage, array('allow_implicit' => true, 'access_lifetime' => 86400));
|
||||
|
||||
$this->server->setConfig('enforce_state', false);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user