Merge branch 'master' of bitbucket.org:colosa/processmaker
This commit is contained in:
@@ -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
|
||||
|
||||
645
workflow/engine/src/ProcessMaker/BusinessModel/Role.php
Normal file
645
workflow/engine/src/ProcessMaker/BusinessModel/Role.php
Normal file
File diff suppressed because it is too large
Load Diff
408
workflow/engine/src/ProcessMaker/BusinessModel/Role/User.php
Normal file
408
workflow/engine/src/ProcessMaker/BusinessModel/Role/User.php
Normal file
File diff suppressed because it is too large
Load Diff
@@ -67,7 +67,7 @@ class WebEntry
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
public function setArrayFieldNameForException($arrayData)
|
||||
public function setArrayFieldNameForException(array $arrayData)
|
||||
{
|
||||
try {
|
||||
foreach ($arrayData as $key => $value) {
|
||||
@@ -175,9 +175,9 @@ class WebEntry
|
||||
public function throwExceptionIfNotExistsWebEntry($webEntryUid, $fieldNameForException)
|
||||
{
|
||||
try {
|
||||
$webEntry = \WebEntryPeer::retrieveByPK($webEntryUid);
|
||||
$obj = \WebEntryPeer::retrieveByPK($webEntryUid);
|
||||
|
||||
if (is_null($webEntry)) {
|
||||
if (is_null($obj)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_WEB_ENTRY_DOES_NOT_EXIST", array($fieldNameForException, $webEntryUid)));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
@@ -215,7 +215,7 @@ class WebEntry
|
||||
*
|
||||
* return void Throw exception if data has an invalid value
|
||||
*/
|
||||
public function throwExceptionIfDataIsInvalid($webEntryUid, $processUid, $arrayData)
|
||||
public function throwExceptionIfDataIsInvalid($webEntryUid, $processUid, array $arrayData)
|
||||
{
|
||||
try {
|
||||
//Set variables
|
||||
@@ -537,7 +537,7 @@ class WebEntry
|
||||
*
|
||||
* return array Return data of the new Web Entry created
|
||||
*/
|
||||
public function create($processUid, $userUidCreator, $arrayData)
|
||||
public function create($processUid, $userUidCreator, array $arrayData)
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
@@ -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);
|
||||
@@ -622,7 +622,7 @@ class WebEntry
|
||||
*
|
||||
* return array Return data of the Web Entry updated
|
||||
*/
|
||||
public function update($webEntryUid, $userUidUpdater, $arrayData)
|
||||
public function update($webEntryUid, $userUidUpdater, array $arrayData)
|
||||
{
|
||||
try {
|
||||
//Verify data
|
||||
@@ -797,7 +797,7 @@ class WebEntry
|
||||
*
|
||||
* return array Return an array with data Web Entry
|
||||
*/
|
||||
public function getWebEntryDataFromRecord($record)
|
||||
public function getWebEntryDataFromRecord(array $record)
|
||||
{
|
||||
try {
|
||||
if ($record["WE_METHOD"] == "WS") {
|
||||
@@ -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;
|
||||
|
||||
@@ -5,7 +5,7 @@ use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Group Api Controller
|
||||
* Calendar Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
|
||||
@@ -71,7 +71,7 @@ class WebEntry extends Api
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostWebEntry($prj_uid, $request_data)
|
||||
public function doPostWebEntry($prj_uid, array $request_data)
|
||||
{
|
||||
try {
|
||||
$arrayData = $this->webEntry->create($prj_uid, $this->getUserId(), $request_data);
|
||||
@@ -91,7 +91,7 @@ class WebEntry extends Api
|
||||
* @param string $we_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*/
|
||||
public function doPutWebEntry($prj_uid, $we_uid, $request_data)
|
||||
public function doPutWebEntry($prj_uid, $we_uid, array $request_data)
|
||||
{
|
||||
try {
|
||||
$arrayData = $this->webEntry->update($we_uid, $this->getUserId(), $request_data);
|
||||
|
||||
111
workflow/engine/src/ProcessMaker/Services/Api/Role.php
Normal file
111
workflow/engine/src/ProcessMaker/Services/Api/Role.php
Normal 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(array $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, array $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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
81
workflow/engine/src/ProcessMaker/Services/Api/Role/User.php
Normal file
81
workflow/engine/src/ProcessMaker/Services/Api/Role/User.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Role;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Role\User Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class User extends Api
|
||||
{
|
||||
private $roleUser;
|
||||
|
||||
/**
|
||||
* Constructor of the class
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
try {
|
||||
$this->roleUser = new \ProcessMaker\BusinessModel\Role\User();
|
||||
|
||||
$this->roleUser->setFormatFieldNameInUppercase(false);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:rol_uid/users
|
||||
* @url GET /:rol_uid/available-users
|
||||
*
|
||||
* @param string $rol_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetUsers($rol_uid, $filter = null, $start = null, $limit = null)
|
||||
{
|
||||
try {
|
||||
$response = $this->roleUser->getUsers($rol_uid, (preg_match("/^.*\/users$/", $this->restler->url))? "USERS" : "AVAILABLE-USERS", array("filter" => $filter), null, null, $start, $limit);
|
||||
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url POST /:rol_uid/user
|
||||
*
|
||||
* @param string $rol_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostUser($rol_uid, array $request_data)
|
||||
{
|
||||
try {
|
||||
$arrayData = $this->roleUser->create($rol_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:rol_uid/user/:usr_uid
|
||||
*
|
||||
* @param string $rol_uid {@min 32}{@max 32}
|
||||
* @param string $usr_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doDeleteUser($rol_uid, $usr_uid)
|
||||
{
|
||||
try {
|
||||
$this->roleUser->delete($rol_uid, $usr_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user