From c6958575b72fc0616827f8cf43dbfda7c365752a Mon Sep 17 00:00:00 2001 From: Paula Quispe Date: Mon, 20 Nov 2017 12:51:52 -0400 Subject: [PATCH] HOR-3612 --- gulliver/system/class.rbac.php | 6 ++ .../engine/methods/tools/ajaxListener.php | 57 ++++++++++--------- 2 files changed, 35 insertions(+), 28 deletions(-) diff --git a/gulliver/system/class.rbac.php b/gulliver/system/class.rbac.php index 0a127bba6..2b5c7e2d6 100644 --- a/gulliver/system/class.rbac.php +++ b/gulliver/system/class.rbac.php @@ -185,6 +185,12 @@ class RBAC 'processes_GetFile.php' => [ 'mailTemplates' => ['PM_FACTORY'], 'public' => ['PM_FACTORY'] + ], + 'tools/ajaxListener.php' => [ + 'getList' => ['PM_SETUP'], + 'save' => ['PM_SETUP'], + 'delete' => ['PM_SETUP'], + 'rebuild' => ['PM_SETUP'] ] ]; $this->aliasPermissions['PM_CASES'] = [self::PM_GUEST_CASE]; diff --git a/workflow/engine/methods/tools/ajaxListener.php b/workflow/engine/methods/tools/ajaxListener.php index 8aa881dbc..f0fc1aa37 100644 --- a/workflow/engine/methods/tools/ajaxListener.php +++ b/workflow/engine/methods/tools/ajaxListener.php @@ -1,41 +1,24 @@ . - * - * For more information, contact Colosa Inc, 2566 Le Jeune Rd., - * Coral Gables, FL, 33134, USA, or email info@colosa.com. - */ -/** - * - * @author Erik Amaru Ortiz - * @date Jan 10th, 2010 - */ - $action = $_REQUEST['action']; unset($_REQUEST['action']); + +global $RBAC; +$RBAC->allows(basename(dirname(__FILE__)) . PATH_SEP . basename(__FILE__), $action); + $ajax = new Ajax(); $ajax->$action($_REQUEST); class Ajax { + /** + * Get the list related to the translation + * + * @param array $params + * + * @return void + */ public function getList($params) { $search = isset($params['search']) ? $params['search'] : null; @@ -46,6 +29,11 @@ class Ajax echo G::json_encode($result); } + /** + * Save translation + * + * @return void + */ public function save() { try { @@ -53,6 +41,7 @@ class Ajax $label = preg_replace("[\n|\r|\n\r]", ' ', $_POST['label']); $res = Translation::addTranslation('LABEL', $id, 'en', $label); + $result = new stdClass(); if ($res['codError'] < 0) { $result->success = false; $result->msg = $res['message']; @@ -67,10 +56,16 @@ class Ajax print G::json_encode($result); } + /** + * Delete translation + * + * @return void + */ public function delete() { $ids = explode(',', $_POST['IDS']); $category = 'LABEL'; + $result = new stdClass(); try { foreach ($ids as $id) { @@ -89,8 +84,14 @@ class Ajax print G::json_encode($result); } + /** + * Rebuild translation + * + * @return void + */ public function rebuild() { + $result = new stdClass(); try { $t = new Translation(); $result = Translation::generateFileTranslation('en');