Merged in release/3.3 (pull request #6486)

Release/3.3

Approved-by: Paula Quispe <paula.quispe@processmaker.com>
This commit is contained in:
Paula Quispe
2018-05-28 13:58:39 +00:00
41 changed files with 4158 additions and 2504 deletions

View File

@@ -0,0 +1,485 @@
<?php
namespace ProcessMaker\AuditLog;
use Bootstrap;
use Configurations;
use Exception;
use G;
use ProcessMaker\Core\System;
use Symfony\Component\Finder\Finder;
class AuditLog
{
private $actions = [];
private $columns;
private $pageSizeDefault = 20;
private $pathGlobalLog;
private $userFullname = "";
private $userLogged = "";
/**
* Class constructor.
*/
function __construct()
{
$this->pathGlobalLog = PATH_DATA . 'log';
$this->columns = ['date', 'workspace', 'ip', 'id', 'user', 'action', 'description'];
$this->actions = [
"CreateUser" => G::LoadTranslation("ID_CREATE_USER"),
"UpdateUser" => G::LoadTranslation("ID_UPDATE_USER"),
"DeleteUser" => G::LoadTranslation("ID_DELETE_USER"),
"EnableUser" => G::LoadTranslation("ID_ENABLE_USER"),
"DisableUser" => G::LoadTranslation("ID_DISABLE_USER"),
"AssignAuthenticationSource" => G::LoadTranslation("ID_ASSIGN_AUTHENTICATION_SOURCE"),
"AssignUserToGroup" => G::LoadTranslation("ID_ASSIGN_USER_TO_GROUP"),
"CreateAuthSource" => G::LoadTranslation("ID_CREATE_AUTH_SOURCE"),
"UpdateAuthSource" => G::LoadTranslation("ID_UPDATE_AUTH_SOURCE"),
"DeleteAuthSource" => G::LoadTranslation("ID_DELETE_AUTH_SOURCE"),
"CreateRole" => G::LoadTranslation("ID_CREATE_ROLE"),
"UpdateRole" => G::LoadTranslation("ID_UPDATE_ROLE"),
"DeleteRole" => G::LoadTranslation("ID_DELETE_ROLE"),
"AssignUserToRole" => G::LoadTranslation("ID_ASSIGN_USER_TO_ROLE"),
"DeleteUserToRole" => G::LoadTranslation("ID_DELETE_USER_TO_ROLE"),
"AddPermissionToRole" => G::LoadTranslation("ID_ADD_PERMISSION_TO_ROLE"),
"DeletePermissionToRole" => G::LoadTranslation("ID_DELETE_PERMISSION_TO_ROLE"),
"CreateSkin" => G::LoadTranslation("ID_CREATE_SKIN"),
"ImportSkin" => G::LoadTranslation("ID_IMPORT_SKIN"),
"ExportSkin" => G::LoadTranslation("ID_EXPORT_SKIN"),
"DeleteSkin" => G::LoadTranslation("ID_DELETE_SKIN"),
"CreateGroup" => G::LoadTranslation("ID_CREATE_GROUP"),
"UpdateGroup" => G::LoadTranslation("ID_UPDATE_GROUP"),
"DeleteGroup" => G::LoadTranslation("ID_DELETE_GROUP"),
"CreateCategory" => G::LoadTranslation("ID_CREATE_CATEGORY"),
"UpdateCategory" => G::LoadTranslation("ID_UPDATE_CATEGORY"),
"DeleteCategory" => G::LoadTranslation("ID_DELETE_CATEGORY"),
"BuildCache" => G::LoadTranslation("ID_BUILD_CACHE"),
"ClearCache" => G::LoadTranslation("ID_CLEAR_CACHE"),
"ClearCron" => G::LoadTranslation("ID_CLEAR_CRON"),
"UpdateEnvironmentSettings" => G::LoadTranslation("ID_UPDATE_ENVIRONMENT_SETTINGS"),
"UpdateLoginSettings" => G::LoadTranslation("ID_UPDATE_LOGIN_SETTINGS"),
"EnableHeartBeat" => G::LoadTranslation("ID_ENABLE_HEART_BEAT"),
"DisableHeartBeat" => G::LoadTranslation("ID_DISABLE_HEART_BEAT"),
"CreatePmtable" => G::LoadTranslation("ID_CREATE_PMTABLE"),
"UpdatePmtable" => G::LoadTranslation("ID_UPDATE_PMTABLE"),
"DeletePmtable" => G::LoadTranslation("ID_DELETE_PMTABLE"),
"AddDataPmtable" => G::LoadTranslation("ID_ADD_DATA_PMTABLE"),
"UpdateDataPmtable" => G::LoadTranslation("ID_UPDATE_DATA_PMTABLE"),
"DeleteDataPmtable" => G::LoadTranslation("ID_DELETE_DATA_PMTABLE"),
"ImportTable" => G::LoadTranslation("ID_IMPORT_TABLE"),
"ExportTable" => G::LoadTranslation("ID_EXPORT_TABLE"),
"CreateCalendar" => G::LoadTranslation("ID_CREATE_CALENDAR"),
"UpdateCalendar" => G::LoadTranslation("ID_UPDATE_CALENDAR"),
"DeleteCalendar" => G::LoadTranslation("ID_DELETE_CALENDAR"),
"CreateDashletInstance" => G::LoadTranslation("ID_CREATE_DASHLET_INSTANCE"),
"UpdateDashletInstance" => G::LoadTranslation("ID_UPDATE_DASHLET_INSTANCE"),
"DeleteDashletInstance" => G::LoadTranslation("ID_DELETE_DASHLET_INSTANCE"),
"CreateDepartament" => G::LoadTranslation("ID_CREATE_DEPARTAMENT"),
"CreateSubDepartament" => G::LoadTranslation("ID_CREATE_SUB_DEPARTAMENT"),
"UpdateDepartament" => G::LoadTranslation("ID_UPDATE_DEPARTAMENT"),
"UpdateSubDepartament" => G::LoadTranslation("ID_UPDATE_SUB_DEPARTAMENT"),
"DeleteDepartament" => G::LoadTranslation("ID_DELETE_DEPARTAMENT"),
"AssignManagerToDepartament" => G::LoadTranslation("ID_ASSIGN_MANAGER_TO_DEPARTAMENT"),
"AssignUserToDepartament" => G::LoadTranslation("ID_ASSIGN_USER_TO_DEPARTAMENT"),
"RemoveUsersFromDepartament" => G::LoadTranslation("ID_REMOVE_USERS_FROM_DEPARTAMENT"),
"AssignUserToGroup" => G::LoadTranslation("ID_ASSIGN_USER_TO_GROUP"),
"UploadLanguage" => G::LoadTranslation("ID_UPLOAD_LANGUAGE"),
"ExportLanguage" => G::LoadTranslation("ID_EXPORT_LANGUAGE"),
"DeleteLanguage" => G::LoadTranslation("ID_DELETE_LAGUAGE"),
"UploadSystemSettings" => G::LoadTranslation("ID_UPLOAD_SYSTEM_SETTINGS"),
"UpdateEmailSettings" => G::LoadTranslation("ID_UPDATE_EMAIL_SETTINGS"),
"CreateEmailSettings" => G::LoadTranslation("ID_CREATE_EMAIL_SETTINGS"),
"UploadLogo" => G::LoadTranslation("ID_UPLOAD_LOGO"),
"DeleteLogo" => G::LoadTranslation("ID_DELETE_LOGO"),
"RestoreLogo" => G::LoadTranslation("ID_RESTORE_LOGO"),
"ReplaceLogo" => G::LoadTranslation("ID_REPLACE_LOGO"),
"InstallPlugin" => G::LoadTranslation("ID_INSTALL_PLUGIN"),
"EnablePlugin" => G::LoadTranslation("ID_ENABLE_PLUGIN"),
"DisablePlugin" => G::LoadTranslation("ID_DISABLE_PLUGIN"),
"RemovePlugin" => G::LoadTranslation("ID_REMOVE_PLUGIN"),
"SetColumns" => G::LoadTranslation("ID_SET_COLUMNS"),
"EnableAuditLog" => G::LoadTranslation("ID_ENABLE_AUDIT_LOG"),
"DisableAuditLog" => G::LoadTranslation("ID_DISABLE_AUDIT_LOG"),
"EditProcess" => G::LoadTranslation("ID_EDIT_PROCESS"),
"ExportProcess" => G::LoadTranslation("ID_EXPORT_PROCESS"),
"WebEntry" => G::LoadTranslation("ID_WEB_ENTRY"),
"AssignRole" => G::LoadTranslation("ID_ASSIGN_ROLE"),
"RemoveUser" => G::LoadTranslation("ID_REMOVE_USER"),
"AddTask" => G::LoadTranslation("ID_ADD_TASK"),
"AddSubProcess" => G::LoadTranslation("ID_ADD_SUB_PROCESS"),
"SaveTaskPosition" => G::LoadTranslation("ID_SAVE_TASK_POSITION"),
"AddHorizontalLine" => G::LoadTranslation("ID_ADD_HORIZONTAL_LINE"),
"AddVerticalLine" => G::LoadTranslation("ID_ADD_VERTICAL_LINE"),
"SaveGuidePosition" => G::LoadTranslation("ID_SAVE_GUIDE_POSITION"),
"DeleteLine" => G::LoadTranslation("ID_DELETE_LINE"),
"DeleteLines" => G::LoadTranslation("ID_DELETE_LINES"),
"AddText" => G::LoadTranslation("ID_ADD_TEXT"),
"UpdateText" => G::LoadTranslation("ID_UPDATE_TEXT"),
"SaveTextPosition" => G::LoadTranslation("ID_SAVE_TEXT_POSITION"),
"DeleteText" => G::LoadTranslation("ID_DELETE_TEXT"),
"ProcessFileManager" => G::LoadTranslation("ID_PROCESS_FILE_MANAGER"),
"ProcessPermissions" => G::LoadTranslation("ID_PROCESS_PERMISSIONS"),
"DeletePermissions" => G::LoadTranslation("ID_DELETE_PERMISSIONS"),
"AssignSupervisorDynaform" => G::LoadTranslation("ID_ASSIGN_SUPERVISOR_DYNAFORM"),
"RemoveSupervisorDynaform" => G::LoadTranslation("ID_REMOVE_SUPERVISOR_DYNAFORM"),
"AssignSupervisorInput" => G::LoadTranslation("ID_ASSIGN_SUPERVISOR_INPUT"),
"RemoveSupervisorInput" => G::LoadTranslation("ID_REMOVE_SUPERVISOR_INPUT"),
"CaseTrackers" => G::LoadTranslation("ID_CASE_TRACKERS"),
"EditEvent" => G::LoadTranslation("ID_EDIT_EVENT"),
"DeleteEvent" => G::LoadTranslation("ID_EVENT_DELETED"),
"CreateDynaform" => G::LoadTranslation("ID_CREATE_DYNAFORM"),
"UpdateDynaform" => G::LoadTranslation("ID_UPDATE_DYNAFORM"),
"DeleteDynaform" => G::LoadTranslation("ID_DELETE_DYNAFORM"),
"ConditionsEditorDynaform" => G::LoadTranslation("ID_CONDITIONS_EDITOR_DYNAFORM"),
"CreateCaseScheduler" => G::LoadTranslation("ID_CREATE_CASE_SCHEDULER"),
"UpdateCaseScheduler" => G::LoadTranslation("ID_UPDATE_CASE_SCHEDULER"),
"DeleteCaseScheduler" => G::LoadTranslation("ID_DELETE_CASE_SCHEDULER"),
"CreateDatabaseConnection" => G::LoadTranslation("ID_CREATE_DATABASE_CONNECTION"),
"UpdateDatabaseConnection" => G::LoadTranslation("ID_UPDATE_DATABASE_CONNECTION"),
"DeleteDatabaseConnection" => G::LoadTranslation("ID_DELETE_DATABASE_CONNECTION"),
"CreateInputDocument" => G::LoadTranslation("ID_CREATE_INPUT_DOCUMENT"),
"UpdateInputDocument" => G::LoadTranslation("ID_UPDATE_INPUT_DOCUMENT"),
"DeleteInputDocument" => G::LoadTranslation("ID_DELETE_INPUT_DOCUMENT"),
"CreateOutputDocument" => G::LoadTranslation("ID_CREATE_OUTPUT_DOCUMENT"),
"UpdateOutputDocument" => G::LoadTranslation("ID_UPDATE_OUTPUT_DOCUMENT"),
"DeleteOutputDocument" => G::LoadTranslation("ID_DELETE_OUTPUT_DOCUMENT"),
"CreateTrigger" => G::LoadTranslation("ID_CREATE_TRIGGER"),
"UpdateTrigger" => G::LoadTranslation("ID_UPDATE_TRIGGER"),
"DeleteTrigger" => G::LoadTranslation("ID_DELETE_TRIGGER"),
"DerivationRule" => G::LoadTranslation("ID_DERIVATION_RULE"),
"DeleteTask" => G::LoadTranslation("ID_DELETE_TASK"),
"DeleteSubProcess" => G::LoadTranslation("ID_DELETE_SUB_PROCESS"),
"OptionsMenuTask" => G::LoadTranslation("ID_OPTIONS_MENU_TASK"),
"SaveTaskProperties" => G::LoadTranslation("ID_SAVE_TASK_PROPERTIES"),
"DeleteRoutes" => G::LoadTranslation("ID_DELETE_ROUTES"),
"NewConditionFromStep" => G::LoadTranslation("ID_NEW_CONDITION_FROM_STEP"),
"AssignTrigger" => G::LoadTranslation("ID_ASSIGN_TRIGGER"),
"UpTrigger" => G::LoadTranslation("ID_UP_TRIGGER"),
"DownTrigger" => G::LoadTranslation("ID_DOWN_TRIGGER"),
"StepDelete" => G::LoadTranslation("ID_STEP_DELETE"),
"StepUp" => G::LoadTranslation("ID_STEP_UP"),
"StepDown" => G::LoadTranslation("ID_STEP_DOWN"),
"SaveNewStep" => G::LoadTranslation("ID_SAVE_NEW_STEP"),
"AssignUserTask" => G::LoadTranslation("ID_ASSIGN_USER_TASK"),
"AssignGroupTask" => G::LoadTranslation("ID_ASSIGN_GROUP_TASK"),
"DeleteUserTask" => G::LoadTranslation("ID_DELETE_USER_TASK"),
"DeleteGroupTask" => G::LoadTranslation("ID_DELETE_GROUP_TASK"),
"ImportProcess" => G::LoadTranslation("ID_IMPORT_PROCESS"),
"DeleteProcess" => G::LoadTranslation("ID_DELETE_PROCESS")
];
}
/**
* Set the identifier of the logged user.
*
* @param string $userLogged
*/
function setUserLogged($userLogged)
{
$this->userLogged = $userLogged;
}
/**
* Set the full name of the logged user.
*
* @param string $userFullname
*/
function setUserFullname($userFullname)
{
$this->userFullname = $userFullname;
}
/**
* Get the configuration for the Audit Log.
*
* @return array
*/
public function getConfig()
{
$configurations = new Configurations();
$configPage = $configurations->getConfiguration("auditLogList", "pageSize", null, $this->userLogged);
$config = [];
$config["pageSize"] = isset($configPage["pageSize"]) ? $configPage["pageSize"] : $this->pageSizeDefault;
return $config;
}
/**
* Get the actions for Audit Log.
*
* @return array
*/
public function getActions()
{
$actions = [];
$actions[] = ["ALL", G::LoadTranslation("ID_ALL")];
/**
* We arrange the arrangement to create an ordered list and that the option
* 'All' be found at the beginning.
*/
asort($this->actions);
foreach ($this->actions as $key => $value) {
$actions[] = [$key, $value];
}
return $actions;
}
/**
* Get the data of the files registered by Audit Log.
*
* @param array $filter
* @param int $limit
* @param int $start
* @return array
*/
public function getAuditLogData($filter, $limit, $start)
{
$result = [];
$count = 0;
$files = $this->getFiles($this->pathGlobalLog, 'audit*.log');
foreach ($files as $file) {
$lines = file($file->getPathname());
foreach ($lines as $line) {
if ($start <= $count && count($result) < $limit) {
$data = $this->lineToObject($line);
if ($this->validate($filter, $data)) {
$result[] = $this->lineToArray($data);
}
}
$count = $count + 1;
}
}
//from workspace
$system = System::getSystemConfiguration();
$path = PATH_DATA . 'sites' . PATH_SEP . config('system.workspace') . PATH_SEP . 'log' . PATH_SEP;
if (isset($system['logs_location']) && !empty($system['logs_location']) && is_dir($system['logs_location'])) {
$path = $system['logs_location'];
}
$files = $this->getFiles($path, 'audit*.log');
foreach ($files as $file) {
$lines = file($file->getPathname());
foreach ($lines as $line) {
if ($start <= $count && count($result) < $limit) {
/**
* processmaker/gulliver/system/class.monologProvider.php
* "<%level%> %datetime% %channel% %level_name%: %message% %context% %extra%\n"
*/
$data = $this->lineToObject($line, '/([A-Z][a-z][a-z]\s{1,2}\d{1,2}\s\d{2}[:]\d{2}[:]\d{2})\s([\w][\w\d\.@-]*)\s(.*)$/');
if ($this->validate($filter, $data)) {
$result[] = $this->lineToArray($data);
}
}
$count = $count + 1;
}
}
return [$count, $result];
}
/**
* Register an action for Audit Log.
*
* @param string $action
* @param string $value
*/
public function register($action, $value = '')
{
$context = Bootstrap::getDefaultContextLog();
$context['usrUid'] = $this->userLogged;
$context['usrName'] = $this->userFullname;
$context['action'] = $action;
$context['description'] = $value;
Bootstrap::registerMonolog($action, 200, $action, $context, $context['workspace'], 'audit.log');
}
/**
* Get the Audit Log files.
*
* @param string $path
* @param string $pattern
* @param string $dir
* @return array
*/
private function getFiles($path, $pattern = '', $dir = 'ASC')
{
$finder = new Finder();
$finder->files()
->in($path)
->name($pattern);
$files = iterator_to_array($finder->getIterator());
uasort($files, function ($a, $b) use ($dir) {
$name1 = $a->getFilename();
$name2 = $b->getFilename();
if ($dir === 'ASC') {
return strcmp($name1, $name2);
} else {
return strcmp($name2, $name1);
}
});
return $files;
}
/**
* Transforms a line of content from the file into an object.
*
* @param string $line
* @param string $pattern
* @return object
*/
private function lineToObject($line, $pattern = '|')
{
$result = [];
$data = [];
if ($pattern === '|') {
$data = explode("|", $line);
} else {
$data = $this->getDataFromJson($line, $pattern);
}
foreach ($this->columns as $index => $column) {
$result[$column] = isset($data[$index]) ? trim($data[$index]) : '';
}
return (object) $result;
}
/**
* Gets the Json data stored from a line of contents of Audit Log files.
*
* @param string $line
* @param string $pattern
* @return array
*/
private function getDataFromJson($line, $pattern)
{
/**
* $matches[0]: datetime
* $matches[1]: channel
* $matches[2]: level_name + message + context
*/
preg_match($pattern, $line, $matches);
array_shift($matches);
if (!isset($matches[2])) {
return [];
}
$data = $matches[2];
$position = strpos($data, ' {');
if ($position === false) {
return [];
}
$data = substr($data, $position);
$data = str_replace('} {', '}, {', $data);
$data = '[' . $data . ']';
try {
$data = G::json_decode($data);
} catch (Exception $e) {
return [];
}
$join = [];
foreach ($data as $value) {
$value = (array) $value;
$join = array_merge($join, $value);
}
$join = (object) $join;
return [
empty($join->timeZone) ? '' : $join->timeZone,
empty($join->workspace) ? '' : $join->workspace,
empty($join->ip) ? '' : $join->ip,
empty($join->usrUid) ? '' : $join->usrUid,
empty($join->usrName) ? '' : $join->usrName,
empty($join->action) ? '' : $join->action,
empty($join->description) ? '' : $join->description
];
}
/**
* Apply filters to an Audit Log record.
*
* @param array $filter
* @param object $data
* @return boolean
*/
private function validate($filter, $data)
{
$result = true;
$date = !empty($data->date) ? $this->mktimeDate($data->date) : 0;
if ($filter["workspace"] != $data->workspace) {
$result = false;
}
if ($filter["action"] != "ALL") {
if ($data->action != $filter["action"]) {
$result = false;
}
}
if ($filter["dateFrom"] && $date > 0) {
if (!($this->mktimeDate($filter["dateFrom"]) <= $date)) {
$result = false;
}
}
if ($filter["dateTo"] && $date > 0) {
if (!($date <= $this->mktimeDate($filter["dateTo"] . " 23:59:59"))) {
$result = false;
}
}
if ($filter["description"]) {
$result = false;
$string = $filter["description"];
if ((stristr($data->date, $string) !== false) ||
(stristr($data->ip, $string) !== false) ||
(stristr($data->user, $string) !== false) ||
(stristr($data->action, $string) !== false) ||
(stristr($data->description, $string) !== false)) {
$result = true;
}
}
return $result;
}
/**
* Get the timestamp of the date given.
*
* @param string $date
* @return int
*/
private function mktimeDate($date)
{
$array = getdate(strtotime($date));
$mktime = mktime($array["hours"], $array["minutes"], $array["seconds"], $array["mon"], $array["mday"], $array["year"]);
return $mktime;
}
/**
* Obtain the corresponding arrangement for the columns of the Audit Log user
* interface.
*
* @param array $data
* @return array
*/
private function lineToArray($data)
{
$action = $data->action;
$action = preg_replace('/([A-Z])/', '_$1', $data->action);
$action = "ID" . strtoupper($action);
$action = G::LoadTranslation($action);
return [
"DATE" => $data->date,
"USER" => $data->user,
"IP" => $data->ip,
"ACTION" => $action,
"DESCRIPTION" => $data->description
];
}
}

View File

@@ -3349,6 +3349,7 @@ class Cases
* @param array $rolesPermissions, the roles that we need to review
* @param array $objectPermissions, the permissions that we need to review
* @param boolean $objectSupervisor, if we need to get all the objects supervisor
* @param string $tasUid
* @return array
*/
public function userAuthorization(
@@ -3357,7 +3358,8 @@ class Cases
$appUid,
$rolesPermissions = [],
$objectPermissions = [],
$objectSupervisor = false
$objectSupervisor = false,
$tasUid = ''
) {
$arrayAccess = [];
@@ -3389,7 +3391,7 @@ class Cases
if (count($objectPermissions) > 0) {
$case = new ClassesCases();
foreach ($objectPermissions as $key => $value) {
$resPermission = $case->getAllObjectsFrom($proUid, $appUid, '', $usrUid, $value);
$resPermission = $case->getAllObjectsFrom($proUid, $appUid, $tasUid, $usrUid, $value);
if (isset($resPermission[$key])) {
$arrayAccess['objectPermissions'][$key] = $resPermission[$key];
}

View File

@@ -0,0 +1,59 @@
<?php
namespace ProcessMaker\BusinessModel\Files;
abstract class Files
{
/**
* @var string Path of the directory where the files are stored.
*/
protected $pathFiles;
/**
* Files constructor.
*
* @param $path
*/
public function __construct($path)
{
$this->pathFiles = $path;
}
/**
* Get path files
*
* @return string
*/
public function getPathFiles()
{
return $this->pathFiles;
}
/**
* This function get the list of the log files
*
* @param string $filter
* @param string $sort
* @param int $start
* @param int $limit
* @param string $dir related to order the column
*
* @return array
*/
abstract public function getAllFiles(
$filter = '',
$sort = '',
$start = 0,
$limit = 20,
$dir = 'ASC'
);
/**
* Download file
*
* @param array files
*/
abstract public function download($files);
}

View File

@@ -0,0 +1,283 @@
<?php
namespace ProcessMaker\BusinessModel\Files;
use Chumper\Zipper\Zipper;
use Configurations;
use Exception;
use G;
use ProcessMaker\Core\System;
use SplFileInfo;
use Symfony\Component\Finder\Finder;
class FilesLogs extends Files
{
/**
* Date format in list
* @var string
*/
private $dateFormat = 'Y-m-d H:i:s';
/**
* Path of the directory where the files are stored.
*
* @var string
*/
private $pathData = '';
/**
* FilesLogs constructor .
*/
public function __construct()
{
$system = System::getSystemConfiguration();
$configuration = new Configurations();
$generalConfig = $configuration->getConfiguration('ENVIRONMENT_SETTINGS', '');
if (isset($generalConfig['casesListDateFormat']) && !empty($generalConfig['casesListDateFormat'])) {
$this->setDateFormat($generalConfig['casesListDateFormat']);
}
$path = PATH_DATA . 'sites' . PATH_SEP . config('system.workspace') . PATH_SEP . 'log' . PATH_SEP;
if (isset($system['logs_location']) && !empty($system['logs_location']) && is_dir($system['logs_location'])) {
$path = $system['logs_location'];
}
$this->setPathDataSaveFile(PATH_DATA_PUBLIC);
parent::__construct($path);
}
/**
* Get Date Format
*
* @return string
*/
public function getDateFormat()
{
return $this->dateFormat;
}
/**
* Set Date Format
*
* @param string $dateFormat
*/
public function setDateFormat($dateFormat)
{
$this->dateFormat = $dateFormat;
}
/**
* Get Path data
*
* @return string
*/
public function getPathDataSaveFile()
{
return $this->pathData;
}
/**
* Set path data
*
* @param string $pathData
*/
public function setPathDataSaveFile($pathData)
{
G::mk_dir($pathData);
$this->pathData = $pathData;
}
/**
* This function get the list of the log files
*
* @param string $filter
* @param string $sort
* @param int $start
* @param int $limit
* @param string $dir related to order the column
*
* @return array
*/
public function getAllFiles($filter = '', $sort = 'fileCreated', $start = 0, $limit = 20, $dir = 'DESC')
{
if (!file_exists($this->getPathFiles())) {
return [
'totalRows' => 0,
'data' => []
];
}
$finder = new Finder();
$finder->files()
->in($this->getPathFiles())
->name('processmaker*.log')
->name('audit*.log');
if (!empty($filter)) {
$finder->filter(function (SplFileInfo $file) use ($filter) {
if (stristr($file->getFilename(), $filter) === false &&
stristr($file->getSize(), $filter) === false &&
stristr($file->getMTime(), $filter) === false
) {
return false;
}
});
}
//get files
$iterator = $finder->getIterator();
$files = iterator_to_array($iterator);
//sort files
switch ($sort) {
case 'fileSize':
uasort($files, function (SplFileInfo $a, SplFileInfo $b) use ($dir) {
$size1 = $a->getSize();
$size2 = $b->getSize();
if ($dir === 'ASC') {
return $size1 > $size2;
} else {
return $size1 < $size2;
}
});
break;
case 'fileCreated':
uasort($files, function ($a, $b) use ($dir) {
$time1 = $a->getMTime();
$time2 = $b->getMTime();
if ($dir === 'ASC') {
return $time1 > $time2;
} else {
return $time1 < $time2;
}
});
break;
case 'fileName':
default:
uasort($files, function ($a, $b) use ($dir) {
$name1 = $a->getFilename();
$name2 = $b->getFilename();
if ($dir === 'ASC') {
return strcmp($name1, $name2);
} else {
return strcmp($name2, $name1);
}
});
break;
}
//count files
$total = count($files);
//limit files
$files = array_slice(
$files, !empty($start) ? $start : 0, !empty($limit) ? $limit : 20
);
//create out element
$result = [];
foreach ($files as $file) {
$result[] = [
'fileName' => $file->getFilename(),
'fileSize' => $this->size($file->getSize()),
'fileCreated' => date($this->getDateFormat(), $file->getMTime())
];
}
return [
'totalRows' => $total,
'data' => $result
];
}
/**
* Change the size of a file in bytes to its literal equivalent
*
* @param int $size file size in bytes
* @param string $format
* @return string
*/
private function size($size, $format = null)
{
$sizes = ['Bytes', 'Kbytes', 'Mbytes', 'Gbytes', 'Tbytes', 'Pbytes', 'Ebytes', 'Zbytes', 'Ybytes'];
if ($format === null) {
$format = ' % 01.2f % s';
}
$lastSizesLabel = end($sizes);
foreach ($sizes as $sizeLabel) {
if ($size < 1024) {
break;
}
if ($sizeLabel !== $lastSizesLabel) {
$size /= 1024;
}
}
if ($sizeLabel === $sizes[0]) {
// Format bytes
$format = '%01d %s';
}
return sprintf($format, $size, $sizeLabel);
}
/**
* Create file zip
*
* @param array $files file name
*
* @return string path file
* @throws Exception
*/
private function createZip($files)
{
try {
$zipper = new Zipper();
$name = str_replace('.log', '.zip', $files[0]);
if (count($files) > 1) {
$name = 'processmaker_logs.zip';
}
$zipper->zip($this->getPathDataSaveFile() . $name);
$pathFileLogs = $this->getPathFiles();
$pathSep = '/';
if (strpos($pathFileLogs, '\\') !== false) {
$pathSep = '\\';
}
if (substr($pathFileLogs, -1, strlen($pathSep)) !== $pathSep) {
$pathFileLogs .= $pathSep;
}
foreach ($files as $key => $file) {
$info = pathinfo($file);
if (file_exists($pathFileLogs . $info['basename'])) {
$zipper->add($pathFileLogs . $info['basename']);
}
}
$zipper->close();
return $this->getPathDataSaveFile() . $name;
} catch (Exception $error) {
throw $error;
}
}
/**
* Download log files compressed in a Zip format
*
* @param array $files files names
*
* @throws Exception
*/
public function download($files)
{
try {
$fileZip = $this->createZip($files);
if (file_exists($fileZip)) {
G::streamFile($fileZip, true);
} else {
throw new Exception('File not exist.');
}
G::rm_dir($fileZip);
} catch (Exception $error) {
throw $error;
}
}
}

View File

@@ -1,11 +1,12 @@
<?php
namespace ProcessMaker\BusinessModel;
use Behat\Behat\Exception\Exception;
use \G;
use \Criteria;
use \ObjectPermissionPeer;
use \Exception as StandardException;
use BasePeer;
use Criteria;
use G;
use ObjectPermission;
use ObjectPermissionPeer;
use Exception;
/**
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
@@ -13,6 +14,7 @@ use \Exception as StandardException;
*/
class ProcessPermissions
{
const DOES_NOT_APPLY = 'N/A';
/**
* Get list for Process Permissions
*
@@ -20,8 +22,6 @@ class ProcessPermissions
* @var string $op_uid. Uid for Process Permission
*
* @access public
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return array
*/
@@ -42,6 +42,14 @@ class ProcessPermissions
$oDataset->setFetchmode(\ResultSet::FETCHMODE_ASSOC);
$oDataset->next();
while ($aRow = $oDataset->getRow()) {
//Participated
if ($aRow['OP_PARTICIPATE'] == 0) {
$participated = G::LoadTranslation('ID_NO');
} else {
$participated = G::LoadTranslation('ID_YES');
}
//Obtain action (permission)
$action = G::LoadTranslation('ID_' . $aRow['OP_ACTION']);
//Obtain task target
if (($aRow['TAS_UID'] != '') && ($aRow['TAS_UID'] != '0')) {
try {
@@ -87,97 +95,87 @@ class ProcessPermissions
//Obtain object and type
switch ($aRow['OP_OBJ_TYPE']) {
case 'ALL':
$sObjectType = G::LoadTranslation('ID_ALL');
$sObject = G::LoadTranslation('ID_ALL');
$objectType = G::LoadTranslation('ID_ALL');
$object = G::LoadTranslation('ID_ALL');
break;
case 'ANY': //For backward compatibility (some process with ANY instead of ALL
$sObjectType = G::LoadTranslation('ID_ALL');
$sObject = G::LoadTranslation('ID_ALL');
$objectType = G::LoadTranslation('ID_ALL');
$object = G::LoadTranslation('ID_ALL');
break;
/* case 'ANY_DYNAFORM':
$sObjectType = G::LoadTranslation('ID_ANY_DYNAFORM');
$sObject = G::LoadTranslation('ID_ALL');
break;
case 'ANY_INPUT':
$sObjectType = G::LoadTranslation('ID_ANY_INPUT');
$sObject = G::LoadTranslation('ID_ALL');
break;
case 'ANY_OUTPUT':
$sObjectType = G::LoadTranslation('ID_ANY_OUTPUT');
$sObject = G::LoadTranslation('ID_ALL');
break; */
case 'DYNAFORM':
$sObjectType = G::LoadTranslation('ID_DYNAFORM');
$objectType = G::LoadTranslation('ID_DYNAFORM');
if (($aRow['OP_OBJ_UID'] != '') && ($aRow['OP_OBJ_UID'] != '0')) {
$oDynaform = new \Dynaform();
try {
$aFields = $oDynaform->load($aRow['OP_OBJ_UID']);
$sObject = $aFields['DYN_TITLE'];
$object = $aFields['DYN_TITLE'];
} catch (\Exception $errorNotExists) {
error_log($errorNotExists->getMessage() . ' - ' . G::LoadTranslation('ID_PROCESS_PERMISSIONS') .
error_log($errorNotExists->getMessage() . ' - ' . G::LoadTranslation('ID_PROCESS_PERMISSIONS') .
' - ' . $aRow['OP_OBJ_TYPE'] . ' - ' . $aRow['OP_OBJ_UID']);
$oDataset->next();
continue 2;
}
} else {
$sObject = G::LoadTranslation('ID_ALL');
$object = G::LoadTranslation('ID_ALL');
}
break;
case 'INPUT':
$sObjectType = G::LoadTranslation('ID_INPUT_DOCUMENT');
$objectType = G::LoadTranslation('ID_INPUT_DOCUMENT');
if (($aRow['OP_OBJ_UID'] != '') && ($aRow['OP_OBJ_UID'] != '0')) {
$oInputDocument = new \InputDocument();
try {
$aFields = $oInputDocument->load($aRow['OP_OBJ_UID']);
$sObject = $aFields['INP_DOC_TITLE'];
$object = $aFields['INP_DOC_TITLE'];
} catch (\Exception $errorNotExists) {
error_log($errorNotExists->getMessage() . ' - ' . G::LoadTranslation('ID_PROCESS_PERMISSIONS') .
error_log($errorNotExists->getMessage() . ' - ' . G::LoadTranslation('ID_PROCESS_PERMISSIONS') .
' - ' . $aRow['OP_OBJ_TYPE'] . ' - ' . $aRow['OP_OBJ_UID']);
$oDataset->next();
continue 2;
}
} else {
$sObject = G::LoadTranslation('ID_ALL');
$object = G::LoadTranslation('ID_ALL');
}
break;
case 'OUTPUT':
$sObjectType = G::LoadTranslation('ID_OUTPUT_DOCUMENT');
$objectType = G::LoadTranslation('ID_OUTPUT_DOCUMENT');
if (($aRow['OP_OBJ_UID'] != '') && ($aRow['OP_OBJ_UID'] != '0')) {
$oOutputDocument = new \OutputDocument();
try {
$aFields = $oOutputDocument->load($aRow['OP_OBJ_UID']);
$sObject = $aFields['OUT_DOC_TITLE'];
$object = $aFields['OUT_DOC_TITLE'];
} catch (\Exception $errorNotExists) {
error_log($errorNotExists->getMessage() . ' - ' . G::LoadTranslation('ID_PROCESS_PERMISSIONS') .
error_log($errorNotExists->getMessage() . ' - ' . G::LoadTranslation('ID_PROCESS_PERMISSIONS') .
' - ' . $aRow['OP_OBJ_TYPE'] . ' - ' . $aRow['OP_OBJ_UID']);
$oDataset->next();
continue 2;
}
} else {
$sObject = G::LoadTranslation('ID_ALL');
$object = G::LoadTranslation('ID_ALL');
}
break;
case 'CASES_NOTES':
$sObjectType = G::LoadTranslation('ID_CASES_NOTES');
$sObject = 'N/A';
$objectType = G::LoadTranslation('ID_CASES_NOTES');
$object = self::DOES_NOT_APPLY;
break;
case 'MSGS_HISTORY':
$sObjectType = G::LoadTranslation('MSGS_HISTORY');
$sObject = G::LoadTranslation('ID_ALL');
$objectType = G::LoadTranslation('MSGS_HISTORY');
$object = G::LoadTranslation('ID_ALL');
break;
/*----------------------------------********---------------------------------*/
case 'REASSIGN_MY_CASES':
$objectType = G::LoadTranslation('ID_REASSIGN_MY_CASES');
$object = self::DOES_NOT_APPLY;
$aRow['OP_ACTION'] = self::DOES_NOT_APPLY;
$participated = self::DOES_NOT_APPLY;
break;
/*----------------------------------********---------------------------------*/
default:
$sObjectType = G::LoadTranslation('ID_ALL');
$sObject = G::LoadTranslation('ID_ALL');
$objectType = G::LoadTranslation('ID_ALL');
$object = G::LoadTranslation('ID_ALL');
break;
}
//Participated
if ($aRow['OP_PARTICIPATE'] == 0) {
$sParticipated = G::LoadTranslation('ID_NO');
} else {
$sParticipated = G::LoadTranslation('ID_YES');
}
//Obtain action (permission)
$sAction = G::LoadTranslation('ID_' . $aRow['OP_ACTION']);
//Add to array
$arrayTemp = array();
$arrayTemp = array_merge($aRow, array(
@@ -185,10 +183,10 @@ class ProcessPermissions
'TASK_TARGET' => $sTaskTarget,
'GROUP_USER' => $sUserGroup,
'TASK_SOURCE' => $sTaskSource,
'OBJECT_TYPE' => $sObjectType,
'OBJECT' => $sObject,
'PARTICIPATED' => $sParticipated,
'ACTION' => $sAction,
'OBJECT_TYPE' => $objectType,
'OBJECT' => $object,
'PARTICIPATED' => $participated,
'ACTION' => $action,
'OP_CASE_STATUS' => $aRow['OP_CASE_STATUS'])
);
$aObjectsPermissions[] = array_change_key_case($arrayTemp, CASE_LOWER);
@@ -213,7 +211,7 @@ class ProcessPermissions
*
* @access public
*
* @return void
* @return void|array
* @throws Exception
*/
public function saveProcessPermission($data, $opUid = '')
@@ -226,7 +224,7 @@ class ProcessPermissions
$opUid = $this->validateOpUid($opUid);
}
if (empty($data['USR_UID']) || (isset($data['USR_UID']) && $data['USR_UID'] === "null")) {
throw (new StandardException(G::LoadTranslation("ID_SELECT_USER_OR_GROUP")));
throw (new Exception(G::LoadTranslation("ID_SELECT_USER_OR_GROUP")));
}
if ($data['OP_USER_RELATION'] == "1") {
$this->validateUsrUid($data['USR_UID']);
@@ -244,50 +242,59 @@ class ProcessPermissions
$data['OP_TASK_SOURCE'] = '';
}
$sObjectUID = '';
$opCaseStatus = !empty($data['OP_CASE_STATUS']) ? $data['OP_CASE_STATUS'] : '0';
$opObjectUid = '';
switch ($data['OP_OBJ_TYPE']) {
case 'ANY':
//case 'ANY_DYNAFORM':CASES_NOTES
//case 'ANY_INPUT':
//case 'ANY_OUTPUT':
$sObjectUID = '';
$opObjectUid = '';
break;
case 'DYNAFORM':
$data['DYNAFORMS'] = $data['DYNAFORMS'] == 0 ? '': $data['DYNAFORMS'];
if ($data['DYNAFORMS'] != '') {
$this->validateDynUid($data['DYNAFORMS']);
}
$sObjectUID = $data['DYNAFORMS'];
$opObjectUid = $data['DYNAFORMS'];
break;
case 'ATTACHED':
$sObjectUID = '';
$opObjectUid = '';
break;
case 'INPUT':
$data['INPUTS'] = $data['INPUTS'] == 0 ? '': $data['INPUTS'];
if ($data['INPUTS'] != '') {
$this->validateInpUid($data['INPUTS']);
}
$sObjectUID = $data['INPUTS'];
$opObjectUid = $data['INPUTS'];
break;
case 'OUTPUT':
$data['OUTPUTS'] = $data['OUTPUTS'] == 0 ? '': $data['OUTPUTS'];
if ($data['OUTPUTS'] != '') {
$this->validateOutUid($data['OUTPUTS']);
}
$sObjectUID = $data['OUTPUTS'];
$opObjectUid = $data['OUTPUTS'];
break;
case 'REASSIGN_MY_CASES':
$opCaseStatus = 'TO_DO';
$data['OP_ACTION'] = '';
break;
}
$oOP = new \ObjectPermission();
$objectPermission = new ObjectPermission();
$permissionUid = ($opUid != '') ? $opUid : G::generateUniqueID();
$data['OP_UID'] = $permissionUid;
$data['OP_OBJ_UID'] = $sObjectUID;
$opParticipate = empty($data['OP_PARTICIPATE']) ? ObjectPermission::OP_PARTICIPATE_NO : $data['OP_PARTICIPATE'];
$data['OP_PARTICIPATE'] = $opParticipate;
$data['OP_CASE_STATUS'] = $opCaseStatus;
$data['OP_OBJ_UID'] = $opObjectUid;
if ($opUid == '') {
$oOP->fromArray( $data, \BasePeer::TYPE_FIELDNAME );
$oOP->save();
$daraRes = $oOP->load($permissionUid);
$daraRes = array_change_key_case($daraRes, CASE_LOWER);
return $daraRes;
if (empty($opUid)) {
$objectPermission->fromArray($data, BasePeer::TYPE_FIELDNAME);
$objectPermission->save();
$newPermission = $objectPermission->load($permissionUid);
$newPermission = array_change_key_case($newPermission, CASE_LOWER);
return $newPermission;
} else {
$data['TAS_UID'] = $data['TAS_UID'] != '' ? $data['TAS_UID'] : '0';
$data['OP_TASK_SOURCE'] = $data['OP_TASK_SOURCE'] != '' ? $data['OP_TASK_SOURCE'] : '0';
@@ -296,7 +303,8 @@ class ProcessPermissions
$data['OP_OBJ_UID'] = $data['OP_OBJ_UID'] != '' ? $data['OP_OBJ_UID'] : '0';
$data['OP_ACTION'] = $data['OP_ACTION'] != '' ? $data['OP_ACTION'] : '0';
$data['OP_CASE_STATUS'] = $data['OP_CASE_STATUS'] != '' ? $data['OP_CASE_STATUS'] : '0';
$oOP->update($data);
$objectPermission->update($data);
}
} catch (Exception $e) {
throw $e;

View File

@@ -1,6 +1,7 @@
<?php
namespace ProcessMaker\Core;
use Configurations;
use DomDocument;
use Exception;
@@ -59,7 +60,8 @@ class System
'load_headers_ie' => 0,
'redirect_to_mobile' => 0,
'disable_php_upload_execution' => 0,
'disable_download_documents_session_validation' => 0
'disable_download_documents_session_validation' => 0,
'logs_max_files' => 60
);
/**
@@ -1129,18 +1131,26 @@ class System
}
if (empty($wsIniFile)) {
if (defined('PATH_DB')) {
// if we're on a valid workspace env.
if (empty($wsName)) {
$uriParts = explode('/', getenv("REQUEST_URI"));
if (isset($uriParts[1])) {
if (substr($uriParts[1], 0, 3) == 'sys') {
$wsName = substr($uriParts[1], 3);
try {
if (function_exists('config')) {
$wsName = config("system.workspace");
}
} catch (Exception $exception) {
$wsName = '';
}
if (empty($wsName)) {
$uriParts = explode('/', getenv("REQUEST_URI"));
if (isset($uriParts[1])) {
if (substr($uriParts[1], 0, 3) === 'sys') {
$wsName = substr($uriParts[1], 3);
}
}
}
}
$wsIniFile = PATH_DB . $wsName . PATH_SEP . 'env.ini';
}
}

View File

@@ -0,0 +1,73 @@
<?php
namespace ProcessMaker\Services\Api;
use Exception;
use G;
use ProcessMaker\BusinessModel\Files\FilesLogs;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
/**
* Log Files Api Controller
*
* @protected
*/
class FileLogs extends Api
{
/**
* Get the list of the log files
*
* @url GET /list
*
* @param int $start {@from path}
* @param int $limit {@from path}
* @param string $sort {@from path}
* @param string $dir {@from path}
* @param string $filter {@from path}
*
* @return array
* @throws RestException
*
* @access protected
* @class AccessControl {@permission PM_SETUP_LOG_FILES}
*/
public function doGetListFileLogs(
$start = 0,
$limit = 0,
$sort = 'fileCreated',
$dir = 'DESC',
$filter = ''
)
{
try {
$file = new FilesLogs();
return $file->getAllFiles($filter, $sort, $start, $limit, $dir);
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
/**
* Download file.
*
* @url POST /download
*
* @param array $request_data name of the files
*
* @throws RestException
*
* @access protected
* @class AccessControl {@permission PM_SETUP_LOG_FILES}
*/
public function doPostDownload($request_data)
{
try {
$file = new FilesLogs();
$file->download(G::json_decode($request_data['files']));
} catch (Exception $e) {
throw new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage());
}
}
}

View File

@@ -1,8 +1,10 @@
<?php
namespace ProcessMaker\Services\Api\Project;
use \ProcessMaker\Services\Api;
use \Luracast\Restler\RestException;
use Exception;
use Luracast\Restler\RestException;
use ProcessMaker\BusinessModel\ProcessPermissions as BmProcessPermissions;
use ProcessMaker\Services\Api;
/**
* Project\ProcessPermissions Api Controller
@@ -17,20 +19,18 @@ class ProcessPermissions extends Api
/**
* @param string $prj_uid {@min 1} {@max 32}
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return array
* @throws RestException
*
* @url GET /:prj_uid/process-permissions
*/
public function doGetProcessPermissions($prj_uid)
{
try {
$processPermissions = new \ProcessMaker\BusinessModel\ProcessPermissions();
$processPermissions = new BmProcessPermissions();
$response = $processPermissions->getProcessPermissions($prj_uid);
return $response;
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -39,20 +39,18 @@ class ProcessPermissions extends Api
* @param string $prj_uid {@min 1} {@max 32}
* @param string $ob_uid {@min 1} {@max 32}
*
* @author Brayan Pereyra (Cochalo) <brayan@colosa.com>
* @copyright Colosa - Bolivia
*
* @return array
* @throws RestException
*
* @url GET /:prj_uid/process-permission/:ob_uid
*/
public function doGetProcessPermission($prj_uid, $ob_uid)
{
try {
$processPermissions = new \ProcessMaker\BusinessModel\ProcessPermissions();
$processPermissions = new BmProcessPermissions();
$response = $processPermissions->getProcessPermissions($prj_uid, $ob_uid);
return $response;
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -75,11 +73,11 @@ class ProcessPermissions extends Api
public function doPostProcessPermission($prj_uid, $request_data)
{
try {
$hiddenFields = array('task_target', 'group_user', 'task_source',
$hiddenFields = ['task_target', 'group_user', 'task_source',
'object_type', 'object', 'participated', 'action'
);
];
$request_data['pro_uid'] = $prj_uid;
$processPermissions = new \ProcessMaker\BusinessModel\ProcessPermissions();
$processPermissions = new BmProcessPermissions();
$response = $processPermissions->saveProcessPermission($request_data);
foreach ($response as $key => $eventData) {
if (in_array($key, $hiddenFields)) {
@@ -87,13 +85,13 @@ class ProcessPermissions extends Api
}
}
return $response;
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
/**
* Update process permisson.
* Update process permission.
*
* @url PUT /:prj_uid/process-permission/:ob_uid
*
@@ -104,7 +102,7 @@ class ProcessPermissions extends Api
* @param string $op_user_relation {@from body} {@choice 1,2}
* @param string $op_case_status {@from body} {@choice ALL,DRAFT,TO_DO,PAUSED,COMPLETED}
* @param string $op_participate {@from body} {@choice 0,1}
* @param string $op_obj_type {@from body} {@choice ANY,DYNAFORM,ATTACHMENT,INPUT,OUTPUT,CASES_NOTES,MSGS_HISTORY,SUMMARY_FORM}
* @param string $op_obj_type {@from body} {@choice ANY,DYNAFORM,ATTACHMENT,INPUT,OUTPUT,CASES_NOTES,MSGS_HISTORY,SUMMARY_FORM,REASSIGN_MY_CASES}
* @param string $op_action {@from body} {@choice VIEW,BLOCK,DELETE,RESEND}
* @param string $tas_uid {@from body}
* @param string $op_task_source {@from body}
@@ -124,10 +122,10 @@ class ProcessPermissions extends Api
$request_data,
$usr_uid,
$op_user_relation,
$op_case_status,
$op_participate,
$op_case_status = 'ALL',
$op_participate = '0',
$op_obj_type,
$op_action,
$op_action = 'VIEW',
$tas_uid = '',
$op_task_source = '',
$dynaforms = '',
@@ -136,10 +134,11 @@ class ProcessPermissions extends Api
) {
try {
$request_data['pro_uid'] = $prj_uid;
$processPermissions = new \ProcessMaker\BusinessModel\ProcessPermissions();
$request_data['op_action'] = $op_action;
$processPermissions = new BmProcessPermissions();
$response = $processPermissions->saveProcessPermission($request_data, $ob_uid);
return $response;
} catch (\Exception $e) {
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}
@@ -153,14 +152,14 @@ class ProcessPermissions extends Api
* @param string $ob_uid {@min 1} {@max 32}
*
* @return void
* @throws RestException
*/
public function doDeleteProcessPermission($prj_uid, $ob_uid)
{
try {
$processPermissions = new \ProcessMaker\BusinessModel\ProcessPermissions();
$response = $processPermissions->deleteProcessPermission($ob_uid, $prj_uid);
return $response;
} catch (\Exception $e) {
$processPermissions = new BmProcessPermissions();
$processPermissions->deleteProcessPermission($ob_uid, $prj_uid);
} catch (Exception $e) {
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
}
}

View File

@@ -121,8 +121,11 @@ debug = 1
authentication = "ProcessMaker\Services\Api\Google\Authentication"
[alias: gmailIntegration]
gmailIntegration = "ProcessMaker\Services\Api\GmailIntegration"
token = "ProcessMaker\Services\Api\GmailToken"
gmailIntegration = "ProcessMaker\Services\Api\GmailIntegration"
token = "ProcessMaker\Services\Api\GmailToken"
[alias: reportingIndicators]
reportingIndicators = "ProcessMaker\Services\Api\ReportingIndicators"
reportingIndicators = "ProcessMaker\Services\Api\ReportingIndicators"
[alias: logs]
log = "ProcessMaker\Services\Api\FileLogs"