2014-01-29 17:46:28 -04:00
|
|
|
<?php
|
2014-04-02 16:51:28 -04:00
|
|
|
namespace ProcessMaker\BusinessModel;
|
2014-01-29 17:46:28 -04:00
|
|
|
|
|
|
|
|
class Group
|
|
|
|
|
{
|
2014-02-10 17:16:44 -04:00
|
|
|
private $arrayFieldDefinition = array(
|
|
|
|
|
"GRP_UID" => array("type" => "string", "required" => false, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "groupUid"),
|
|
|
|
|
|
|
|
|
|
"GRP_TITLE" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array(), "fieldNameAux" => "groupTitle"),
|
|
|
|
|
"GRP_STATUS" => array("type" => "string", "required" => true, "empty" => false, "defaultValues" => array("ACTIVE", "INACTIVE"), "fieldNameAux" => "groupStatus")
|
|
|
|
|
);
|
|
|
|
|
|
2014-01-30 14:30:18 -04:00
|
|
|
private $formatFieldNameInUppercase = true;
|
2014-02-10 17:16:44 -04:00
|
|
|
|
|
|
|
|
private $arrayFieldNameForException = array(
|
|
|
|
|
"filter" => "FILTER",
|
|
|
|
|
"start" => "START",
|
|
|
|
|
"limit" => "LIMIT"
|
2014-01-31 14:56:47 -04:00
|
|
|
);
|
2014-01-29 17:46:28 -04:00
|
|
|
|
2014-02-10 17:16:44 -04:00
|
|
|
/**
|
|
|
|
|
* Constructor of the class
|
|
|
|
|
*
|
|
|
|
|
* return void
|
|
|
|
|
*/
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
foreach ($this->arrayFieldDefinition as $key => $value) {
|
|
|
|
|
$this->arrayFieldNameForException[$value["fieldNameAux"]] = $key;
|
|
|
|
|
}
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-30 14:30:18 -04:00
|
|
|
/**
|
|
|
|
|
* Set the format of the fields name (uppercase, lowercase)
|
|
|
|
|
*
|
|
|
|
|
* @param bool $flag Value that set the format
|
|
|
|
|
*
|
|
|
|
|
* return void
|
|
|
|
|
*/
|
|
|
|
|
public function setFormatFieldNameInUppercase($flag)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$this->formatFieldNameInUppercase = $flag;
|
2014-01-31 14:56:47 -04:00
|
|
|
|
2014-02-10 17:16:44 -04:00
|
|
|
$this->setArrayFieldNameForException($this->arrayFieldNameForException);
|
2014-01-30 14:30:18 -04:00
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-29 17:46:28 -04:00
|
|
|
/**
|
2014-02-10 17:16:44 -04:00
|
|
|
* Set exception messages for fields
|
2014-01-30 14:30:18 -04:00
|
|
|
*
|
2014-02-10 17:16:44 -04:00
|
|
|
* @param array $arrayData Data with the fields
|
2014-01-30 14:30:18 -04:00
|
|
|
*
|
|
|
|
|
* return void
|
2014-01-29 17:46:28 -04:00
|
|
|
*/
|
2014-02-10 17:16:44 -04:00
|
|
|
public function setArrayFieldNameForException($arrayData)
|
2014-01-29 17:46:28 -04:00
|
|
|
{
|
|
|
|
|
try {
|
2014-01-31 14:56:47 -04:00
|
|
|
foreach ($arrayData as $key => $value) {
|
2014-02-10 17:16:44 -04:00
|
|
|
$this->arrayFieldNameForException[$key] = $this->getFieldNameByFormatFieldName($value);
|
2014-01-31 14:56:47 -04:00
|
|
|
}
|
2014-01-29 17:46:28 -04:00
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2014-01-30 14:30:18 -04:00
|
|
|
* Get the name of the field according to the format
|
2014-01-29 17:46:28 -04:00
|
|
|
*
|
2014-01-30 14:30:18 -04:00
|
|
|
* @param string $fieldName Field name
|
2014-01-29 17:46:28 -04:00
|
|
|
*
|
2014-01-30 14:30:18 -04:00
|
|
|
* return string Return the field name according the format
|
2014-01-29 17:46:28 -04:00
|
|
|
*/
|
2014-01-30 14:30:18 -04:00
|
|
|
public function getFieldNameByFormatFieldName($fieldName)
|
2014-01-29 17:46:28 -04:00
|
|
|
{
|
2014-01-30 14:30:18 -04:00
|
|
|
try {
|
|
|
|
|
return ($this->formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName);
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
2014-01-29 17:46:28 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Verify if exists the title of a Group
|
|
|
|
|
*
|
2014-02-04 17:34:29 -04:00
|
|
|
* @param string $groupTitle Title
|
2014-01-29 17:46:28 -04:00
|
|
|
* @param string $groupUidExclude Unique id of Group to exclude
|
|
|
|
|
*
|
|
|
|
|
* return bool Return true if exists the title of a Group, false otherwise
|
|
|
|
|
*/
|
2014-01-30 14:30:18 -04:00
|
|
|
public function existsTitle($groupTitle, $groupUidExclude = "")
|
2014-01-29 17:46:28 -04:00
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$delimiter = \DBAdapter::getStringDelimiter();
|
|
|
|
|
|
|
|
|
|
$criteria = new \Criteria("workflow");
|
|
|
|
|
|
|
|
|
|
$criteria->addSelectColumn(\GroupwfPeer::GRP_UID);
|
2016-06-16 16:23:42 -04:00
|
|
|
$criteria->addSelectColumn(\GroupwfPeer::GRP_TITLE);
|
2014-01-29 17:46:28 -04:00
|
|
|
|
|
|
|
|
if ($groupUidExclude != "") {
|
|
|
|
|
$criteria->add(\GroupwfPeer::GRP_UID, $groupUidExclude, \Criteria::NOT_EQUAL);
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-16 16:23:42 -04:00
|
|
|
$criteria->add(\GroupwfPeer::GRP_TITLE, $groupTitle, \Criteria::EQUAL);
|
2014-01-29 17:46:28 -04:00
|
|
|
|
|
|
|
|
$rsCriteria = \GroupwfPeer::doSelectRS($criteria);
|
|
|
|
|
|
|
|
|
|
if ($rsCriteria->next()) {
|
|
|
|
|
return true;
|
|
|
|
|
} else {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-30 14:30:18 -04:00
|
|
|
/**
|
2014-02-20 17:16:00 -04:00
|
|
|
* Verify if doesn't exists the Group in table GROUP
|
2014-01-30 14:30:18 -04:00
|
|
|
*
|
2014-02-10 17:16:44 -04:00
|
|
|
* @param string $groupUid Unique id of Group
|
|
|
|
|
* @param string $fieldNameForException Field name for the exception
|
2014-01-30 14:30:18 -04:00
|
|
|
*
|
2014-02-20 17:16:00 -04:00
|
|
|
* return void Throw exception if doesn't exists the Group in table GROUP
|
2014-01-30 14:30:18 -04:00
|
|
|
*/
|
2014-04-01 17:30:02 -04:00
|
|
|
public function throwExceptionIfNotExistsGroup($groupUid, $fieldNameForException)
|
2014-01-30 14:30:18 -04:00
|
|
|
{
|
2014-02-10 17:16:44 -04:00
|
|
|
try {
|
|
|
|
|
$group = new \Groupwf();
|
2014-01-30 14:30:18 -04:00
|
|
|
|
2014-02-10 17:16:44 -04:00
|
|
|
if (!$group->GroupwfExists($groupUid)) {
|
2014-05-19 17:30:00 -04:00
|
|
|
throw new \Exception(\G::LoadTranslation("ID_GROUP_DOES_NOT_EXIST", array($fieldNameForException, $groupUid)));
|
2014-02-10 17:16:44 -04:00
|
|
|
}
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
2014-01-30 14:30:18 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-29 17:46:28 -04:00
|
|
|
/**
|
|
|
|
|
* Verify if exists the title of a Group
|
|
|
|
|
*
|
2014-02-10 17:16:44 -04:00
|
|
|
* @param string $groupTitle Title
|
|
|
|
|
* @param string $fieldNameForException Field name for the exception
|
|
|
|
|
* @param string $groupUidExclude Unique id of Group to exclude
|
2014-01-29 17:46:28 -04:00
|
|
|
*
|
|
|
|
|
* return void Throw exception if exists the title of a Group
|
|
|
|
|
*/
|
2014-02-10 17:16:44 -04:00
|
|
|
public function throwExceptionIfExistsTitle($groupTitle, $fieldNameForException, $groupUidExclude = "")
|
2014-01-29 17:46:28 -04:00
|
|
|
{
|
2014-02-10 17:16:44 -04:00
|
|
|
try {
|
|
|
|
|
if ($this->existsTitle($groupTitle, $groupUidExclude)) {
|
2014-05-19 17:30:00 -04:00
|
|
|
throw new \Exception(\G::LoadTranslation("ID_GROUP_TITLE_ALREADY_EXISTS", array($fieldNameForException, $groupTitle)));
|
2014-02-10 17:16:44 -04:00
|
|
|
}
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
2014-01-29 17:46:28 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create Group
|
|
|
|
|
*
|
|
|
|
|
* @param array $arrayData Data
|
|
|
|
|
*
|
|
|
|
|
* return array Return data of the new Group created
|
|
|
|
|
*/
|
|
|
|
|
public function create($arrayData)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
|
|
|
|
|
|
|
|
|
unset($arrayData["GRP_UID"]);
|
|
|
|
|
|
|
|
|
|
//Verify data
|
2014-04-02 16:51:28 -04:00
|
|
|
$process = new \ProcessMaker\BusinessModel\Process();
|
2014-01-29 17:46:28 -04:00
|
|
|
|
2014-02-10 17:16:44 -04:00
|
|
|
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true);
|
2014-01-29 17:46:28 -04:00
|
|
|
|
2014-02-10 17:16:44 -04:00
|
|
|
$this->throwExceptionIfExistsTitle($arrayData["GRP_TITLE"], $this->arrayFieldNameForException["groupTitle"]);
|
2014-01-29 17:46:28 -04:00
|
|
|
|
|
|
|
|
//Create
|
|
|
|
|
$group = new \Groupwf();
|
|
|
|
|
|
|
|
|
|
$groupUid = $group->create($arrayData);
|
|
|
|
|
|
|
|
|
|
//Return
|
2014-01-30 14:30:18 -04:00
|
|
|
$arrayData = array_merge(array("GRP_UID" => $groupUid), $arrayData);
|
2014-01-29 17:46:28 -04:00
|
|
|
|
2014-01-30 14:30:18 -04:00
|
|
|
if (!$this->formatFieldNameInUppercase) {
|
|
|
|
|
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
|
|
|
|
|
}
|
2014-01-29 17:46:28 -04:00
|
|
|
|
2014-01-30 14:30:18 -04:00
|
|
|
return $arrayData;
|
2014-01-29 17:46:28 -04:00
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Update Group
|
|
|
|
|
*
|
|
|
|
|
* @param string $groupUid Unique id of Group
|
|
|
|
|
* @param array $arrayData Data
|
|
|
|
|
*
|
|
|
|
|
* return array Return data of the Group updated
|
|
|
|
|
*/
|
|
|
|
|
public function update($groupUid, $arrayData)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
|
|
|
|
|
|
|
|
|
|
//Verify data
|
2014-04-02 16:51:28 -04:00
|
|
|
$process = new \ProcessMaker\BusinessModel\Process();
|
2014-01-29 17:46:28 -04:00
|
|
|
|
2014-04-01 17:30:02 -04:00
|
|
|
$this->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
2014-02-11 17:00:26 -04:00
|
|
|
|
2014-02-10 17:16:44 -04:00
|
|
|
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, false);
|
2014-01-30 14:30:18 -04:00
|
|
|
|
2014-01-29 17:46:28 -04:00
|
|
|
if (isset($arrayData["GRP_TITLE"])) {
|
2014-02-10 17:16:44 -04:00
|
|
|
$this->throwExceptionIfExistsTitle($arrayData["GRP_TITLE"], $this->arrayFieldNameForException["groupTitle"], $groupUid);
|
2014-01-29 17:46:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Update
|
|
|
|
|
$group = new \Groupwf();
|
|
|
|
|
|
|
|
|
|
$arrayData["GRP_UID"] = $groupUid;
|
|
|
|
|
|
|
|
|
|
$result = $group->update($arrayData);
|
|
|
|
|
|
|
|
|
|
//Return
|
|
|
|
|
unset($arrayData["GRP_UID"]);
|
|
|
|
|
|
2014-01-30 14:30:18 -04:00
|
|
|
if (!$this->formatFieldNameInUppercase) {
|
|
|
|
|
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $arrayData;
|
2014-01-29 17:46:28 -04:00
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Delete Group
|
|
|
|
|
*
|
|
|
|
|
* @param string $groupUid Unique id of Group
|
|
|
|
|
*
|
|
|
|
|
* return void
|
|
|
|
|
*/
|
|
|
|
|
public function delete($groupUid)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
//Verify data
|
2014-04-01 17:30:02 -04:00
|
|
|
$this->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
2014-01-29 17:46:28 -04:00
|
|
|
|
2014-06-23 12:56:23 -04:00
|
|
|
$arrayTotalTasksByGroup = $this->getTotalTasksByGroup($groupUid);
|
|
|
|
|
|
|
|
|
|
if (isset($arrayTotalTasksByGroup[$groupUid]) && $arrayTotalTasksByGroup[$groupUid] > 0) {
|
|
|
|
|
throw new \Exception(\G::LoadTranslation("ID_GROUP_CANNOT_DELETE_WHILE_ASSIGNED_TO_TASK"));
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-29 17:46:28 -04:00
|
|
|
//Delete
|
|
|
|
|
$group = new \Groupwf();
|
|
|
|
|
|
2014-02-10 17:16:44 -04:00
|
|
|
$result = $group->remove($groupUid);
|
2014-01-29 17:46:28 -04:00
|
|
|
|
|
|
|
|
//Delete assignments of tasks
|
|
|
|
|
$criteria = new \Criteria("workflow");
|
|
|
|
|
|
|
|
|
|
$criteria->add(\TaskUserPeer::USR_UID, $groupUid);
|
|
|
|
|
|
|
|
|
|
\TaskUserPeer::doDelete($criteria);
|
|
|
|
|
|
|
|
|
|
//Delete permissions
|
|
|
|
|
$criteria = new \Criteria("workflow");
|
|
|
|
|
|
|
|
|
|
$criteria->add(\ObjectPermissionPeer::USR_UID, $groupUid);
|
|
|
|
|
|
|
|
|
|
\ObjectPermissionPeer::doDelete($criteria);
|
|
|
|
|
|
|
|
|
|
//Delete assignments of supervisors
|
|
|
|
|
$criteria = new \Criteria("workflow");
|
|
|
|
|
|
|
|
|
|
$criteria->add(\ProcessUserPeer::USR_UID, $groupUid);
|
|
|
|
|
$criteria->add(\ProcessUserPeer::PU_TYPE, "GROUP_SUPERVISOR");
|
|
|
|
|
|
|
|
|
|
\ProcessUserPeer::doDelete($criteria);
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get criteria for Group
|
|
|
|
|
*
|
|
|
|
|
* return object
|
|
|
|
|
*/
|
|
|
|
|
public function getGroupCriteria()
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$criteria = new \Criteria("workflow");
|
|
|
|
|
|
|
|
|
|
$criteria->addSelectColumn(\GroupwfPeer::GRP_UID);
|
2016-06-16 16:23:42 -04:00
|
|
|
$criteria->addSelectColumn(\GroupwfPeer::GRP_TITLE);
|
2014-01-29 17:46:28 -04:00
|
|
|
$criteria->addSelectColumn(\GroupwfPeer::GRP_STATUS);
|
|
|
|
|
$criteria->addSelectColumn(\GroupwfPeer::GRP_LDAP_DN);
|
|
|
|
|
$criteria->addSelectColumn(\GroupwfPeer::GRP_UX);
|
|
|
|
|
return $criteria;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get data of total Users by Group
|
|
|
|
|
*
|
|
|
|
|
* @param string $groupUid Unique id of Group
|
|
|
|
|
*
|
|
|
|
|
* return array Return an array with data of total Users by Group
|
|
|
|
|
*/
|
|
|
|
|
public function getTotalUsersByGroup($groupUid = "")
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$arrayData = array();
|
|
|
|
|
|
|
|
|
|
//Verif data
|
|
|
|
|
if ($groupUid != "") {
|
2014-04-01 17:30:02 -04:00
|
|
|
$this->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
2014-01-29 17:46:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Get data
|
|
|
|
|
$criteria = new \Criteria("workflow");
|
|
|
|
|
|
|
|
|
|
$criteria->addSelectColumn(\GroupUserPeer::GRP_UID);
|
2014-06-23 12:56:23 -04:00
|
|
|
$criteria->addAsColumn("NUM_REC", "COUNT(" . \GroupUserPeer::GRP_UID . ")");
|
2014-01-29 17:46:28 -04:00
|
|
|
$criteria->addJoin(\GroupUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::INNER_JOIN);
|
|
|
|
|
|
|
|
|
|
if ($groupUid != "") {
|
|
|
|
|
$criteria->add(\GroupUserPeer::GRP_UID, $groupUid, \Criteria::EQUAL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$criteria->add(\UsersPeer::USR_STATUS, "CLOSED", \Criteria::NOT_EQUAL);
|
|
|
|
|
$criteria->addGroupByColumn(\GroupUserPeer::GRP_UID);
|
|
|
|
|
|
|
|
|
|
$rsCriteria = \GroupUserPeer::doSelectRS($criteria);
|
|
|
|
|
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
|
|
|
|
|
|
|
|
|
while ($rsCriteria->next()) {
|
|
|
|
|
$row = $rsCriteria->getRow();
|
|
|
|
|
|
2014-06-23 12:56:23 -04:00
|
|
|
$arrayData[$row["GRP_UID"]] = (int)($row["NUM_REC"]);
|
2014-01-29 17:46:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Return
|
|
|
|
|
return $arrayData;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get data of total Tasks by Group
|
|
|
|
|
*
|
|
|
|
|
* @param string $groupUid Unique id of Group
|
|
|
|
|
*
|
|
|
|
|
* return array Return an array with data of total Tasks by Group
|
|
|
|
|
*/
|
|
|
|
|
public function getTotalTasksByGroup($groupUid = "")
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$arrayData = array();
|
|
|
|
|
|
|
|
|
|
//Verif data
|
|
|
|
|
if ($groupUid != "") {
|
2014-04-01 17:30:02 -04:00
|
|
|
$this->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
2014-01-29 17:46:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Get data
|
|
|
|
|
$criteria = new \Criteria("workflow");
|
|
|
|
|
|
|
|
|
|
$criteria->addAsColumn("GRP_UID", \TaskUserPeer::USR_UID);
|
2014-06-23 12:56:23 -04:00
|
|
|
$criteria->addAsColumn("NUM_REC", "COUNT(" . \TaskUserPeer::USR_UID . ")");
|
2014-01-29 17:46:28 -04:00
|
|
|
|
|
|
|
|
if ($groupUid != "") {
|
|
|
|
|
$criteria->add(\TaskUserPeer::USR_UID, $groupUid, \Criteria::EQUAL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$criteria->add(\TaskUserPeer::TU_TYPE, 1, \Criteria::EQUAL);
|
|
|
|
|
$criteria->add(\TaskUserPeer::TU_RELATION, 2, \Criteria::EQUAL);
|
|
|
|
|
$criteria->addGroupByColumn(\TaskUserPeer::USR_UID);
|
|
|
|
|
|
|
|
|
|
$rsCriteria = \TaskUserPeer::doSelectRS($criteria);
|
|
|
|
|
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC );
|
|
|
|
|
|
|
|
|
|
while ($rsCriteria->next()) {
|
|
|
|
|
$row = $rsCriteria->getRow();
|
|
|
|
|
|
2014-06-23 12:56:23 -04:00
|
|
|
$arrayData[$row["GRP_UID"]] = (int)($row["NUM_REC"]);
|
2014-01-29 17:46:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Return
|
|
|
|
|
return $arrayData;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get data of a Group from a record
|
|
|
|
|
*
|
|
|
|
|
* @param array $record Record
|
|
|
|
|
*
|
|
|
|
|
* return array Return an array with data Group
|
|
|
|
|
*/
|
|
|
|
|
public function getGroupDataFromRecord($record)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
return array(
|
2014-01-30 14:30:18 -04:00
|
|
|
$this->getFieldNameByFormatFieldName("GRP_UID") => $record["GRP_UID"],
|
|
|
|
|
$this->getFieldNameByFormatFieldName("GRP_TITLE") => $record["GRP_TITLE"],
|
|
|
|
|
$this->getFieldNameByFormatFieldName("GRP_STATUS") => $record["GRP_STATUS"],
|
2014-06-23 12:56:23 -04:00
|
|
|
$this->getFieldNameByFormatFieldName("GRP_USERS") => $record["GRP_USERS"],
|
|
|
|
|
$this->getFieldNameByFormatFieldName("GRP_TASKS") => $record["GRP_TASKS"]
|
2014-01-29 17:46:28 -04:00
|
|
|
);
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get all Groups
|
|
|
|
|
*
|
|
|
|
|
* @param array $arrayFilterData Data of the filters
|
|
|
|
|
* @param string $sortField Field name to sort
|
|
|
|
|
* @param string $sortDir Direction of sorting (ASC, DESC)
|
|
|
|
|
* @param int $start Start
|
|
|
|
|
* @param int $limit Limit
|
|
|
|
|
*
|
|
|
|
|
* return array Return an array with all Groups
|
|
|
|
|
*/
|
|
|
|
|
public function getGroups($arrayFilterData = null, $sortField = null, $sortDir = null, $start = null, $limit = null)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$arrayGroup = array();
|
|
|
|
|
|
PM-3659 "Uso de interface lenta (assignment rules) cuando..." SOLVED
Issue:
Uso de interface lenta (assignment rules) cuando se tienen varios usuarios (40000)
Cause:
No se realizo de manera correcta el paginado de registros
Solution:
> Se a implementado los siguientes end-points:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-available-assignee/paged
Estos end-points aceptan los siguientes parametros:
/paged?filter={filter}&start={start}&limit={limit}&type={type}
/paged?lfilter={lfilter}&start={start}&limit={limit}&type={type}
/paged?rfilter={rfilter}&start={start}&limit={limit}&type={type}
Donde:
filter: Representa la busqueda de registros que contienen este valor
lfilter: Representa la busqueda de registros que empiezan con este valor
rfilter: Representa la busqueda de registros que terminan con este valor
type: Acepta los siguentes valores: "user", "group"
Ejemplo:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged?start=0&limit=3
<<<<< 200
{
"total": 15,
"start": 0,
"limit": 3,
"filter": "",
"data": [
{
"aas_uid": "60593768854492f8fa43aa2064326562",
"aas_name": "GROUP1 (2 Users)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "11886228656016c9329c898096916123",
"aas_name": "GROUP2 (1 User)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "52242914255f202805bd552031573543",
"aas_name": "user1",
"aas_lastname": "user1",
"aas_username": "user1",
"aas_type": "user"
}
]
}
> Se a mejorado los siguientes end-points:
GET /api/1.0/{workspace}/users?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?rfilter={rfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?rfilter={rfilter}&start={start}&limit={limit}
2015-09-25 15:11:42 -04:00
|
|
|
$numRecTotal = 0;
|
|
|
|
|
|
2014-01-29 17:46:28 -04:00
|
|
|
//Verify data
|
2014-04-02 16:51:28 -04:00
|
|
|
$process = new \ProcessMaker\BusinessModel\Process();
|
2014-01-29 17:46:28 -04:00
|
|
|
|
2014-02-10 17:16:44 -04:00
|
|
|
$process->throwExceptionIfDataNotMetPagerVarDefinition(array("start" => $start, "limit" => $limit), $this->arrayFieldNameForException);
|
2014-01-29 17:46:28 -04:00
|
|
|
|
PM-3659 "Uso de interface lenta (assignment rules) cuando..." SOLVED
Issue:
Uso de interface lenta (assignment rules) cuando se tienen varios usuarios (40000)
Cause:
No se realizo de manera correcta el paginado de registros
Solution:
> Se a implementado los siguientes end-points:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-available-assignee/paged
Estos end-points aceptan los siguientes parametros:
/paged?filter={filter}&start={start}&limit={limit}&type={type}
/paged?lfilter={lfilter}&start={start}&limit={limit}&type={type}
/paged?rfilter={rfilter}&start={start}&limit={limit}&type={type}
Donde:
filter: Representa la busqueda de registros que contienen este valor
lfilter: Representa la busqueda de registros que empiezan con este valor
rfilter: Representa la busqueda de registros que terminan con este valor
type: Acepta los siguentes valores: "user", "group"
Ejemplo:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged?start=0&limit=3
<<<<< 200
{
"total": 15,
"start": 0,
"limit": 3,
"filter": "",
"data": [
{
"aas_uid": "60593768854492f8fa43aa2064326562",
"aas_name": "GROUP1 (2 Users)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "11886228656016c9329c898096916123",
"aas_name": "GROUP2 (1 User)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "52242914255f202805bd552031573543",
"aas_name": "user1",
"aas_lastname": "user1",
"aas_username": "user1",
"aas_type": "user"
}
]
}
> Se a mejorado los siguientes end-points:
GET /api/1.0/{workspace}/users?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?rfilter={rfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?rfilter={rfilter}&start={start}&limit={limit}
2015-09-25 15:11:42 -04:00
|
|
|
//Set variables
|
|
|
|
|
$filterName = "filter";
|
|
|
|
|
|
|
|
|
|
if (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData["filter"])) {
|
|
|
|
|
$arrayAux = array(
|
|
|
|
|
"" => "filter",
|
|
|
|
|
"LEFT" => "lfilter",
|
|
|
|
|
"RIGHT" => "rfilter"
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$filterName = $arrayAux[(isset($arrayFilterData["filterOption"]))? $arrayFilterData["filterOption"] : ""];
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-29 17:46:28 -04:00
|
|
|
//Get data
|
|
|
|
|
if (!is_null($limit) && $limit . "" == "0") {
|
PM-3659 "Uso de interface lenta (assignment rules) cuando..." SOLVED
Issue:
Uso de interface lenta (assignment rules) cuando se tienen varios usuarios (40000)
Cause:
No se realizo de manera correcta el paginado de registros
Solution:
> Se a implementado los siguientes end-points:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-available-assignee/paged
Estos end-points aceptan los siguientes parametros:
/paged?filter={filter}&start={start}&limit={limit}&type={type}
/paged?lfilter={lfilter}&start={start}&limit={limit}&type={type}
/paged?rfilter={rfilter}&start={start}&limit={limit}&type={type}
Donde:
filter: Representa la busqueda de registros que contienen este valor
lfilter: Representa la busqueda de registros que empiezan con este valor
rfilter: Representa la busqueda de registros que terminan con este valor
type: Acepta los siguentes valores: "user", "group"
Ejemplo:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged?start=0&limit=3
<<<<< 200
{
"total": 15,
"start": 0,
"limit": 3,
"filter": "",
"data": [
{
"aas_uid": "60593768854492f8fa43aa2064326562",
"aas_name": "GROUP1 (2 Users)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "11886228656016c9329c898096916123",
"aas_name": "GROUP2 (1 User)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "52242914255f202805bd552031573543",
"aas_name": "user1",
"aas_lastname": "user1",
"aas_username": "user1",
"aas_type": "user"
}
]
}
> Se a mejorado los siguientes end-points:
GET /api/1.0/{workspace}/users?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?rfilter={rfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?rfilter={rfilter}&start={start}&limit={limit}
2015-09-25 15:11:42 -04:00
|
|
|
//Return
|
|
|
|
|
return array(
|
|
|
|
|
"total" => $numRecTotal,
|
|
|
|
|
"start" => (int)((!is_null($start))? $start : 0),
|
|
|
|
|
"limit" => (int)((!is_null($limit))? $limit : 0),
|
|
|
|
|
$filterName => (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData["filter"]))? $arrayFilterData["filter"] : "",
|
|
|
|
|
"data" => $arrayGroup
|
|
|
|
|
);
|
2014-01-29 17:46:28 -04:00
|
|
|
}
|
|
|
|
|
|
PM-3659 "Uso de interface lenta (assignment rules) cuando..." SOLVED
Issue:
Uso de interface lenta (assignment rules) cuando se tienen varios usuarios (40000)
Cause:
No se realizo de manera correcta el paginado de registros
Solution:
> Se a implementado los siguientes end-points:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-available-assignee/paged
Estos end-points aceptan los siguientes parametros:
/paged?filter={filter}&start={start}&limit={limit}&type={type}
/paged?lfilter={lfilter}&start={start}&limit={limit}&type={type}
/paged?rfilter={rfilter}&start={start}&limit={limit}&type={type}
Donde:
filter: Representa la busqueda de registros que contienen este valor
lfilter: Representa la busqueda de registros que empiezan con este valor
rfilter: Representa la busqueda de registros que terminan con este valor
type: Acepta los siguentes valores: "user", "group"
Ejemplo:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged?start=0&limit=3
<<<<< 200
{
"total": 15,
"start": 0,
"limit": 3,
"filter": "",
"data": [
{
"aas_uid": "60593768854492f8fa43aa2064326562",
"aas_name": "GROUP1 (2 Users)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "11886228656016c9329c898096916123",
"aas_name": "GROUP2 (1 User)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "52242914255f202805bd552031573543",
"aas_name": "user1",
"aas_lastname": "user1",
"aas_username": "user1",
"aas_type": "user"
}
]
}
> Se a mejorado los siguientes end-points:
GET /api/1.0/{workspace}/users?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?rfilter={rfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?rfilter={rfilter}&start={start}&limit={limit}
2015-09-25 15:11:42 -04:00
|
|
|
//Set variables
|
2014-01-29 17:46:28 -04:00
|
|
|
$arrayTotalUsersByGroup = $this->getTotalUsersByGroup();
|
|
|
|
|
$arrayTotalTasksByGroup = $this->getTotalTasksByGroup();
|
|
|
|
|
|
PM-3659 "Uso de interface lenta (assignment rules) cuando..." SOLVED
Issue:
Uso de interface lenta (assignment rules) cuando se tienen varios usuarios (40000)
Cause:
No se realizo de manera correcta el paginado de registros
Solution:
> Se a implementado los siguientes end-points:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-available-assignee/paged
Estos end-points aceptan los siguientes parametros:
/paged?filter={filter}&start={start}&limit={limit}&type={type}
/paged?lfilter={lfilter}&start={start}&limit={limit}&type={type}
/paged?rfilter={rfilter}&start={start}&limit={limit}&type={type}
Donde:
filter: Representa la busqueda de registros que contienen este valor
lfilter: Representa la busqueda de registros que empiezan con este valor
rfilter: Representa la busqueda de registros que terminan con este valor
type: Acepta los siguentes valores: "user", "group"
Ejemplo:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged?start=0&limit=3
<<<<< 200
{
"total": 15,
"start": 0,
"limit": 3,
"filter": "",
"data": [
{
"aas_uid": "60593768854492f8fa43aa2064326562",
"aas_name": "GROUP1 (2 Users)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "11886228656016c9329c898096916123",
"aas_name": "GROUP2 (1 User)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "52242914255f202805bd552031573543",
"aas_name": "user1",
"aas_lastname": "user1",
"aas_username": "user1",
"aas_type": "user"
}
]
}
> Se a mejorado los siguientes end-points:
GET /api/1.0/{workspace}/users?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?rfilter={rfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?rfilter={rfilter}&start={start}&limit={limit}
2015-09-25 15:11:42 -04:00
|
|
|
//Query
|
2014-01-29 17:46:28 -04:00
|
|
|
$criteria = $this->getGroupCriteria();
|
|
|
|
|
|
|
|
|
|
if (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData["filter"]) && trim($arrayFilterData["filter"]) != "") {
|
PM-3659 "Uso de interface lenta (assignment rules) cuando..." SOLVED
Issue:
Uso de interface lenta (assignment rules) cuando se tienen varios usuarios (40000)
Cause:
No se realizo de manera correcta el paginado de registros
Solution:
> Se a implementado los siguientes end-points:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-available-assignee/paged
Estos end-points aceptan los siguientes parametros:
/paged?filter={filter}&start={start}&limit={limit}&type={type}
/paged?lfilter={lfilter}&start={start}&limit={limit}&type={type}
/paged?rfilter={rfilter}&start={start}&limit={limit}&type={type}
Donde:
filter: Representa la busqueda de registros que contienen este valor
lfilter: Representa la busqueda de registros que empiezan con este valor
rfilter: Representa la busqueda de registros que terminan con este valor
type: Acepta los siguentes valores: "user", "group"
Ejemplo:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged?start=0&limit=3
<<<<< 200
{
"total": 15,
"start": 0,
"limit": 3,
"filter": "",
"data": [
{
"aas_uid": "60593768854492f8fa43aa2064326562",
"aas_name": "GROUP1 (2 Users)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "11886228656016c9329c898096916123",
"aas_name": "GROUP2 (1 User)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "52242914255f202805bd552031573543",
"aas_name": "user1",
"aas_lastname": "user1",
"aas_username": "user1",
"aas_type": "user"
}
]
}
> Se a mejorado los siguientes end-points:
GET /api/1.0/{workspace}/users?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?rfilter={rfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?rfilter={rfilter}&start={start}&limit={limit}
2015-09-25 15:11:42 -04:00
|
|
|
$arraySearch = array(
|
|
|
|
|
"" => "%" . $arrayFilterData["filter"] . "%",
|
|
|
|
|
"LEFT" => $arrayFilterData["filter"] . "%",
|
|
|
|
|
"RIGHT" => "%" . $arrayFilterData["filter"]
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$search = $arraySearch[(isset($arrayFilterData["filterOption"]))? $arrayFilterData["filterOption"] : ""];
|
|
|
|
|
|
2016-06-16 16:23:42 -04:00
|
|
|
$criteria->add(\GroupwfPeer::GRP_TITLE, $search, \Criteria::LIKE);
|
2014-01-29 17:46:28 -04:00
|
|
|
}
|
|
|
|
|
|
PM-3659 "Uso de interface lenta (assignment rules) cuando..." SOLVED
Issue:
Uso de interface lenta (assignment rules) cuando se tienen varios usuarios (40000)
Cause:
No se realizo de manera correcta el paginado de registros
Solution:
> Se a implementado los siguientes end-points:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-available-assignee/paged
Estos end-points aceptan los siguientes parametros:
/paged?filter={filter}&start={start}&limit={limit}&type={type}
/paged?lfilter={lfilter}&start={start}&limit={limit}&type={type}
/paged?rfilter={rfilter}&start={start}&limit={limit}&type={type}
Donde:
filter: Representa la busqueda de registros que contienen este valor
lfilter: Representa la busqueda de registros que empiezan con este valor
rfilter: Representa la busqueda de registros que terminan con este valor
type: Acepta los siguentes valores: "user", "group"
Ejemplo:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged?start=0&limit=3
<<<<< 200
{
"total": 15,
"start": 0,
"limit": 3,
"filter": "",
"data": [
{
"aas_uid": "60593768854492f8fa43aa2064326562",
"aas_name": "GROUP1 (2 Users)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "11886228656016c9329c898096916123",
"aas_name": "GROUP2 (1 User)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "52242914255f202805bd552031573543",
"aas_name": "user1",
"aas_lastname": "user1",
"aas_username": "user1",
"aas_type": "user"
}
]
}
> Se a mejorado los siguientes end-points:
GET /api/1.0/{workspace}/users?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?rfilter={rfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?rfilter={rfilter}&start={start}&limit={limit}
2015-09-25 15:11:42 -04:00
|
|
|
//Number records total
|
|
|
|
|
$criteriaCount = clone $criteria;
|
|
|
|
|
|
|
|
|
|
$criteriaCount->clearSelectColumns();
|
|
|
|
|
$criteriaCount->addSelectColumn("COUNT(" . \GroupwfPeer::GRP_UID . ") AS NUM_REC");
|
|
|
|
|
|
|
|
|
|
$rsCriteriaCount = \GroupwfPeer::doSelectRS($criteriaCount);
|
|
|
|
|
$rsCriteriaCount->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
|
|
|
|
|
|
|
|
|
$result = $rsCriteriaCount->next();
|
|
|
|
|
$row = $rsCriteriaCount->getRow();
|
|
|
|
|
|
|
|
|
|
$numRecTotal = (int)($row["NUM_REC"]);
|
|
|
|
|
|
|
|
|
|
//Query
|
2014-01-29 17:46:28 -04:00
|
|
|
if (!is_null($sortField) && trim($sortField) != "") {
|
|
|
|
|
$sortField = strtoupper($sortField);
|
|
|
|
|
|
PM-3659 "Uso de interface lenta (assignment rules) cuando..." SOLVED
Issue:
Uso de interface lenta (assignment rules) cuando se tienen varios usuarios (40000)
Cause:
No se realizo de manera correcta el paginado de registros
Solution:
> Se a implementado los siguientes end-points:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-available-assignee/paged
Estos end-points aceptan los siguientes parametros:
/paged?filter={filter}&start={start}&limit={limit}&type={type}
/paged?lfilter={lfilter}&start={start}&limit={limit}&type={type}
/paged?rfilter={rfilter}&start={start}&limit={limit}&type={type}
Donde:
filter: Representa la busqueda de registros que contienen este valor
lfilter: Representa la busqueda de registros que empiezan con este valor
rfilter: Representa la busqueda de registros que terminan con este valor
type: Acepta los siguentes valores: "user", "group"
Ejemplo:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged?start=0&limit=3
<<<<< 200
{
"total": 15,
"start": 0,
"limit": 3,
"filter": "",
"data": [
{
"aas_uid": "60593768854492f8fa43aa2064326562",
"aas_name": "GROUP1 (2 Users)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "11886228656016c9329c898096916123",
"aas_name": "GROUP2 (1 User)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "52242914255f202805bd552031573543",
"aas_name": "user1",
"aas_lastname": "user1",
"aas_username": "user1",
"aas_type": "user"
}
]
}
> Se a mejorado los siguientes end-points:
GET /api/1.0/{workspace}/users?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?rfilter={rfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?rfilter={rfilter}&start={start}&limit={limit}
2015-09-25 15:11:42 -04:00
|
|
|
if (in_array(\GroupwfPeer::TABLE_NAME . "." . $sortField, $criteria->getSelectColumns())) {
|
2014-06-23 12:56:23 -04:00
|
|
|
$sortField = \GroupwfPeer::TABLE_NAME . "." . $sortField;
|
|
|
|
|
} else {
|
|
|
|
|
$sortField = "GRP_TITLE";
|
2014-01-29 17:46:28 -04:00
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$sortField = "GRP_TITLE";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!is_null($sortDir) && trim($sortDir) != "" && strtoupper($sortDir) == "DESC") {
|
|
|
|
|
$criteria->addDescendingOrderByColumn($sortField);
|
|
|
|
|
} else {
|
|
|
|
|
$criteria->addAscendingOrderByColumn($sortField);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!is_null($start)) {
|
|
|
|
|
$criteria->setOffset((int)($start));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!is_null($limit)) {
|
|
|
|
|
$criteria->setLimit((int)($limit));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$rsCriteria = \GroupwfPeer::doSelectRS($criteria);
|
|
|
|
|
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
|
|
|
|
|
|
|
|
|
while ($rsCriteria->next()) {
|
|
|
|
|
$row = $rsCriteria->getRow();
|
|
|
|
|
|
|
|
|
|
$row["GRP_USERS"] = (isset($arrayTotalUsersByGroup[$row["GRP_UID"]]))? $arrayTotalUsersByGroup[$row["GRP_UID"]] : 0;
|
|
|
|
|
$row["GRP_TASKS"] = (isset($arrayTotalTasksByGroup[$row["GRP_UID"]]))? $arrayTotalTasksByGroup[$row["GRP_UID"]] : 0;
|
|
|
|
|
|
|
|
|
|
$arrayGroup[] = $this->getGroupDataFromRecord($row);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Return
|
PM-3659 "Uso de interface lenta (assignment rules) cuando..." SOLVED
Issue:
Uso de interface lenta (assignment rules) cuando se tienen varios usuarios (40000)
Cause:
No se realizo de manera correcta el paginado de registros
Solution:
> Se a implementado los siguientes end-points:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-available-assignee/paged
Estos end-points aceptan los siguientes parametros:
/paged?filter={filter}&start={start}&limit={limit}&type={type}
/paged?lfilter={lfilter}&start={start}&limit={limit}&type={type}
/paged?rfilter={rfilter}&start={start}&limit={limit}&type={type}
Donde:
filter: Representa la busqueda de registros que contienen este valor
lfilter: Representa la busqueda de registros que empiezan con este valor
rfilter: Representa la busqueda de registros que terminan con este valor
type: Acepta los siguentes valores: "user", "group"
Ejemplo:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged?start=0&limit=3
<<<<< 200
{
"total": 15,
"start": 0,
"limit": 3,
"filter": "",
"data": [
{
"aas_uid": "60593768854492f8fa43aa2064326562",
"aas_name": "GROUP1 (2 Users)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "11886228656016c9329c898096916123",
"aas_name": "GROUP2 (1 User)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "52242914255f202805bd552031573543",
"aas_name": "user1",
"aas_lastname": "user1",
"aas_username": "user1",
"aas_type": "user"
}
]
}
> Se a mejorado los siguientes end-points:
GET /api/1.0/{workspace}/users?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?rfilter={rfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?rfilter={rfilter}&start={start}&limit={limit}
2015-09-25 15:11:42 -04:00
|
|
|
return array(
|
|
|
|
|
"total" => $numRecTotal,
|
|
|
|
|
"start" => (int)((!is_null($start))? $start : 0),
|
|
|
|
|
"limit" => (int)((!is_null($limit))? $limit : 0),
|
|
|
|
|
$filterName => (!is_null($arrayFilterData) && is_array($arrayFilterData) && isset($arrayFilterData["filter"]))? $arrayFilterData["filter"] : "",
|
|
|
|
|
"data" => $arrayGroup
|
|
|
|
|
);
|
2014-01-29 17:46:28 -04:00
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get data of a Group
|
|
|
|
|
*
|
|
|
|
|
* @param string $groupUid Unique id of Group
|
|
|
|
|
*
|
|
|
|
|
* return array Return an array with data of a Group
|
|
|
|
|
*/
|
|
|
|
|
public function getGroup($groupUid)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
//Verify data
|
2014-04-01 17:30:02 -04:00
|
|
|
$this->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
2014-01-29 17:46:28 -04:00
|
|
|
|
|
|
|
|
//Get data
|
|
|
|
|
$arrayTotalUsersByGroup = $this->getTotalUsersByGroup($groupUid);
|
|
|
|
|
$arrayTotalTasksByGroup = $this->getTotalTasksByGroup($groupUid);
|
|
|
|
|
|
|
|
|
|
//SQL
|
|
|
|
|
$criteria = $this->getGroupCriteria();
|
|
|
|
|
|
|
|
|
|
$criteria->add(\GroupwfPeer::GRP_UID, $groupUid, \Criteria::EQUAL);
|
|
|
|
|
|
|
|
|
|
$rsCriteria = \GroupwfPeer::doSelectRS($criteria);
|
|
|
|
|
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
|
|
|
|
|
|
|
|
|
$rsCriteria->next();
|
|
|
|
|
|
|
|
|
|
$row = $rsCriteria->getRow();
|
|
|
|
|
|
|
|
|
|
$row["GRP_USERS"] = (isset($arrayTotalUsersByGroup[$groupUid]))? $arrayTotalUsersByGroup[$groupUid] : 0;
|
|
|
|
|
$row["GRP_TASKS"] = (isset($arrayTotalTasksByGroup[$groupUid]))? $arrayTotalTasksByGroup[$groupUid] : 0;
|
|
|
|
|
|
|
|
|
|
//Return
|
|
|
|
|
return $this->getGroupDataFromRecord($row);
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-02-10 17:16:44 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get criteria for User
|
|
|
|
|
*
|
|
|
|
|
* @param string $groupUid Unique id of Group
|
|
|
|
|
* @param array $arrayFilterData Data of the filters
|
|
|
|
|
* @param array $arrayUserUidExclude Unique id of Users to exclude
|
|
|
|
|
*
|
|
|
|
|
* return object
|
|
|
|
|
*/
|
HOR-1293 "Create PMFunction to Send Message to Group PMFSendMessageToGroup" SOLVED
Issue:
Create PMFunction to Send Message to Group PMFSendMessageToGroup
Cause:
Nuevo requerimiento de funcion
Solution:
Se a implementado la nueva funcion:
function PMFSendMessageToGroup(
$groupId,
$caseId,
$from,
$subject,
$template,
$arrayField = [],
$arrayAttachment = [],
$showMessage = true,
$delIndex = 0,
$config = [],
$limit = 100
)
2016-07-21 10:07:00 -04:00
|
|
|
public function getUserCriteria($groupUid, array $arrayWhere = null, $arrayUserUidExclude = null)
|
2014-02-10 17:16:44 -04:00
|
|
|
{
|
|
|
|
|
try {
|
HOR-1293 "Create PMFunction to Send Message to Group PMFSendMessageToGroup" SOLVED
Issue:
Create PMFunction to Send Message to Group PMFSendMessageToGroup
Cause:
Nuevo requerimiento de funcion
Solution:
Se a implementado la nueva funcion:
function PMFSendMessageToGroup(
$groupId,
$caseId,
$from,
$subject,
$template,
$arrayField = [],
$arrayAttachment = [],
$showMessage = true,
$delIndex = 0,
$config = [],
$limit = 100
)
2016-07-21 10:07:00 -04:00
|
|
|
$flag = !is_null($arrayWhere) && is_array($arrayWhere);
|
|
|
|
|
$flagCondition = $flag && array_key_exists('condition', $arrayWhere);
|
|
|
|
|
$flagFilter = $flag && array_key_exists('filter', $arrayWhere);
|
|
|
|
|
|
2014-02-10 17:16:44 -04:00
|
|
|
$criteria = new \Criteria("workflow");
|
|
|
|
|
|
|
|
|
|
$criteria->addSelectColumn(\UsersPeer::USR_UID);
|
|
|
|
|
$criteria->addSelectColumn(\UsersPeer::USR_USERNAME);
|
|
|
|
|
$criteria->addSelectColumn(\UsersPeer::USR_FIRSTNAME);
|
|
|
|
|
$criteria->addSelectColumn(\UsersPeer::USR_LASTNAME);
|
|
|
|
|
$criteria->addSelectColumn(\UsersPeer::USR_EMAIL);
|
|
|
|
|
$criteria->addSelectColumn(\UsersPeer::USR_STATUS);
|
|
|
|
|
|
|
|
|
|
if ($groupUid != "") {
|
|
|
|
|
$criteria->addJoin(\GroupUserPeer::USR_UID, \UsersPeer::USR_UID, \Criteria::LEFT_JOIN);
|
|
|
|
|
$criteria->add(\GroupUserPeer::GRP_UID, $groupUid, \Criteria::EQUAL);
|
|
|
|
|
}
|
|
|
|
|
|
HOR-1293 "Create PMFunction to Send Message to Group PMFSendMessageToGroup" SOLVED
Issue:
Create PMFunction to Send Message to Group PMFSendMessageToGroup
Cause:
Nuevo requerimiento de funcion
Solution:
Se a implementado la nueva funcion:
function PMFSendMessageToGroup(
$groupId,
$caseId,
$from,
$subject,
$template,
$arrayField = [],
$arrayAttachment = [],
$showMessage = true,
$delIndex = 0,
$config = [],
$limit = 100
)
2016-07-21 10:07:00 -04:00
|
|
|
if ($flagCondition && !empty($arrayWhere['condition'])) {
|
|
|
|
|
foreach ($arrayWhere['condition'] as $value) {
|
|
|
|
|
$criteria->add($value[0], $value[1], $value[2]);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$criteria->add(\UsersPeer::USR_STATUS, 'CLOSED', \Criteria::NOT_EQUAL);
|
|
|
|
|
}
|
2014-02-10 17:16:44 -04:00
|
|
|
|
|
|
|
|
if (!is_null($arrayUserUidExclude) && is_array($arrayUserUidExclude)) {
|
|
|
|
|
$criteria->add(\UsersPeer::USR_UID, $arrayUserUidExclude, \Criteria::NOT_IN);
|
|
|
|
|
}
|
|
|
|
|
|
HOR-1293 "Create PMFunction to Send Message to Group PMFSendMessageToGroup" SOLVED
Issue:
Create PMFunction to Send Message to Group PMFSendMessageToGroup
Cause:
Nuevo requerimiento de funcion
Solution:
Se a implementado la nueva funcion:
function PMFSendMessageToGroup(
$groupId,
$caseId,
$from,
$subject,
$template,
$arrayField = [],
$arrayAttachment = [],
$showMessage = true,
$delIndex = 0,
$config = [],
$limit = 100
)
2016-07-21 10:07:00 -04:00
|
|
|
if ($flagFilter && trim($arrayWhere['filter']) != '') {
|
2014-02-10 17:16:44 -04:00
|
|
|
$criteria->add(
|
HOR-1293 "Create PMFunction to Send Message to Group PMFSendMessageToGroup" SOLVED
Issue:
Create PMFunction to Send Message to Group PMFSendMessageToGroup
Cause:
Nuevo requerimiento de funcion
Solution:
Se a implementado la nueva funcion:
function PMFSendMessageToGroup(
$groupId,
$caseId,
$from,
$subject,
$template,
$arrayField = [],
$arrayAttachment = [],
$showMessage = true,
$delIndex = 0,
$config = [],
$limit = 100
)
2016-07-21 10:07:00 -04:00
|
|
|
$criteria->getNewCriterion(\UsersPeer::USR_USERNAME, '%' . $arrayWhere['filter'] . '%', \Criteria::LIKE)->addOr(
|
|
|
|
|
$criteria->getNewCriterion(\UsersPeer::USR_FIRSTNAME, '%' . $arrayWhere['filter'] . '%', \Criteria::LIKE)->addOr(
|
|
|
|
|
$criteria->getNewCriterion(\UsersPeer::USR_LASTNAME, '%' . $arrayWhere['filter'] . '%', \Criteria::LIKE)))
|
2014-02-10 17:16:44 -04:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $criteria;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get data of a User from a record
|
|
|
|
|
*
|
|
|
|
|
* @param array $record Record
|
|
|
|
|
*
|
|
|
|
|
* return array Return an array with data User
|
|
|
|
|
*/
|
|
|
|
|
public function getUserDataFromRecord($record)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
return array(
|
|
|
|
|
$this->getFieldNameByFormatFieldName("USR_UID") => $record["USR_UID"],
|
|
|
|
|
$this->getFieldNameByFormatFieldName("USR_USERNAME") => $record["USR_USERNAME"],
|
|
|
|
|
$this->getFieldNameByFormatFieldName("USR_FIRSTNAME") => $record["USR_FIRSTNAME"] . "",
|
|
|
|
|
$this->getFieldNameByFormatFieldName("USR_LASTNAME") => $record["USR_LASTNAME"] . "",
|
|
|
|
|
$this->getFieldNameByFormatFieldName("USR_EMAIL") => $record["USR_EMAIL"] . "",
|
|
|
|
|
$this->getFieldNameByFormatFieldName("USR_STATUS") => $record["USR_STATUS"]
|
|
|
|
|
);
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2015-08-12 09:18:47 -04:00
|
|
|
/**
|
PM-3659 "Uso de interface lenta (assignment rules) cuando..." SOLVED
Issue:
Uso de interface lenta (assignment rules) cuando se tienen varios usuarios (40000)
Cause:
No se realizo de manera correcta el paginado de registros
Solution:
> Se a implementado los siguientes end-points:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-available-assignee/paged
Estos end-points aceptan los siguientes parametros:
/paged?filter={filter}&start={start}&limit={limit}&type={type}
/paged?lfilter={lfilter}&start={start}&limit={limit}&type={type}
/paged?rfilter={rfilter}&start={start}&limit={limit}&type={type}
Donde:
filter: Representa la busqueda de registros que contienen este valor
lfilter: Representa la busqueda de registros que empiezan con este valor
rfilter: Representa la busqueda de registros que terminan con este valor
type: Acepta los siguentes valores: "user", "group"
Ejemplo:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged?start=0&limit=3
<<<<< 200
{
"total": 15,
"start": 0,
"limit": 3,
"filter": "",
"data": [
{
"aas_uid": "60593768854492f8fa43aa2064326562",
"aas_name": "GROUP1 (2 Users)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "11886228656016c9329c898096916123",
"aas_name": "GROUP2 (1 User)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "52242914255f202805bd552031573543",
"aas_name": "user1",
"aas_lastname": "user1",
"aas_username": "user1",
"aas_type": "user"
}
]
}
> Se a mejorado los siguientes end-points:
GET /api/1.0/{workspace}/users?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?rfilter={rfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?rfilter={rfilter}&start={start}&limit={limit}
2015-09-25 15:11:42 -04:00
|
|
|
* return permissions of user
|
2015-08-12 09:18:47 -04:00
|
|
|
*/
|
|
|
|
|
public function loadUserRolePermission ($sSystem, $sUser)
|
|
|
|
|
{
|
|
|
|
|
require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "UsersRoles.php");
|
|
|
|
|
require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Systems.php");
|
|
|
|
|
require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "RbacUsers.php");
|
|
|
|
|
require_once (PATH_RBAC_HOME . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "RolesPeer.php");
|
|
|
|
|
$this->sSystem = $sSystem;
|
|
|
|
|
$this->usersRolesObj = new \UsersRoles();
|
|
|
|
|
$this->systemObj = new \Systems();
|
|
|
|
|
$fieldsSystem = $this->systemObj->loadByCode( $sSystem );
|
|
|
|
|
$fieldsRoles = $this->usersRolesObj->getRolesBySystem( $fieldsSystem['SYS_UID'], $sUser );
|
|
|
|
|
$fieldsPermissions = $this->usersRolesObj->getAllPermissions( $fieldsRoles['ROL_UID'], $sUser );
|
|
|
|
|
$this->userObj = new \RbacUsers();
|
|
|
|
|
$this->aUserInfo['USER_INFO'] = $this->userObj->load( $sUser );
|
|
|
|
|
$this->aUserInfo[$sSystem]['SYS_UID'] = $fieldsSystem['SYS_UID'];
|
|
|
|
|
$this->aUserInfo[$sSystem]['ROLE'] = $fieldsRoles;
|
|
|
|
|
$this->aUserInfo[$sSystem]['PERMISSIONS'] = $fieldsPermissions;
|
|
|
|
|
return $fieldsPermissions;
|
|
|
|
|
}
|
|
|
|
|
|
2014-02-10 17:16:44 -04:00
|
|
|
/**
|
|
|
|
|
* Get all Users of a Group
|
|
|
|
|
*
|
|
|
|
|
* @param string $option Option (USERS, AVAILABLE-USERS)
|
|
|
|
|
* @param string $groupUid Unique id of Group
|
|
|
|
|
* @param array $arrayFilterData Data of the filters
|
|
|
|
|
* @param string $sortField Field name to sort
|
|
|
|
|
* @param string $sortDir Direction of sorting (ASC, DESC)
|
|
|
|
|
* @param int $start Start
|
|
|
|
|
* @param int $limit Limit
|
|
|
|
|
*
|
|
|
|
|
* return array Return an array with all Users of a Group
|
|
|
|
|
*/
|
|
|
|
|
public function getUsers($option, $groupUid, $arrayFilterData = null, $sortField = null, $sortDir = null, $start = null, $limit = null)
|
|
|
|
|
{
|
|
|
|
|
try {
|
|
|
|
|
$arrayUser = array();
|
|
|
|
|
|
|
|
|
|
//Verify data
|
2014-04-02 16:51:28 -04:00
|
|
|
$process = new \ProcessMaker\BusinessModel\Process();
|
2014-02-10 17:16:44 -04:00
|
|
|
|
2014-04-01 17:30:02 -04:00
|
|
|
$this->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
|
2014-02-11 17:00:26 -04:00
|
|
|
|
2014-02-10 17:16:44 -04:00
|
|
|
$process->throwExceptionIfDataNotMetPagerVarDefinition(array("start" => $start, "limit" => $limit), $this->arrayFieldNameForException);
|
|
|
|
|
|
|
|
|
|
//Get data
|
|
|
|
|
if (!is_null($limit) && $limit . "" == "0") {
|
|
|
|
|
return $arrayUser;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//SQL
|
|
|
|
|
switch ($option) {
|
2015-08-12 09:18:47 -04:00
|
|
|
case "SUPERVISOR":
|
|
|
|
|
$flagPermission = true;
|
|
|
|
|
//Criteria for Supervisor
|
|
|
|
|
$criteria = $this->getUserCriteria($groupUid, $arrayFilterData);
|
|
|
|
|
break;
|
2014-02-10 17:16:44 -04:00
|
|
|
case "USERS":
|
|
|
|
|
//Criteria
|
|
|
|
|
$criteria = $this->getUserCriteria($groupUid, $arrayFilterData);
|
|
|
|
|
break;
|
|
|
|
|
case "AVAILABLE-USERS":
|
|
|
|
|
//Get Uids
|
|
|
|
|
$arrayUid = array();
|
|
|
|
|
|
|
|
|
|
$criteria = $this->getUserCriteria($groupUid);
|
|
|
|
|
|
|
|
|
|
$rsCriteria = \UsersPeer::doSelectRS($criteria);
|
|
|
|
|
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
|
|
|
|
|
|
|
|
|
while ($rsCriteria->next()) {
|
|
|
|
|
$row = $rsCriteria->getRow();
|
|
|
|
|
|
|
|
|
|
$arrayUid[] = $row["USR_UID"];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//Criteria
|
|
|
|
|
$criteria = $this->getUserCriteria("", $arrayFilterData, $arrayUid);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//SQL
|
|
|
|
|
if (!is_null($sortField) && trim($sortField) != "") {
|
|
|
|
|
$sortField = strtoupper($sortField);
|
|
|
|
|
|
2014-06-23 12:56:23 -04:00
|
|
|
if (in_array($sortField, array("USR_UID", "USR_USERNAME", "USR_FIRSTNAME", "USR_LASTNAME", "USR_EMAIL", "USR_STATUS"))) {
|
|
|
|
|
$sortField = \UsersPeer::TABLE_NAME . "." . $sortField;
|
|
|
|
|
} else {
|
|
|
|
|
$sortField = \UsersPeer::USR_USERNAME;
|
2014-02-10 17:16:44 -04:00
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
$sortField = \UsersPeer::USR_USERNAME;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!is_null($sortDir) && trim($sortDir) != "" && strtoupper($sortDir) == "DESC") {
|
|
|
|
|
$criteria->addDescendingOrderByColumn($sortField);
|
|
|
|
|
} else {
|
|
|
|
|
$criteria->addAscendingOrderByColumn($sortField);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!is_null($start)) {
|
|
|
|
|
$criteria->setOffset((int)($start));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!is_null($limit)) {
|
|
|
|
|
$criteria->setLimit((int)($limit));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$rsCriteria = \UsersPeer::doSelectRS($criteria);
|
|
|
|
|
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
|
|
|
|
|
PM-3659 "Uso de interface lenta (assignment rules) cuando..." SOLVED
Issue:
Uso de interface lenta (assignment rules) cuando se tienen varios usuarios (40000)
Cause:
No se realizo de manera correcta el paginado de registros
Solution:
> Se a implementado los siguientes end-points:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-available-assignee/paged
Estos end-points aceptan los siguientes parametros:
/paged?filter={filter}&start={start}&limit={limit}&type={type}
/paged?lfilter={lfilter}&start={start}&limit={limit}&type={type}
/paged?rfilter={rfilter}&start={start}&limit={limit}&type={type}
Donde:
filter: Representa la busqueda de registros que contienen este valor
lfilter: Representa la busqueda de registros que empiezan con este valor
rfilter: Representa la busqueda de registros que terminan con este valor
type: Acepta los siguentes valores: "user", "group"
Ejemplo:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged?start=0&limit=3
<<<<< 200
{
"total": 15,
"start": 0,
"limit": 3,
"filter": "",
"data": [
{
"aas_uid": "60593768854492f8fa43aa2064326562",
"aas_name": "GROUP1 (2 Users)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "11886228656016c9329c898096916123",
"aas_name": "GROUP2 (1 User)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "52242914255f202805bd552031573543",
"aas_name": "user1",
"aas_lastname": "user1",
"aas_username": "user1",
"aas_type": "user"
}
]
}
> Se a mejorado los siguientes end-points:
GET /api/1.0/{workspace}/users?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?rfilter={rfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?rfilter={rfilter}&start={start}&limit={limit}
2015-09-25 15:11:42 -04:00
|
|
|
if (isset($flagPermission) && $flagPermission) {
|
2015-08-12 09:18:47 -04:00
|
|
|
\G::LoadSystem('rbac');
|
|
|
|
|
while ($rsCriteria->next()) {
|
|
|
|
|
$row = $rsCriteria->getRow();
|
PM-3659 "Uso de interface lenta (assignment rules) cuando..." SOLVED
Issue:
Uso de interface lenta (assignment rules) cuando se tienen varios usuarios (40000)
Cause:
No se realizo de manera correcta el paginado de registros
Solution:
> Se a implementado los siguientes end-points:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-available-assignee/paged
Estos end-points aceptan los siguientes parametros:
/paged?filter={filter}&start={start}&limit={limit}&type={type}
/paged?lfilter={lfilter}&start={start}&limit={limit}&type={type}
/paged?rfilter={rfilter}&start={start}&limit={limit}&type={type}
Donde:
filter: Representa la busqueda de registros que contienen este valor
lfilter: Representa la busqueda de registros que empiezan con este valor
rfilter: Representa la busqueda de registros que terminan con este valor
type: Acepta los siguentes valores: "user", "group"
Ejemplo:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged?start=0&limit=3
<<<<< 200
{
"total": 15,
"start": 0,
"limit": 3,
"filter": "",
"data": [
{
"aas_uid": "60593768854492f8fa43aa2064326562",
"aas_name": "GROUP1 (2 Users)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "11886228656016c9329c898096916123",
"aas_name": "GROUP2 (1 User)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "52242914255f202805bd552031573543",
"aas_name": "user1",
"aas_lastname": "user1",
"aas_username": "user1",
"aas_type": "user"
}
]
}
> Se a mejorado los siguientes end-points:
GET /api/1.0/{workspace}/users?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?rfilter={rfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?rfilter={rfilter}&start={start}&limit={limit}
2015-09-25 15:11:42 -04:00
|
|
|
|
2015-08-12 09:18:47 -04:00
|
|
|
$aPermissions = $this->loadUserRolePermission("PROCESSMAKER", $row['USR_UID']);
|
|
|
|
|
$bInclude = false;
|
|
|
|
|
|
|
|
|
|
foreach ($aPermissions as $aPermission) {
|
|
|
|
|
if ($aPermission['PER_CODE'] == 'PM_SUPERVISOR') {
|
|
|
|
|
$bInclude = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($bInclude) {
|
|
|
|
|
$arrayUser[] = $this->getUserDataFromRecord($row);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
while ($rsCriteria->next()) {
|
|
|
|
|
$row = $rsCriteria->getRow();
|
PM-3659 "Uso de interface lenta (assignment rules) cuando..." SOLVED
Issue:
Uso de interface lenta (assignment rules) cuando se tienen varios usuarios (40000)
Cause:
No se realizo de manera correcta el paginado de registros
Solution:
> Se a implementado los siguientes end-points:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/available-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-assignee/paged
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/adhoc-available-assignee/paged
Estos end-points aceptan los siguientes parametros:
/paged?filter={filter}&start={start}&limit={limit}&type={type}
/paged?lfilter={lfilter}&start={start}&limit={limit}&type={type}
/paged?rfilter={rfilter}&start={start}&limit={limit}&type={type}
Donde:
filter: Representa la busqueda de registros que contienen este valor
lfilter: Representa la busqueda de registros que empiezan con este valor
rfilter: Representa la busqueda de registros que terminan con este valor
type: Acepta los siguentes valores: "user", "group"
Ejemplo:
GET /api/1.0/{workspace}/project/{prj_uid}/activity/{act_uid}/assignee/paged?start=0&limit=3
<<<<< 200
{
"total": 15,
"start": 0,
"limit": 3,
"filter": "",
"data": [
{
"aas_uid": "60593768854492f8fa43aa2064326562",
"aas_name": "GROUP1 (2 Users)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "11886228656016c9329c898096916123",
"aas_name": "GROUP2 (1 User)",
"aas_lastname": "",
"aas_username": "",
"aas_type": "group"
},
{
"aas_uid": "52242914255f202805bd552031573543",
"aas_name": "user1",
"aas_lastname": "user1",
"aas_username": "user1",
"aas_type": "user"
}
]
}
> Se a mejorado los siguientes end-points:
GET /api/1.0/{workspace}/users?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/users?rfilter={rfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?filter={filter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?lfilter={lfilter}&start={start}&limit={limit}
GET /api/1.0/{workspace}/groups?rfilter={rfilter}&start={start}&limit={limit}
2015-09-25 15:11:42 -04:00
|
|
|
|
2015-08-12 09:18:47 -04:00
|
|
|
$arrayUser[] = $this->getUserDataFromRecord($row);
|
|
|
|
|
}
|
2014-02-10 17:16:44 -04:00
|
|
|
}
|
|
|
|
|
//Return
|
|
|
|
|
return $arrayUser;
|
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
|
throw $e;
|
|
|
|
|
}
|
|
|
|
|
}
|
2014-01-29 17:46:28 -04:00
|
|
|
}
|
|
|
|
|
|