Merged in victorsl/processmaker (pull request #507)

ProcessMaker-BE "Role (Endpoints)"
This commit is contained in:
Erik Amaru Ortiz
2014-05-28 09:11:20 -04:00
6 changed files with 771 additions and 4 deletions

View File

@@ -644,7 +644,10 @@ class Calendar
$criteria = $this->getCalendarCriteria();
if (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData["filter"]) && trim($arrayFilterData["filter"]) != "") {
$criteria->add(\CalendarDefinitionPeer::CALENDAR_NAME, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE);
$criteria->add(
$criteria->getNewCriterion(\CalendarDefinitionPeer::CALENDAR_NAME, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE)->addOr(
$criteria->getNewCriterion(\CalendarDefinitionPeer::CALENDAR_DESCRIPTION, "%" . $arrayFilterData["filter"] . "%", \Criteria::LIKE))
);
}
//Number records total

File diff suppressed because it is too large Load Diff

View File

@@ -566,7 +566,7 @@ class WebEntry
$webEntry->fromArray($arrayData, \BasePeer::TYPE_FIELDNAME);
$webEntryUid = \G::generateUniqueID();
$webEntryUid = \ProcessMaker\Util\Common::generateUID();
$webEntry->setWeUid($webEntryUid);
$webEntry->setProUid($processUid);
@@ -833,7 +833,7 @@ class WebEntry
$this->getFieldNameByFormatFieldName("WE_CREATE_USR_UID") => $record["WE_CREATE_USR_UID"],
$this->getFieldNameByFormatFieldName("WE_UPDATE_USR_UID") => $record["WE_UPDATE_USR_UID"] . "",
$this->getFieldNameByFormatFieldName("WE_CREATE_DATE") => $webEntryCreateDate,
$this->getFieldNameByFormatFieldName("WE_UPDATE_DATE") => $webEntryUpdateDate . ""
$this->getFieldNameByFormatFieldName("WE_UPDATE_DATE") => $webEntryUpdateDate
);
} catch (\Exception $e) {
throw $e;

View File

@@ -5,7 +5,7 @@ use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
* Group Api Controller
* Calendar Api Controller
*
* @protected
*/

View File

@@ -0,0 +1,111 @@
<?php
namespace ProcessMaker\Services\Api;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
* Role Api Controller
*
* @protected
*/
class Role extends Api
{
private $role;
/**
* Constructor of the class
*
* return void
*/
public function __construct()
{
try {
$this->role = new \ProcessMaker\BusinessModel\Role();
$this->role->setFormatFieldNameInUppercase(false);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @url GET
*/
public function index($filter = null, $start = null, $limit = null)
{
try {
$response = $this->role->getRoles(array("filter" => $filter), null, null, $start, $limit);
return $response;
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @url GET /:rol_uid
*
* @param string $rol_uid {@min 32}{@max 32}
*/
public function doGet($rol_uid)
{
try {
$response = $this->role->getRole($rol_uid);
return $response;
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @url POST
*
* @param array $request_data
*
* @status 201
*/
public function doPost($request_data)
{
try {
$arrayData = $this->role->create($request_data);
$response = $arrayData;
return $response;
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @url PUT /:rol_uid
*
* @param string $rol_uid {@min 32}{@max 32}
* @param array $request_data
*/
public function doPut($rol_uid, $request_data)
{
try {
$arrayData = $this->role->update($rol_uid, $request_data);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* @url DELETE /:rol_uid
*
* @param string $rol_uid {@min 32}{@max 32}
*/
public function doDelete($rol_uid)
{
try {
$this->role->delete($rol_uid);
} catch (\Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
}

View File

@@ -70,3 +70,11 @@ debug = 1
input-document = "ProcessMaker\Services\Api\Cases\InputDocument"
output-document = "ProcessMaker\Services\Api\Cases\OutputDocument"
[alias: role]
role = "ProcessMaker\Services\Api\Role"
user = "ProcessMaker\Services\Api\Role\User"
permission = "ProcessMaker\Services\Api\Role\Permission"
[alias: roles]
role = "ProcessMaker\Services\Api\Role"