Merge remote branch 'upstream/master'
This commit is contained in:
2
Rakefile
2
Rakefile
@@ -192,7 +192,7 @@ def getVersion(path)
|
||||
version = `rake version`
|
||||
end
|
||||
|
||||
return version.strip
|
||||
return /([0-9\.]{5}+)/.match(version)
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
@ProcessMakerMichelangelo @RestAPI
|
||||
Feature: Case Tasks Main Tests
|
||||
Requirements:
|
||||
a workspace with the case 383652497533b1492846753088523464 "case #174" and 587530805533b0d5031bd35011041644 "case #146" of the process ("Test Case Variables and Derivation rules-selection") already loaded
|
||||
|
||||
Background:
|
||||
Given that I have a valid access_token
|
||||
|
||||
|
||||
Scenario: Get list case tasks of case 174
|
||||
Given I request "cases/383652497533b1492846753088523464/tasks"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/json"
|
||||
And the type is "array"
|
||||
And that "tas_uid" is set to "63847491053347e25555c29086425576"
|
||||
And that "tas_type" is set to "NORMAL"
|
||||
And that "tas_title" is set to "Task 1"
|
||||
And that "rou_type" is set to "0"
|
||||
And that "rou_next_task" is set to "93695356653347e2702ab38033892652"
|
||||
And that "rou_condition" is set to ""
|
||||
And that "rou_to_last_user" is set to "FALSE"
|
||||
And that "rou_optional" is set to "FALSE"
|
||||
And that "usr_uid" is set to "Administrator"
|
||||
And that "usr_firstname" is set to "Administrator"
|
||||
And that "usr_lastname" is set to ""
|
||||
And that "del_init_date" is set to "2014-04-01 15:33:38"
|
||||
And that "del_task_due_date" is set to "2014-04-02 15:33:38"
|
||||
And that "del_finish_date" is set to "2014-04-01 15:33:47"
|
||||
And that "duration" is set to "0 Hours 0 Minutes 9 Seconds"
|
||||
And that "color" is set to "#006633"
|
||||
And that "tas_uid" is set to "93695356653347e2702ab38033892652"
|
||||
And that "tas_type" is set to "NORMAL"
|
||||
And that "tas_title" is set to "Task 2"
|
||||
And that "rou_type" is set to "0"
|
||||
And that "rou_next_task" is set to "-1"
|
||||
And that "rou_condition" is set to ""
|
||||
And that "rou_to_last_user" is set to "FALSE"
|
||||
And that "rou_optional" is set to "FALSE"
|
||||
And that "usr_uid" is set to "Administrator"
|
||||
And that "usr_firstname" is set to "Administrator"
|
||||
And that "usr_lastname" is set to ""
|
||||
And that "del_init_date" is set to "Case not started yet"
|
||||
And that "del_task_due_date" is set to "2014-04-02 15:33:47"
|
||||
And that "del_finish_date" is set to "Not finished"
|
||||
And that "duration" is set to "Not finished"
|
||||
And that "color" is set to "#FF0000"
|
||||
|
||||
Scenario: Get list case tasks of case 146
|
||||
Given I request "cases/587530805533b0d5031bd35011041644/tasks"
|
||||
Then the response status code should be 200
|
||||
And the response charset is "UTF-8"
|
||||
And the content type is "application/json"
|
||||
And the type is "array"
|
||||
And that "tas_uid" is set to "17300415050ec6a1687f439060824658"
|
||||
And that "tas_type" is set to "NORMAL"
|
||||
And that "tas_title" is set to "Self Service"
|
||||
And that "rou_type" is set to ""
|
||||
And that "color" is set to "#939598"
|
||||
|
||||
And that "tas_uid" is set to "18637084950ec669487b1b3034500214"
|
||||
And that "tas_type" is set to "NORMAL"
|
||||
And that "tas_title" is set to "Cyclical"
|
||||
And that "rou_type" is set to ""
|
||||
And that "color" is set to "#939598"
|
||||
|
||||
And that "tas_uid" is set to "56900024450ec668e4a9243080698854"
|
||||
And that "tas_type" is set to "NORMAL"
|
||||
And that "tas_title" is set to "Init"
|
||||
And that "rou_type" is set to "1"
|
||||
|
||||
And that "rou_next_task" is set to "-1"
|
||||
And that "rou_condition" is set to ""
|
||||
And that "rou_to_last_user" is set to "FALSE"
|
||||
And that "rou_optional" is set to "FALSE"
|
||||
And that "usr_uid" is set to "Administrator"
|
||||
And that "usr_firstname" is set to "Administrator"
|
||||
And that "usr_lastname" is set to ""
|
||||
And that "del_init_date" is set to "2014-04-01 15:02:40"
|
||||
And that "del_task_due_date" is set to "2014-04-01 15:02:40"
|
||||
And that "del_finish_date" is set to "2014-04-01 15:02:51"
|
||||
And that "duration" is set to "0 Hours 0 Minutes 11 Seconds"
|
||||
|
||||
And that "rou_next_task" is set to "18637084950ec669487b1b3034500214"
|
||||
And that "rou_condition" is set to ""
|
||||
And that "rou_to_last_user" is set to "FALSE"
|
||||
And that "rou_optional" is set to "FALSE"
|
||||
And that "usr_uid" is set to "Administrator"
|
||||
And that "usr_firstname" is set to "Administrator"
|
||||
And that "usr_lastname" is set to ""
|
||||
And that "del_init_date" is set to "2014-04-01 15:02:40"
|
||||
And that "del_task_due_date" is set to "2014-04-02 15:02:40"
|
||||
And that "del_finish_date" is set to "2014-04-01 15:02:51"
|
||||
And that "duration" is set to "0 Hours 0 Minutes 11 Seconds"
|
||||
And that "color" is set to "#006633"
|
||||
|
||||
And that "tas_uid" is set to "79440307650ec67a8ba3969022801548"
|
||||
And that "tas_type" is set to "NORMAL"
|
||||
And that "tas_title" is set to "Reports to"
|
||||
And that "rou_type" is set to ""
|
||||
And that "color" is set to "#939598"
|
||||
|
||||
And that "tas_uid" is set to "82464599650ec679055e040061009891"
|
||||
And that "tas_type" is set to "NORMAL"
|
||||
And that "tas_title" is set to "Manual"
|
||||
And that "rou_type" is set to ""
|
||||
And that "color" is set to "#939598"
|
||||
@@ -0,0 +1,18 @@
|
||||
@ProcessMakerMichelangelo @RestAPI
|
||||
Feature: Case Tasks Negative Tests
|
||||
Requirements:
|
||||
a workspace with the case 383652497533b1492846753088523464 "case #174" and 587530805533b0d5031bd35011041644 "case #146" of the process ("Test Case Variables and Derivation rules-selection") already loaded
|
||||
|
||||
Background:
|
||||
Given that I have a valid access_token
|
||||
|
||||
Scenario: Get list case tasks of case 174
|
||||
Given I request "cases/38365249000000000046753088523464/tasks"
|
||||
Then the response status code should be 400
|
||||
And the response status message should have the following text "doesn't exist"
|
||||
|
||||
|
||||
Scenario: Get list case tasks of case 174
|
||||
Given I request "cases//tasks"
|
||||
Then the response status code should be 400
|
||||
And the response status message should have the following text "app_uid"
|
||||
@@ -1540,6 +1540,15 @@ class Cases
|
||||
$oCriteria->addSelectColumn(\ContentPeer::CON_VALUE);
|
||||
$oCriteria->addSelectColumn(\TaskPeer::TAS_START);
|
||||
$oCriteria->addSelectColumn(\TaskPeer::TAS_TYPE);
|
||||
|
||||
$oCriteria->addSelectColumn(\TaskPeer::TAS_ASSIGN_TYPE);
|
||||
$oCriteria->addSelectColumn(\TaskPeer::TAS_ASSIGN_LOCATION);
|
||||
$oCriteria->addSelectColumn(\TaskPeer::TAS_ASSIGN_LOCATION_ADHOC);
|
||||
$oCriteria->addSelectColumn(\TaskPeer::TAS_LAST_ASSIGNED);
|
||||
$oCriteria->addSelectColumn(\TaskPeer::TAS_START);
|
||||
$oCriteria->addSelectColumn(\TaskPeer::TAS_TO_LAST_USER);
|
||||
$oCriteria->addSelectColumn(\TaskPeer::TAS_DERIVATION);
|
||||
|
||||
$aConditions = array();
|
||||
$aConditions[] = array(0 => \TaskPeer::TAS_UID, 1 => \ContentPeer::CON_ID);
|
||||
$aConditions[] = array(0 => \ContentPeer::CON_CATEGORY, 1 => \DBAdapter::getStringDelimiter() . 'TAS_TITLE' . \DBAdapter::getStringDelimiter() );
|
||||
@@ -1584,6 +1593,15 @@ class Cases
|
||||
$oTask->tas_title = htmlentities($aRow1['CON_VALUE'], ENT_QUOTES, 'UTF-8');
|
||||
}
|
||||
}
|
||||
|
||||
$oTask->tas_assign_type = $aRow1['TAS_ASSIGN_TYPE'];
|
||||
$oTask->tas_assign_location = $aRow1['TAS_ASSIGN_LOCATION'];
|
||||
$oTask->tas_assign_location_adhoc = $aRow1['TAS_ASSIGN_LOCATION_ADHOC'];
|
||||
$oTask->tas_last_assigned = $aRow1['TAS_LAST_ASSIGNED'];
|
||||
$oTask->tas_start = $aRow1['TAS_START'];
|
||||
$oTask->tas_to_last_user = $aRow1['TAS_TO_LAST_USER'];
|
||||
$oTask->tas_derivation = $aRow1['TAS_DERIVATION'];
|
||||
|
||||
$oTask->routing = new \StdClass();
|
||||
$oTask->routing->rou_type = '';
|
||||
$oTask->routing->to = array();
|
||||
@@ -1609,30 +1627,8 @@ class Cases
|
||||
$oDataset2 = \AppDelegationPeer::doSelectRS($oCriteria);
|
||||
$oDataset2->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||
$oDataset2->next();
|
||||
|
||||
while ($aRow2 = $oDataset2->getRow()) {
|
||||
switch ($aRow2['ROU_TYPE']) {
|
||||
case 'SEQUENTIAL':
|
||||
$aRow2['ROU_TYPE'] = 0;
|
||||
break;
|
||||
case 'SELECT':
|
||||
$aRow2['ROU_TYPE'] = 1;
|
||||
break;
|
||||
case 'EVALUATE':
|
||||
$aRow2['ROU_TYPE'] = 2;
|
||||
break;
|
||||
case 'PARALLEL':
|
||||
$aRow2['ROU_TYPE'] = 3;
|
||||
break;
|
||||
case 'PARALLEL-BY-EVALUATION':
|
||||
$aRow2['ROU_TYPE'] = 4;
|
||||
break;
|
||||
case 'SEC-JOIN':
|
||||
$aRow2['ROU_TYPE'] = 5;
|
||||
break;
|
||||
case 'DISCRIMINATOR':
|
||||
$aRow2['ROU_TYPE'] = 8;
|
||||
break;
|
||||
}
|
||||
$iDiff = strtotime($aRow2['DEL_FINISH_DATE']) - strtotime($aRow2['DEL_INIT_DATE']);
|
||||
$oTo = new \StdClass();
|
||||
$oTo->rou_next_task = $aRow2['ROU_NEXT_TASK'];
|
||||
@@ -1673,22 +1669,22 @@ class Cases
|
||||
$aRow2['FINISH'] = '';
|
||||
}
|
||||
if (empty($aRow2["FINISH"]) && $aRow1["TAS_UID"] == $sTask) {
|
||||
$oTask->color = "#FF0000"; //Red
|
||||
$oTask->status = G::LoadTranslation( 'ID_TASK_IN_PROGRESS' );
|
||||
} else {
|
||||
if (!empty($aRow2["FINISH"])) {
|
||||
$oTask->color = "#006633"; //Green
|
||||
$oTask->status = G::LoadTranslation( 'ID_COMPLETED_TASK' );
|
||||
} else {
|
||||
if ($oTask->routing->rou_type != 5) {
|
||||
if ($oTask->routing->rou_type != 'SEC-JOIN') {
|
||||
if ($aRow2["CANT"] != 0) {
|
||||
$oTask->color = "#FF0000"; //Red
|
||||
$oTask->status = G::LoadTranslation( 'ID_TASK_IN_PROGRESS' );
|
||||
} else {
|
||||
$oTask->color = "#939598"; //Gray
|
||||
$oTask->status = G::LoadTranslation( 'ID_PENDING_TASK' );
|
||||
}
|
||||
} else {
|
||||
if ($aRow3) {
|
||||
$oTask->color = "#FF0000"; //Red
|
||||
$oTask->status = G::LoadTranslation( 'ID_TASK_IN_PROGRESS' );
|
||||
} else {
|
||||
$oTask->color = "#939598"; //Gray
|
||||
$oTask->status = G::LoadTranslation( 'ID_PENDING_TASK' );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1717,19 +1713,19 @@ class Cases
|
||||
$aRow2['FINISH'] = '';
|
||||
}
|
||||
if (empty($aRow2["FINISH"]) && $aRow1["TAS_UID"] == $sTask) {
|
||||
$oTask->color = "#FF0000"; //Red
|
||||
$oTask->status = G::LoadTranslation( 'ID_TASK_IN_PROGRESS' );
|
||||
} else {
|
||||
if (!empty($aRow2["FINISH"])) {
|
||||
$oTask->color = "#006633"; //Green
|
||||
$oTask->status = G::LoadTranslation( 'ID_COMPLETED_TASK' );
|
||||
} else {
|
||||
if ($oTask->routing->rou_type != 5) {
|
||||
if ($oTask->routing->rou_type != 'SEC-JOIN') {
|
||||
if ($aRow2["CANT"] != 0) {
|
||||
$oTask->color = "#FF0000"; //Red
|
||||
$oTask->status = G::LoadTranslation( 'ID_TASK_IN_PROGRESS' );
|
||||
} else {
|
||||
$oTask->color = "#939598"; //Gray
|
||||
$oTask->status = G::LoadTranslation( 'ID_PENDING_TASK' );
|
||||
}
|
||||
} else {
|
||||
$oTask->color = "#FF9900"; //Yellow
|
||||
$oTask->status = G::LoadTranslation( 'ID_PARALLEL_TASK' );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1743,4 +1739,4 @@ class Cases
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,6 +483,27 @@ class Process
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if does not exist the Permission in table PERMISSIONS (Database RBAC)
|
||||
*
|
||||
* @param string $permissionUid Unique id of Permission
|
||||
* @param string $fieldNameForException Field name for the exception
|
||||
*
|
||||
* return void Throw exception if does not exist the Permission in table PERMISSIONS
|
||||
*/
|
||||
public function throwExceptionIfNotExistsPermission($permissionUid, $fieldNameForException)
|
||||
{
|
||||
try {
|
||||
$obj = \PermissionsPeer::retrieveByPK($permissionUid);
|
||||
|
||||
if (is_null($obj)) {
|
||||
throw new \Exception(\G::LoadTranslation("ID_PERMISSION_DOES_NOT_EXIST", array($fieldNameForException, $permissionUid)));
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Process
|
||||
*
|
||||
|
||||
@@ -355,6 +355,10 @@ class Role
|
||||
//Verify data
|
||||
$this->throwExceptionIfNotExistsRole($roleUid, $this->arrayFieldNameForException["roleUid"]);
|
||||
|
||||
if ($roleUid == "00000000000000000000000000000002") {
|
||||
throw new \Exception(\G::LoadTranslation("ID_ROLES_MSG"));
|
||||
}
|
||||
|
||||
$this->throwExceptionIfDataIsInvalid($roleUid, $arrayData);
|
||||
|
||||
//Update
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -187,8 +187,8 @@ class User
|
||||
/**
|
||||
* Unassign User of the Role
|
||||
*
|
||||
* @param string $roleUid Unique id of Role
|
||||
* @param string $userUid Unique id of User
|
||||
* @param string $roleUid Unique id of Role
|
||||
* @param string $userUid Unique id of User
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
@@ -205,7 +205,7 @@ class User
|
||||
|
||||
$this->throwExceptionIfNotItsAssignedUserToRole($roleUid, $userUid, $this->arrayFieldNameForException["userUid"]);
|
||||
|
||||
if ($roleUid == "00000000000000000000000000000002" && $userUid == "00000000000000000000000000000001") {
|
||||
if ($userUid == "00000000000000000000000000000001") {
|
||||
throw new \Exception(\G::LoadTranslation("ID_ADMINISTRATOR_ROLE_CANT_CHANGED"));
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
namespace ProcessMaker\Services\Api\Role;
|
||||
|
||||
use \ProcessMaker\Services\Api;
|
||||
use \Luracast\Restler\RestException;
|
||||
|
||||
/**
|
||||
* Role\Permission Api Controller
|
||||
*
|
||||
* @protected
|
||||
*/
|
||||
class Permission extends Api
|
||||
{
|
||||
private $rolePermission;
|
||||
|
||||
/**
|
||||
* Constructor of the class
|
||||
*
|
||||
* return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
try {
|
||||
$this->rolePermission = new \ProcessMaker\BusinessModel\Role\Permission();
|
||||
|
||||
$this->rolePermission->setFormatFieldNameInUppercase(false);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url GET /:rol_uid/permissions
|
||||
* @url GET /:rol_uid/available-permissions
|
||||
*
|
||||
* @param string $rol_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doGetPermissions($rol_uid, $filter = null, $start = null, $limit = null)
|
||||
{
|
||||
try {
|
||||
$response = $this->rolePermission->getPermissions($rol_uid, (preg_match("/^.*\/permissions$/", $this->restler->url))? "PERMISSIONS" : "AVAILABLE-PERMISSIONS", 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/permission
|
||||
*
|
||||
* @param string $rol_uid {@min 32}{@max 32}
|
||||
* @param array $request_data
|
||||
*
|
||||
* @status 201
|
||||
*/
|
||||
public function doPostPermission($rol_uid, array $request_data)
|
||||
{
|
||||
try {
|
||||
$arrayData = $this->rolePermission->create($rol_uid, $request_data);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @url DELETE /:rol_uid/permission/:per_uid
|
||||
*
|
||||
* @param string $rol_uid {@min 32}{@max 32}
|
||||
* @param string $per_uid {@min 32}{@max 32}
|
||||
*/
|
||||
public function doDeletePermission($rol_uid, $per_uid)
|
||||
{
|
||||
try {
|
||||
$this->rolePermission->delete($rol_uid, $per_uid);
|
||||
} catch (\Exception $e) {
|
||||
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user