From 0fae3652d3a59c4c04c261c6ac6d27b9f64db904 Mon Sep 17 00:00:00 2001 From: norahmollo Date: Wed, 8 Oct 2014 09:50:54 -0400 Subject: [PATCH] BUG-12021 Audit Log Ip client column added --- gulliver/system/class.g.php | 3 ++- workflow/engine/controllers/adminProxy.php | 4 ++-- workflow/engine/methods/setup/auditLogAjax.php | 11 ++++++----- workflow/engine/templates/setup/auditLog.js | 5 ++++- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/gulliver/system/class.g.php b/gulliver/system/class.g.php index b4022ed90..c423a3caf 100755 --- a/gulliver/system/class.g.php +++ b/gulliver/system/class.g.php @@ -5277,12 +5277,13 @@ class G { $oServerConf = & serverConf::getSingleton(); $sflagAudit = $oServerConf->getAuditLogProperty( 'AL_OPTION', SYS_SYS ); + $ipClient = G::getIpAddress(); if ($sflagAudit) { $workspace = defined('SYS_SYS') ? SYS_SYS : 'Wokspace Undefined'; $username = isset($_SESSION['USER_LOGGED']) && $_SESSION['USER_LOGGED'] != '' ? $_SESSION['USER_LOGGED'] : 'Unknow User'; $fullname = isset($_SESSION['USR_FULLNAME']) && $_SESSION['USR_FULLNAME'] != '' ? $_SESSION['USR_FULLNAME'] : '-'; - G::log("|". $workspace ."|". $username . "|" . $fullname ."|" . $actionToLog . "|" . $valueToLog, PATH_DATA, "audit.log"); + G::log("|". $workspace ."|". $ipClient ."|". $username . "|" . $fullname ."|" . $actionToLog . "|" . $valueToLog, PATH_DATA, "audit.log"); } } diff --git a/workflow/engine/controllers/adminProxy.php b/workflow/engine/controllers/adminProxy.php index 3d3abfc60..68c2adaf8 100644 --- a/workflow/engine/controllers/adminProxy.php +++ b/workflow/engine/controllers/adminProxy.php @@ -1056,6 +1056,7 @@ class adminProxy extends HttpProxyController try { list($imageWidth, $imageHeight, $imageType) = @getimagesize($dir . '/' . 'tmp' . $fileName); G::resizeImage($dir . '/tmp' . $fileName, $imageWidth, 49, $dir . '/' . $fileName); + G::auditLog("UploadLogo", $fileName); } catch (Exception $e) { $error = $e->getMessage(); } @@ -1072,8 +1073,7 @@ class adminProxy extends HttpProxyController } } elseif ($_FILES['img']['type'] != '') { $failed = "1"; - } - G::auditLog("UploadLogo", $fileName); + } echo '{success: true, failed: ' . $failed . ', uploaded: ' . $uploaded . ', type: "' . $_FILES['img']['type'] . '"}'; exit(); } diff --git a/workflow/engine/methods/setup/auditLogAjax.php b/workflow/engine/methods/setup/auditLogAjax.php index b4fded1ae..f61abccde 100644 --- a/workflow/engine/methods/setup/auditLogAjax.php +++ b/workflow/engine/methods/setup/auditLogAjax.php @@ -19,9 +19,10 @@ function auditLogArraySet ($str, $filter) if (count( $arrayAux ) > 1) { $date = (isset( $arrayAux[0] )) ? trim( $arrayAux[0] ) : ""; $workspace = (isset( $arrayAux[1] )) ? trim( $arrayAux[1] ) : ""; - $user = (isset( $arrayAux[3] )) ? trim( $arrayAux[3] ) : ""; - $action = (isset( $arrayAux[4] )) ? trim( $arrayAux[4] ) : ""; - $description = (isset( $arrayAux[5] )) ? trim( $arrayAux[5] ) : ""; + $ip = (isset( $arrayAux[2] )) ? trim( $arrayAux[2] ) : ""; + $user = (isset( $arrayAux[4] )) ? trim( $arrayAux[4] ) : ""; + $action = (isset( $arrayAux[5] )) ? trim( $arrayAux[5] ) : ""; + $description = (isset( $arrayAux[6] )) ? trim( $arrayAux[6] ) : ""; } $mktDate = (! empty( $date )) ? mktimeDate( $date ) : 0; @@ -48,7 +49,7 @@ function auditLogArraySet ($str, $filter) $sw = 0; $string = $filter["description"]; - if ( (stristr($date, $string) !== false) || (stristr($user, $string) !== false) || (stristr($action, $string) !== false) || (stristr($description, $string) !== false) ) { + if ( (stristr($date, $string) !== false) || (stristr($ip, $string) !== false) || (stristr($user, $string) !== false) || (stristr($action, $string) !== false) || (stristr($description, $string) !== false) ) { $sw = 1; } } @@ -56,7 +57,7 @@ function auditLogArraySet ($str, $filter) $arrayData = array (); if ($sw == 1) { - $arrayData = array ("DATE" => $date, "USER" => $user, "ACTION" => $action, "DESCRIPTION" => $description); + $arrayData = array ("DATE" => $date, "USER" => $user, "IP" =>$ip, "ACTION" => $action, "DESCRIPTION" => $description); } return $arrayData; diff --git a/workflow/engine/templates/setup/auditLog.js b/workflow/engine/templates/setup/auditLog.js index b9dd4314d..e50fcf930 100644 --- a/workflow/engine/templates/setup/auditLog.js +++ b/workflow/engine/templates/setup/auditLog.js @@ -43,6 +43,7 @@ audit.application = { if (typeof record != "undefined") { var strData = "" + _("ID_DATE_LABEL") + "
" + record.get("DATE") + "
"; strData = strData + "" + _("ID_USER") + "
" + record.get("WORKSPACE") + "
"; + strData = strData + "" + _("ID_IP") + "
" + record.get("IP") + "
"; strData = strData + "" + _("ID_ACTION") + "
" + record.get("ACTION") + "
"; strData = strData + "" + _("ID_DESCRIPTION") + "
" + record.get("DESCRIPTION") + "
"; @@ -65,6 +66,7 @@ audit.application = { fields: [ {name: "DATE"}, {name: "USER"}, + {name: "IP"}, {name: "ACTION"}, {name: "DESCRIPTION"} ] @@ -161,8 +163,9 @@ audit.application = { }, columns: [ {id: "ID", dataIndex: "DATE", hidden: true, hideable: false}, - {header: _("ID_DATE_LABEL"), dataIndex: "DATE", width: 10}, + {header: _("ID_DATE_LABEL"), dataIndex: "DATE", width: 15}, {header: _("ID_USER"), dataIndex: "USER", width: 15}, + {header: _("ID_IP"), dataIndex: "IP", width: 10}, {header: _("ID_ACTION"), dataIndex: "ACTION", width: 15}, {header: _("ID_DESCRIPTION"), dataIndex: "DESCRIPTION"} ]