PM-3370 "REST endpoint GET calendars, pmtable y..." SOLVED

This commit is contained in:
Luis Fernando Saisa Lopez
2015-09-04 18:22:20 -04:00
parent 57152681ce
commit 6cc3bab936
3 changed files with 48 additions and 2 deletions

View File

@@ -13,6 +13,26 @@ class Calendar extends Api
{
private $formatFieldNameInUppercase = false;
/**
* Constructor of the class
*
* return void
*/
public function __construct()
{
try {
$user = new \ProcessMaker\BusinessModel\User();
$usrUid = $this->getUserId();
if (!$user->checkPermission($usrUid, "PM_SETUP")) {
throw new \Exception(\G::LoadTranslation("ID_USER_NOT_HAVE_PERMISSION", array($usrUid)));
}
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @url GET
*/
@@ -21,7 +41,6 @@ class Calendar extends Api
try {
$calendar = new \ProcessMaker\BusinessModel\Calendar();
$calendar->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
$response = $calendar->getCalendars(array("filter" => $filter), null, null, $start, $limit);
return $response;
@@ -40,7 +59,6 @@ class Calendar extends Api
try {
$calendar = new \ProcessMaker\BusinessModel\Calendar();
$calendar->setFormatFieldNameInUppercase($this->formatFieldNameInUppercase);
$response = $calendar->getCalendar($cal_uid);
return $response;

View File

@@ -11,6 +11,26 @@ use \Luracast\Restler\RestException;
*/
class Pmtable extends Api
{
/**
* Constructor of the class
*
* return void
*/
public function __construct()
{
try {
$user = new \ProcessMaker\BusinessModel\User();
$usrUid = $this->getUserId();
if (!$user->checkPermission($usrUid, "PM_SETUP")) {
throw new \Exception(\G::LoadTranslation("ID_USER_NOT_HAVE_PERMISSION", array($usrUid)));
}
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @return array
*

View File

@@ -21,6 +21,14 @@ class ProcessCategory extends Api
public function __construct()
{
try {
$user = new \ProcessMaker\BusinessModel\User();
$usrUid = $this->getUserId();
if (!$user->checkPermission($usrUid, "PM_SETUP")) {
throw new \Exception(\G::LoadTranslation("ID_USER_NOT_HAVE_PERMISSION", array($usrUid)));
}
$this->category = new \ProcessMaker\BusinessModel\ProcessCategory();
$this->category->setFormatFieldNameInUppercase(false);