Se agrega metodo DELETE para FILES MANAGER. Se agregan validaciones en PROJECT USERS. se agrega la clase USER.
This commit is contained in:
@@ -95,14 +95,14 @@ class FilesManager
|
|||||||
* Return the Process File Manager
|
* Return the Process File Manager
|
||||||
*
|
*
|
||||||
* @param string $sProcessUID {@min 32} {@max 32}
|
* @param string $sProcessUID {@min 32} {@max 32}
|
||||||
* @param string $userUid {@min 32} {@max 32}
|
* @param string $userUID {@min 32} {@max 32}
|
||||||
* @param array $aData
|
* @param array $aData
|
||||||
*
|
*
|
||||||
* return array
|
* return array
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function addProcessFilesManager($sProcessUID, $userUid, $aData)
|
public function addProcessFilesManager($sProcessUID, $userUID, $aData)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if ($aData['path'] == 'templates/' || $aData['path'] == 'folder/') {
|
if ($aData['path'] == 'templates/' || $aData['path'] == 'folder/') {
|
||||||
@@ -133,7 +133,7 @@ class FilesManager
|
|||||||
$sDate = date( 'Y-m-d H:i' );
|
$sDate = date( 'Y-m-d H:i' );
|
||||||
$oProcessFiles->setPrfUid( $sPkProcessFiles );
|
$oProcessFiles->setPrfUid( $sPkProcessFiles );
|
||||||
$oProcessFiles->setProUid( $sProcessUID );
|
$oProcessFiles->setProUid( $sProcessUID );
|
||||||
$oProcessFiles->setUsrUid( $userUid );
|
$oProcessFiles->setUsrUid( $userUID );
|
||||||
$oProcessFiles->setPrfUpdateUsrUid( '' );
|
$oProcessFiles->setPrfUpdateUsrUid( '' );
|
||||||
$oProcessFiles->setPrfPath( $sDirectory );
|
$oProcessFiles->setPrfPath( $sDirectory );
|
||||||
$oProcessFiles->setPrfType( 'file' );
|
$oProcessFiles->setPrfType( 'file' );
|
||||||
@@ -176,7 +176,6 @@ class FilesManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Process Files Manager
|
* Return the Process Files Manager
|
||||||
*
|
*
|
||||||
@@ -195,20 +194,23 @@ class FilesManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the Process Files Manager
|
* Get data of unique ids of a file
|
||||||
*
|
*
|
||||||
* @param string $sProcessUID {@min 32} {@max 32}
|
* @param string $path
|
||||||
* @param string $userUid {@min 32} {@max 32}
|
|
||||||
* @param array $aData
|
|
||||||
*
|
*
|
||||||
* return array
|
* return array
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
*/
|
*/
|
||||||
public function updateProcessFilesManager($sProcessUID, $userUid, $aData)
|
public function getFileManagerUid($path)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
} catch (Exception $e) {
|
$criteria = new \Criteria("workflow");
|
||||||
|
$criteria->addSelectColumn(\ProcessFilesPeer::PRF_UID);
|
||||||
|
$criteria->add(\ProcessFilesPeer::PRF_PATH, $path, \Criteria::EQUAL);
|
||||||
|
$rsCriteria = \ProcessFilesPeer::doSelectRS($criteria);
|
||||||
|
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
$rsCriteria->next();
|
||||||
|
return $rsCriteria->getRow();
|
||||||
|
} catch (\Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -217,18 +219,95 @@ class FilesManager
|
|||||||
* Return the Process Files Manager
|
* Return the Process Files Manager
|
||||||
*
|
*
|
||||||
* @param string $sProcessUID {@min 32} {@max 32}
|
* @param string $sProcessUID {@min 32} {@max 32}
|
||||||
|
* @param string $path
|
||||||
|
* @param string $userUID {@min 32} {@max 32}
|
||||||
|
* @param array $aData
|
||||||
*
|
*
|
||||||
* return array
|
* return array
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
public function deleteProcessFilesManager($sProcessUID)
|
public function updateProcessFilesManager($sProcessUID, $userUID, $aData, $path)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$arrayTaskUid = $this->getFileManagerUid($path);
|
||||||
|
if ($aData['path'] == 'templates/' || $aData['path'] == 'folder/') {
|
||||||
|
switch ($aData['path']) {
|
||||||
|
case 'templates/':
|
||||||
|
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $aData['file_name'];
|
||||||
|
$sEditable = false;
|
||||||
|
break;
|
||||||
|
case 'folder/':
|
||||||
|
$sDirectory = PATH_DATA_PUBLIC . $sProcessUID . PATH_SEP . $aData['file_name'];
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
$sDirectory = PATH_DATA_MAILTEMPLATES . $sProcessUID . PATH_SEP . $aData['file_name'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw (new \Exception( 'invalid value specified for `prf_path`. Expecting `templates/` or `folder/`'));
|
||||||
|
}
|
||||||
|
$extention = end(explode(".", $aData['file_name']));
|
||||||
|
if ($extention == 'docx' || $extention == 'doc' || $extention == 'html' || $extention == 'php' || $extention == 'jsp' ||
|
||||||
|
$extention == 'xlsx' || $extention == 'xls' || $extention == 'js' || $extention == 'css' || $extention == 'txt') {
|
||||||
|
$sEditable = true;
|
||||||
|
} else {
|
||||||
|
$sEditable = false;
|
||||||
|
}
|
||||||
|
$sPkProcessFiles = \G::generateUniqueID();
|
||||||
|
$oProcessFiles = new \ProcessFiles();
|
||||||
|
$sDate = date( 'Y-m-d H:i' );
|
||||||
|
$oProcessFiles->setPrfUid( $sPkProcessFiles );
|
||||||
|
$oProcessFiles->setProUid( $sProcessUID );
|
||||||
|
$oProcessFiles->setUsrUid( $userUID );
|
||||||
|
$oProcessFiles->setPrfUpdateUsrUid( '' );
|
||||||
|
$oProcessFiles->setPrfPath( $sDirectory );
|
||||||
|
$oProcessFiles->setPrfType( 'file' );
|
||||||
|
$oProcessFiles->setPrfEditable( $sEditable );
|
||||||
|
$oProcessFiles->setPrfCreateDate( $sDate );
|
||||||
|
$oProcessFiles->save();
|
||||||
|
$fp = fopen($sDirectory, 'w');
|
||||||
|
$content = $aData['content'];
|
||||||
|
fwrite($fp, $content);
|
||||||
|
fclose($fp);
|
||||||
|
$oProcessFile = array('prf_uid' => $oProcessFiles->getPrfUid(),
|
||||||
|
'pro_uid' => $oProcessFiles->getProUid(),
|
||||||
|
'usr_uid' => $oProcessFiles->getUsrUid(),
|
||||||
|
'prf_update_usr_uid' => $oProcessFiles->getPrfUpdateUsrUid(),
|
||||||
|
'prf_path' => $oProcessFiles->getPrfPath(),
|
||||||
|
'prf_type' => $oProcessFiles->getPrfType(),
|
||||||
|
'prf_editable' => $oProcessFiles->getPrfEditable(),
|
||||||
|
'prf_create_date' => $oProcessFiles->getPrfCreateDate(),
|
||||||
|
'prf_update_date' => $oProcessFiles->getPrfUpdateDate());
|
||||||
|
return $oProcessFile;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param string $sProcessUID {@min 32} {@max 32}
|
||||||
|
* @param string $path
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @access public
|
||||||
|
*/
|
||||||
|
public function deleteProcessFilesManager($sProcessUID, $path)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$sPath = explode("/", $path);
|
||||||
|
$sfile = end(explode("/",$path));
|
||||||
|
$main = implode(array_slice($sPath, -3, 1));
|
||||||
|
$carpeta = '';
|
||||||
|
$oProcessMap = new \processMap(new \DBConnection());
|
||||||
|
$oProcessMap->deleteFile($sProcessUID,
|
||||||
|
$main,
|
||||||
|
$carpeta,
|
||||||
|
$sfile);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ class ProjectUser
|
|||||||
public function getProjectUsers($sProcessUID)
|
public function getProjectUsers($sProcessUID)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
|
||||||
|
if (is_null($oProcess)) {
|
||||||
|
throw (new \Exception( 'This id for `prj_uid`: '. $sProcessUID .' do not correspond to a registered process'));
|
||||||
|
}
|
||||||
$aUsers = array();
|
$aUsers = array();
|
||||||
$sDelimiter = \DBAdapter::getStringDelimiter();
|
$sDelimiter = \DBAdapter::getStringDelimiter();
|
||||||
$oCriteria = new \Criteria('workflow');
|
$oCriteria = new \Criteria('workflow');
|
||||||
@@ -98,6 +102,10 @@ class ProjectUser
|
|||||||
public function getProjectStartingTasks($sProcessUID)
|
public function getProjectStartingTasks($sProcessUID)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
|
||||||
|
if (is_null($oProcess)) {
|
||||||
|
throw (new \Exception( 'This id for `prj_uid`: '. $sProcessUID .' do not correspond to a registered process'));
|
||||||
|
}
|
||||||
$aUsers = array();
|
$aUsers = array();
|
||||||
$sDelimiter = \DBAdapter::getStringDelimiter();
|
$sDelimiter = \DBAdapter::getStringDelimiter();
|
||||||
$oCriteria = new \Criteria('workflow');
|
$oCriteria = new \Criteria('workflow');
|
||||||
@@ -157,6 +165,14 @@ class ProjectUser
|
|||||||
public function getProjectStartingTaskUsers($sProcessUID, $sUserUID)
|
public function getProjectStartingTaskUsers($sProcessUID, $sUserUID)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
|
||||||
|
if (is_null($oProcess)) {
|
||||||
|
throw (new \Exception( 'This id for `prj_uid`: '. $sProcessUID .' do not correspond to a registered process'));
|
||||||
|
}
|
||||||
|
$oUser = \UsersPeer::retrieveByPK($sUserUID);
|
||||||
|
if (is_null($oUser)) {
|
||||||
|
throw (new \Exception( 'This id for `usr_uid`: '. $userUid .' do not correspond to a registered user'));
|
||||||
|
}
|
||||||
$aUsers = array();
|
$aUsers = array();
|
||||||
\G::LoadClass( 'case' );
|
\G::LoadClass( 'case' );
|
||||||
$oCase = new \Cases();
|
$oCase = new \Cases();
|
||||||
@@ -189,6 +205,10 @@ class ProjectUser
|
|||||||
public function postProjectWsUserCanStartTask($sProcessUID, $oData)
|
public function postProjectWsUserCanStartTask($sProcessUID, $oData)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$oProcess = \ProcessPeer::retrieveByPK( $sProcessUID );
|
||||||
|
if (is_null($oProcess)) {
|
||||||
|
throw (new \Exception( 'This id for `prj_uid`: '. $sProcessUID .' do not correspond to a registered process'));
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* process_webEntryValidate
|
* process_webEntryValidate
|
||||||
* validates if the username and password are valid data and if the user assigned
|
* validates if the username and password are valid data and if the user assigned
|
||||||
@@ -261,7 +281,7 @@ class ProjectUser
|
|||||||
$oCriteria->add( \UsersPeer::USR_USERNAME, $sWS_USER );
|
$oCriteria->add( \UsersPeer::USR_USERNAME, $sWS_USER );
|
||||||
$userIsAssigned = \GroupUserPeer::doCount( $oCriteria );
|
$userIsAssigned = \GroupUserPeer::doCount( $oCriteria );
|
||||||
if (! ($userIsAssigned >= 1)) {
|
if (! ($userIsAssigned >= 1)) {
|
||||||
throw (new \Exception( "The User `" . $sWS_USER . "` doesn't have the activity `" . $sTASKS . "` assigned"));
|
throw (new \Exception( "The `usr_uid` `" . $sWS_USER . "` doesn't have the activity `tas_uid` `" . $sTASKS . "` assigned"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$oDataset = \TaskUserPeer::doSelectRS($oCriteria);
|
$oDataset = \TaskUserPeer::doSelectRS($oCriteria);
|
||||||
|
|||||||
504
workflow/engine/src/BusinessModel/User.php
Normal file
504
workflow/engine/src/BusinessModel/User.php
Normal file
@@ -0,0 +1,504 @@
|
|||||||
|
<?php
|
||||||
|
namespace BusinessModel;
|
||||||
|
|
||||||
|
class User
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Set exception messages for parameters
|
||||||
|
*
|
||||||
|
* @param array $arrayData Data with the params
|
||||||
|
*
|
||||||
|
* return void
|
||||||
|
*/
|
||||||
|
public function setArrayMsgExceptionParam($arrayData)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$this->arrayMsgExceptionParam = $arrayData;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the name of the field according to the format
|
||||||
|
*
|
||||||
|
* @param string $fieldName Field name
|
||||||
|
*
|
||||||
|
* return string Return the field name according the format
|
||||||
|
*/
|
||||||
|
public function getFieldNameByFormatFieldName($fieldName)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return ($this->formatFieldNameInUppercase)? strtoupper($fieldName) : strtolower($fieldName);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify if exists the title of a Group
|
||||||
|
*
|
||||||
|
* @param string $title Title
|
||||||
|
* @param string $groupUidExclude Unique id of Group to exclude
|
||||||
|
*
|
||||||
|
* return bool Return true if exists the title of a Group, false otherwise
|
||||||
|
*/
|
||||||
|
public function existsTitle($groupTitle, $groupUidExclude = "")
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$delimiter = \DBAdapter::getStringDelimiter();
|
||||||
|
|
||||||
|
$criteria = new \Criteria("workflow");
|
||||||
|
|
||||||
|
$criteria->addSelectColumn(\GroupwfPeer::GRP_UID);
|
||||||
|
|
||||||
|
$criteria->addAlias("CT", \ContentPeer::TABLE_NAME);
|
||||||
|
|
||||||
|
$arrayCondition = array();
|
||||||
|
$arrayCondition[] = array(\GroupwfPeer::GRP_UID, "CT.CON_ID", \Criteria::EQUAL);
|
||||||
|
$arrayCondition[] = array("CT.CON_CATEGORY", $delimiter . "GRP_TITLE" . $delimiter, \Criteria::EQUAL);
|
||||||
|
$arrayCondition[] = array("CT.CON_LANG", $delimiter . SYS_LANG . $delimiter, \Criteria::EQUAL);
|
||||||
|
$criteria->addJoinMC($arrayCondition, \Criteria::LEFT_JOIN);
|
||||||
|
|
||||||
|
if ($groupUidExclude != "") {
|
||||||
|
$criteria->add(\GroupwfPeer::GRP_UID, $groupUidExclude, \Criteria::NOT_EQUAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
$criteria->add("CT.CON_VALUE", $groupTitle, \Criteria::EQUAL);
|
||||||
|
|
||||||
|
$rsCriteria = \GroupwfPeer::doSelectRS($criteria);
|
||||||
|
$rsCriteria->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
|
||||||
|
if ($rsCriteria->next()) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify if status has invalid value
|
||||||
|
*
|
||||||
|
* @param string $groupStatus Status
|
||||||
|
*
|
||||||
|
* return void Throw exception if status has invalid value
|
||||||
|
*/
|
||||||
|
public function throwExceptionIfHaveInvalidValueInStatus($groupStatus)
|
||||||
|
{
|
||||||
|
if (!in_array($groupStatus, array("ACTIVE", "INACTIVE"))) {
|
||||||
|
$field = $this->getFieldNameByFormatFieldName("GRP_STATUS");
|
||||||
|
|
||||||
|
throw (new \Exception(str_replace(array("{0}"), array($field), "Invalid value specified for \"{0}\"")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Verify if exists the title of a Group
|
||||||
|
*
|
||||||
|
* @param string $title Title
|
||||||
|
* @param string $groupUidExclude Unique id of Group to exclude
|
||||||
|
*
|
||||||
|
* return void Throw exception if exists the title of a Group
|
||||||
|
*/
|
||||||
|
public function throwExceptionIfExistsTitle($groupTitle, $groupUidExclude = "")
|
||||||
|
{
|
||||||
|
if ($this->existsTitle($groupTitle, $groupUidExclude)) {
|
||||||
|
$field = $this->getFieldNameByFormatFieldName("GRP_TITLE");
|
||||||
|
|
||||||
|
$msg = str_replace(array("{0}"), array($field), "Invalid value specified for \"{0}\"") . " / ";
|
||||||
|
$msg = $msg . \G::LoadTranslation("ID_MSG_GROUP_NAME_EXISTS");
|
||||||
|
|
||||||
|
throw (new \Exception($msg));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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
|
||||||
|
if (!isset($arrayData["GRP_TITLE"])) {
|
||||||
|
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("GRP_TITLE")), "The \"{0}\" attribute is not defined")));
|
||||||
|
}
|
||||||
|
|
||||||
|
$arrayData["GRP_TITLE"] = trim($arrayData["GRP_TITLE"]);
|
||||||
|
|
||||||
|
if ($arrayData["GRP_TITLE"] == "") {
|
||||||
|
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("GRP_TITLE")), "The \"{0}\" attribute is empty")));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isset($arrayData["GRP_STATUS"])) {
|
||||||
|
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("GRP_STATUS")), "The \"{0}\" attribute is not defined")));
|
||||||
|
}
|
||||||
|
|
||||||
|
$arrayData["GRP_STATUS"] = trim($arrayData["GRP_STATUS"]);
|
||||||
|
|
||||||
|
if ($arrayData["GRP_STATUS"] == "") {
|
||||||
|
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("GRP_STATUS")), "The \"{0}\" attribute is empty")));
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->throwExceptionIfHaveInvalidValueInStatus($arrayData["GRP_STATUS"]);
|
||||||
|
|
||||||
|
$this->throwExceptionIfExistsTitle($arrayData["GRP_TITLE"]);
|
||||||
|
|
||||||
|
//Create
|
||||||
|
$group = new \Groupwf();
|
||||||
|
|
||||||
|
$groupUid = $group->create($arrayData);
|
||||||
|
|
||||||
|
//Return
|
||||||
|
$arrayData = array_merge(array("GRP_UID" => $groupUid), $arrayData);
|
||||||
|
|
||||||
|
if (!$this->formatFieldNameInUppercase) {
|
||||||
|
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arrayData;
|
||||||
|
} 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
|
||||||
|
$this->throwExceptionIfNoExistsGroup($groupUid);
|
||||||
|
|
||||||
|
if (isset($arrayData["GRP_TITLE"])) {
|
||||||
|
$arrayData["GRP_TITLE"] = trim($arrayData["GRP_TITLE"]);
|
||||||
|
|
||||||
|
if ($arrayData["GRP_TITLE"] == "") {
|
||||||
|
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("GRP_TITLE")), "The \"{0}\" attribute is empty")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($arrayData["GRP_STATUS"])) {
|
||||||
|
$arrayData["GRP_STATUS"] = trim($arrayData["GRP_STATUS"]);
|
||||||
|
|
||||||
|
if ($arrayData["GRP_STATUS"] == "") {
|
||||||
|
throw (new \Exception(str_replace(array("{0}"), array($this->getFieldNameByFormatFieldName("GRP_STATUS")), "The \"{0}\" attribute is empty")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($arrayData["GRP_STATUS"])) {
|
||||||
|
$this->throwExceptionIfHaveInvalidValueInStatus($arrayData["GRP_STATUS"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($arrayData["GRP_TITLE"])) {
|
||||||
|
$this->throwExceptionIfExistsTitle($arrayData["GRP_TITLE"], $groupUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Update
|
||||||
|
$group = new \Groupwf();
|
||||||
|
|
||||||
|
$arrayData["GRP_UID"] = $groupUid;
|
||||||
|
|
||||||
|
$result = $group->update($arrayData);
|
||||||
|
|
||||||
|
//Return
|
||||||
|
unset($arrayData["GRP_UID"]);
|
||||||
|
|
||||||
|
if (!$this->formatFieldNameInUppercase) {
|
||||||
|
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $arrayData;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete Group
|
||||||
|
*
|
||||||
|
* @param string $groupUid Unique id of Group
|
||||||
|
*
|
||||||
|
* return void
|
||||||
|
*/
|
||||||
|
public function delete($groupUid)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
//Verify data
|
||||||
|
$this->throwExceptionIfNoExistsGroup($groupUid);
|
||||||
|
|
||||||
|
//Delete
|
||||||
|
$group = new \Groupwf();
|
||||||
|
|
||||||
|
$group->remove($groupUid);
|
||||||
|
|
||||||
|
//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);
|
||||||
|
$criteria->addSelectColumn(\GroupwfPeer::GRP_STATUS);
|
||||||
|
$criteria->addSelectColumn(\GroupwfPeer::GRP_LDAP_DN);
|
||||||
|
$criteria->addSelectColumn(\GroupwfPeer::GRP_UX);
|
||||||
|
$criteria->addAsColumn("GRP_TITLE", \ContentPeer::CON_VALUE);
|
||||||
|
$criteria->addJoin(\GroupwfPeer::GRP_UID, \ContentPeer::CON_ID, \Criteria::LEFT_JOIN);
|
||||||
|
$criteria->add(\ContentPeer::CON_CATEGORY, "GRP_TITLE", \Criteria::EQUAL);
|
||||||
|
$criteria->add(\ContentPeer::CON_LANG, SYS_LANG, \Criteria::EQUAL);
|
||||||
|
|
||||||
|
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 != "") {
|
||||||
|
$this->throwExceptionIfNoExistsGroup($groupUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Get data
|
||||||
|
$criteria = new \Criteria("workflow");
|
||||||
|
|
||||||
|
$criteria->addSelectColumn(\GroupUserPeer::GRP_UID);
|
||||||
|
$criteria->addSelectColumn("COUNT(" . \GroupUserPeer::GRP_UID . ") AS NUM_REC");
|
||||||
|
$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();
|
||||||
|
|
||||||
|
$arrayData[$row["GRP_UID"]] = $row["NUM_REC"];
|
||||||
|
}
|
||||||
|
|
||||||
|
//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 != "") {
|
||||||
|
$this->throwExceptionIfNoExistsGroup($groupUid);
|
||||||
|
}
|
||||||
|
|
||||||
|
//Get data
|
||||||
|
$criteria = new \Criteria("workflow");
|
||||||
|
|
||||||
|
$criteria->addAsColumn("GRP_UID", \TaskUserPeer::USR_UID);
|
||||||
|
$criteria->addSelectColumn("COUNT(" . \TaskUserPeer::USR_UID . ") AS NUM_REC");
|
||||||
|
|
||||||
|
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();
|
||||||
|
|
||||||
|
$arrayData[$row["GRP_UID"]] = $row["NUM_REC"];
|
||||||
|
}
|
||||||
|
|
||||||
|
//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(
|
||||||
|
$this->getFieldNameByFormatFieldName("GRP_UID") => $record["GRP_UID"],
|
||||||
|
$this->getFieldNameByFormatFieldName("GRP_TITLE") => $record["GRP_TITLE"],
|
||||||
|
$this->getFieldNameByFormatFieldName("GRP_STATUS") => $record["GRP_STATUS"],
|
||||||
|
$this->getFieldNameByFormatFieldName("GRP_USERS") => (int)($record["GRP_USERS"]),
|
||||||
|
$this->getFieldNameByFormatFieldName("GRP_TASKS") => (int)($record["GRP_TASKS"])
|
||||||
|
);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get all Users
|
||||||
|
*
|
||||||
|
* @param string $filter
|
||||||
|
* @param int $start
|
||||||
|
* @param int $limit
|
||||||
|
*
|
||||||
|
* return array Return an array with all Users
|
||||||
|
*/
|
||||||
|
public function getUsers($filter, $start, $limit)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Users.php");
|
||||||
|
$oCriteria = new \Criteria();
|
||||||
|
if ($filter != '') {
|
||||||
|
$oCriteria->add( $oCriteria->getNewCriterion( \UsersPeer::USR_USERNAME, "%$filter%", \Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( \UsersPeer::USR_FIRSTNAME, "%$filter%", \Criteria::LIKE ) )->addOr( $oCriteria->getNewCriterion( \UsersPeer::USR_LASTNAME, "%$filter%", \Criteria::LIKE ) ) );
|
||||||
|
}
|
||||||
|
if ($start) {
|
||||||
|
if ($start < 0) {
|
||||||
|
throw (new \Exception( 'invalid value specified for `start`.'));
|
||||||
|
} else {
|
||||||
|
$oCriteria->setOffset( $start );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isset($limit)) {
|
||||||
|
if ($limit < 0) {
|
||||||
|
throw (new \Exception( 'invalid value specified for `limit`.'));
|
||||||
|
} else {
|
||||||
|
if ($limit == 0) {
|
||||||
|
return $aUsers;
|
||||||
|
} else {
|
||||||
|
$oCriteria->setLimit( $limit );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$oDataset = \UsersPeer::doSelectRS($oCriteria);
|
||||||
|
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
while ($oDataset->next()) {
|
||||||
|
$aRow1 = $oDataset->getRow();
|
||||||
|
$aRow1 = array_change_key_case($aRow1, CASE_LOWER);
|
||||||
|
$aUserInfo[] = $aRow1;
|
||||||
|
}
|
||||||
|
//Return
|
||||||
|
return $aUserInfo;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get data of a User
|
||||||
|
*
|
||||||
|
* @param string $userUid Unique id of Group
|
||||||
|
*
|
||||||
|
* return array Return an array with data of a User
|
||||||
|
*/
|
||||||
|
public function getUser($userUid)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$oUser = \UsersPeer::retrieveByPK($userUid);
|
||||||
|
if (is_null($oUser)) {
|
||||||
|
throw (new \Exception( 'This id for `usr_uid`: '. $userUid .' do not correspond to a registered user'));
|
||||||
|
}
|
||||||
|
require_once (PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "Users.php");
|
||||||
|
$oCriteria = new \Criteria();
|
||||||
|
if ($filter != '') {
|
||||||
|
$oCriteria->add( $oCriteria->getNewCriterion( \UsersPeer::USR_USERNAME, "%$filter%", \Criteria::LIKE )->addOr( $oCriteria->getNewCriterion( \UsersPeer::USR_FIRSTNAME, "%$filter%", \Criteria::LIKE ) )->addOr( $oCriteria->getNewCriterion( \UsersPeer::USR_LASTNAME, "%$filter%", \Criteria::LIKE ) ) );
|
||||||
|
}
|
||||||
|
$oCriteria->add(\UsersPeer::USR_UID, $userUid);
|
||||||
|
$oDataset = \UsersPeer::doSelectRS($oCriteria);
|
||||||
|
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
|
||||||
|
while ($oDataset->next()) {
|
||||||
|
$aRow1 = $oDataset->getRow();
|
||||||
|
$aRow1 = array_change_key_case($aRow1, CASE_LOWER);
|
||||||
|
$aUserInfo = $aRow1;
|
||||||
|
}
|
||||||
|
//Return
|
||||||
|
return $aUserInfo;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ class FilesManager extends Api
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $prjUid {@min 32} {@max 32}
|
* @param string $prjUid {@min 32} {@max 32}
|
||||||
* @param string $path {@choice templates,folder,}
|
* @param string $path
|
||||||
*
|
*
|
||||||
* @url GET /:prjUid/process-file-manager
|
* @url GET /:prjUid/process-file-manager
|
||||||
*/
|
*/
|
||||||
@@ -42,7 +42,7 @@ class FilesManager extends Api
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $prjUid {@min 32} {@max 32}
|
* @param string $prjUid {@min 32} {@max 32}
|
||||||
* @param string $path {@choice templates,folder,}
|
* @param string $path
|
||||||
*
|
*
|
||||||
* @url GET /:prjUid/process-file-manager-download
|
* @url GET /:prjUid/process-file-manager-download
|
||||||
*/
|
*/
|
||||||
@@ -105,17 +105,18 @@ class FilesManager extends Api
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $prjUid {@min 32} {@max 32}
|
* @param string $prjUid {@min 32} {@max 32}
|
||||||
* @param ProcessFilesManagerStructure $request_data
|
* @param string $path
|
||||||
|
* @param ProcessFilesManagerStructure1 $request_data
|
||||||
*
|
*
|
||||||
* @url PUT /:prjUid/process-file-manager-upload
|
* @url PUT /:prjUid/process-file-manager1
|
||||||
*/
|
*/
|
||||||
public function doPutProcessFilesManagerUpload($prjUid, ProcessFilesManagerStructure $request_data)
|
public function doPutProcessFilesManager($prjUid, ProcessFilesManagerStructure1 $request_data, $path)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$userUid = $this->getUserId();
|
$userUid = $this->getUserId();
|
||||||
$request_data = (array)($request_data);
|
$request_data = (array)($request_data);
|
||||||
$filesManager = new \BusinessModel\FilesManager();
|
$filesManager = new \BusinessModel\FilesManager();
|
||||||
$arrayData = $filesManager->updateProcessFilesManager($prjUid, $userUid, $request_data);
|
$arrayData = $filesManager->updateProcessFilesManager($prjUid, $userUid, $request_data, $path);
|
||||||
//Response
|
//Response
|
||||||
$response = $arrayData;
|
$response = $arrayData;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -126,14 +127,15 @@ class FilesManager extends Api
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @param string $prjUid {@min 32} {@max 32}
|
* @param string $prjUid {@min 32} {@max 32}
|
||||||
|
* @param string $path
|
||||||
*
|
*
|
||||||
* @url DELETE /:prjUid/process-file-manager-delete
|
* @url DELETE /:prjUid/process-file-manager
|
||||||
*/
|
*/
|
||||||
public function doDeleteProcessFilesManager($prjUid)
|
public function doDeleteProcessFilesManager($prjUid, $path)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$filesManager = new \BusinessModel\FilesManager();
|
$filesManager = new \BusinessModel\FilesManager();
|
||||||
$arrayData = $filesManager->deleteProcessFilesManager($prjUid);
|
$arrayData = $filesManager->deleteProcessFilesManager($prjUid, $path);
|
||||||
//Response
|
//Response
|
||||||
$response = $arrayData;
|
$response = $arrayData;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -161,3 +163,16 @@ class ProcessFilesManagerStructure
|
|||||||
*/
|
*/
|
||||||
public $content;
|
public $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class ProcessFilesManagerStructure1
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var string {@from body}
|
||||||
|
*/
|
||||||
|
public $file_name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string {@from body}
|
||||||
|
*/
|
||||||
|
public $content;
|
||||||
|
}
|
||||||
@@ -12,15 +12,15 @@ use \Luracast\Restler\RestException;
|
|||||||
class ProjectUsers extends Api
|
class ProjectUsers extends Api
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @param string $prjUid {@min 32} {@max 32}
|
* @param string $prj_uid {@min 32} {@max 32}
|
||||||
*
|
*
|
||||||
* @url GET /:prjUid/users
|
* @url GET /:prj_uid/users
|
||||||
*/
|
*/
|
||||||
public function doGetProjectUsers($prjUid)
|
public function doGetProjectUsers($prj_uid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$users = new \BusinessModel\ProjectUser();
|
$users = new \BusinessModel\ProjectUser();
|
||||||
$arrayData = $users->getProjectUsers($prjUid);
|
$arrayData = $users->getProjectUsers($prj_uid);
|
||||||
//Response
|
//Response
|
||||||
$response = $arrayData;
|
$response = $arrayData;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
@@ -51,15 +51,15 @@ class ProjectUsers extends Api
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $prjUid {@min 32} {@max 32}
|
* @param string $prjUid {@min 32} {@max 32}
|
||||||
* @param string $usrUid {@min 32} {@max 32}
|
* @param string $usr_uid {@min 32} {@max 32}
|
||||||
*
|
*
|
||||||
* @url GET /:prjUid/user/:usrUid/starting-tasks
|
* @url GET /:prjUid/user/:usr_uid/starting-tasks
|
||||||
*/
|
*/
|
||||||
public function doGetProjectStartingTaskUsers($prjUid, $usrUid)
|
public function doGetProjectStartingTaskUsers($prjUid, $usr_uid)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$startingTasks = new \BusinessModel\ProjectUser();
|
$startingTasks = new \BusinessModel\ProjectUser();
|
||||||
$arrayData = $startingTasks->getProjectStartingTaskUsers($prjUid, $usrUid);
|
$arrayData = $startingTasks->getProjectStartingTaskUsers($prjUid, $usr_uid);
|
||||||
//Response
|
//Response
|
||||||
$response = $arrayData;
|
$response = $arrayData;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|||||||
113
workflow/engine/src/Services/Api/ProcessMaker/User.php
Normal file
113
workflow/engine/src/Services/Api/ProcessMaker/User.php
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
<?php
|
||||||
|
namespace Services\Api\ProcessMaker;
|
||||||
|
|
||||||
|
use \ProcessMaker\Services\Api;
|
||||||
|
use \Luracast\Restler\RestException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User Api Controller
|
||||||
|
*
|
||||||
|
* @protected
|
||||||
|
*/
|
||||||
|
class User extends Api
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @url GET
|
||||||
|
*/
|
||||||
|
public function index($filter = '', $start = null, $limit = null)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$user = new \BusinessModel\User();
|
||||||
|
$response = $user->getUsers($filter, null, null, $start, $limit);
|
||||||
|
return $response;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @url GET /:usr_uid
|
||||||
|
*
|
||||||
|
* @param string $usr_uid {@min 32}{@max 32}
|
||||||
|
*/
|
||||||
|
public function doGet($usr_uid)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$user = new \BusinessModel\User();
|
||||||
|
$response = $user->getUser($usr_uid);
|
||||||
|
return $response;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @url POST
|
||||||
|
*
|
||||||
|
* @param array $request_data
|
||||||
|
* @param string $grp_title {@from body}{@required true}
|
||||||
|
* @param string $grp_status {@from body}{@choice ACTIVE,INACTIVE}{@required true}
|
||||||
|
*
|
||||||
|
* @status 201
|
||||||
|
*/
|
||||||
|
public function doPost(
|
||||||
|
$request_data,
|
||||||
|
$grp_title = "",
|
||||||
|
$grp_status = "ACTIVE"
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
$group = new \BusinessModel\Group();
|
||||||
|
$group->setFormatFieldNameInUppercase(false);
|
||||||
|
|
||||||
|
$arrayData = $group->create($request_data);
|
||||||
|
|
||||||
|
$response = $arrayData;
|
||||||
|
|
||||||
|
return $response;
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @url PUT /:grp_uid
|
||||||
|
*
|
||||||
|
* @param string $grp_uid {@min 32}{@max 32}
|
||||||
|
* @param array $request_data
|
||||||
|
* @param string $grp_title {@from body}
|
||||||
|
* @param string $grp_status {@from body}{@choice ACTIVE,INACTIVE}
|
||||||
|
*/
|
||||||
|
public function doPut(
|
||||||
|
$grp_uid,
|
||||||
|
$request_data,
|
||||||
|
$grp_title = "",
|
||||||
|
$grp_status = "ACTIVE"
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
$group = new \BusinessModel\Group();
|
||||||
|
$group->setFormatFieldNameInUppercase(false);
|
||||||
|
|
||||||
|
$arrayData = $group->update($grp_uid, $request_data);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @url DELETE /:grp_uid
|
||||||
|
*
|
||||||
|
* @param string $grp_uid {@min 32}{@max 32}
|
||||||
|
*/
|
||||||
|
public function doDelete($grp_uid)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$group = new \BusinessModel\Group();
|
||||||
|
$group->setFormatFieldNameInUppercase(false);
|
||||||
|
|
||||||
|
$group->delete($grp_uid);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -42,3 +42,8 @@ debug = 1
|
|||||||
[alias: groups]
|
[alias: groups]
|
||||||
group = "Services\Api\ProcessMaker\Group"
|
group = "Services\Api\ProcessMaker\Group"
|
||||||
|
|
||||||
|
[alias: user]
|
||||||
|
user = "Services\Api\ProcessMaker\User"
|
||||||
|
|
||||||
|
[alias: users]
|
||||||
|
user = "Services\Api\ProcessMaker\User"
|
||||||
|
|||||||
Reference in New Issue
Block a user