diff --git a/data/CRMEntity.php b/data/CRMEntity.php index 690203b42c..4bbf84c330 100644 --- a/data/CRMEntity.php +++ b/data/CRMEntity.php @@ -171,6 +171,16 @@ public function saveentity($module) { $adb->pquery($update_query, $update_params); } + if ($_REQUEST['assigned_user_id'] != $this->column_fields['assigned_user_id']) { + $cache = new corebos_cache(); + if ($cache->isUsable()) { + $oldcacheId = $module_name.'#ListViewActions#'.$this->id.'#'.$this->column_fields['assigned_user_id']; + $newcacheId = $module_name.'#ListViewActions#'.$this->id.'#'.$_REQUEST['assigned_user_id']; + $cache->getCacheClient()->delete($oldcacheId); + $cache->getCacheClient()->delete($newcacheId); + } + } + //Calling the Module specific save code $this->save_module($module); diff --git a/include/ListView/ListViewController.php b/include/ListView/ListViewController.php index 6e7703b658..abb8f3a0cc 100644 --- a/include/ListView/ListViewController.php +++ b/include/ListView/ListViewController.php @@ -114,6 +114,7 @@ public function fetchNameList($field, $result, $rel = null) { public function getListViewEntries($focus, $module, $result, $navigationInfo, $skipActions = false) { global $theme, $default_charset, $current_user, $currentModule, $adb; $is_admin = is_admin($current_user); + $cache = new corebos_cache(); $listview_max_textlength = GlobalVariable::getVariable('Application_ListView_Max_Text_Length', 40, $currentModule); $fields = $this->queryGenerator->getFields(); $meta = $this->queryGenerator->getMeta($this->queryGenerator->getModule()); @@ -595,29 +596,36 @@ function ($m) { //Added for Actions ie., edit and delete links in listview $actionLinkInfo = ''; - if (isPermitted($module, 'EditView', $recordId) == 'yes') { - $racbr = $wfs->getRACRuleForRecord($currentModule, $recordId); - if (!$racbr || $racbr->hasListViewPermissionTo('edit')) { - $edit_link = $this->getListViewEditLink($module, $recordId); - if (isset($navigationInfo['start']) && $navigationInfo['start'] > 1 && $module != 'Emails') { - $actionLinkInfo .= "".getTranslatedString('LNK_EDIT', $module).' '; - } else { - $actionLinkInfo .= "".getTranslatedString('LNK_EDIT', $module).' '; + $cacheId = $module.'#ListViewActions#'.$recordId.'#'.$current_user->id; + if ($cache->isUsable() && $cache->getCacheClient()->has($cacheId)) { + $actionLinkInfo = $cache->getCacheClient()->get($cacheId); + } else { + if (isPermitted($module, 'EditView', $recordId) == 'yes') { + $racbr = $wfs->getRACRuleForRecord($currentModule, $recordId); + if (!$racbr || $racbr->hasListViewPermissionTo('edit')) { + $edit_link = $this->getListViewEditLink($module, $recordId); + if (isset($navigationInfo['start']) && $navigationInfo['start'] > 1 && $module != 'Emails') { + $actionLinkInfo .= "".getTranslatedString('LNK_EDIT', $module).' '; + } else { + $actionLinkInfo .= "".getTranslatedString('LNK_EDIT', $module).' '; + } } } - } - - if (isPermitted($module, 'Delete', $recordId) == 'yes') { - $racbr = $wfs->getRACRuleForRecord($currentModule, $recordId); - if (!$racbr || $racbr->hasListViewPermissionTo('delete')) { - $del_link = $this->getListViewDeleteLink($module, $recordId); - if ($actionLinkInfo != '' && $del_link != '') { - $actionLinkInfo .= ' | '; - } - if ($del_link != '') { - $actionLinkInfo.="".getTranslatedString('LNK_DELETE', $module).''; + if (isPermitted($module, 'Delete', $recordId) == 'yes') { + $racbr = $wfs->getRACRuleForRecord($currentModule, $recordId); + if (!$racbr || $racbr->hasListViewPermissionTo('delete')) { + $del_link = $this->getListViewDeleteLink($module, $recordId); + if ($actionLinkInfo != '' && $del_link != '') { + $actionLinkInfo .= ' | '; + } + if ($del_link != '') { + $actionLinkInfo.="".getTranslatedString('LNK_DELETE', $module).''; + } } } + if ($cache->isUsable()) { + $cache->getCacheClient()->set($cacheId, $actionLinkInfo); + } } $customlink_params['RECORD'] = $recordId; diff --git a/include/utils/UserInfoUtil.php b/include/utils/UserInfoUtil.php index 0c4cb851f3..3b8f4c6a4e 100644 --- a/include/utils/UserInfoUtil.php +++ b/include/utils/UserInfoUtil.php @@ -533,6 +533,7 @@ function isPermitted($module, $actionname, $record_id = '') { */ function _vtisPermitted($module, $actionname, $record_id = '') { global $log, $adb, $current_user; + $cache = new corebos_cache(); if ($module=='com_vtiger_workflow') { $module='CronTasks'; } @@ -540,6 +541,13 @@ function _vtisPermitted($module, $actionname, $record_id = '') { if (strpos($record_id, 'x')>0) { // is webserviceid list($void,$record_id) = explode('x', $record_id); } + $cacheId = $module.'#'.$actionname.'#'.$record_id.'#'.$current_user->id; + if (empty($record_id)) { + $cacheId = $module.'#'.$actionname.'#'.$current_user->id; + } + if ($cache->isUsable() && $cache->getCacheClient()->has($cacheId)) { + return $cache->getCacheClient()->get($cacheId); + } if (!empty($record_id) && $module != getSalesEntityType($record_id)) { $record_id = ''; } @@ -832,7 +840,9 @@ function _vtisPermitted($module, $actionname, $record_id = '') { $permission = 'no'; } } - + if ($cache->isUsable()) { + $cache->getCacheClient()->set($cacheId, $permission); + } $log->debug('< isPermitted end '.$permission); return $permission; } diff --git a/modules/Users/SaveOrgSharing.php b/modules/Users/SaveOrgSharing.php index 70f1c9b6ae..91be0f842e 100644 --- a/modules/Users/SaveOrgSharing.php +++ b/modules/Users/SaveOrgSharing.php @@ -13,12 +13,16 @@ $sql2 = 'select * from vtiger_def_org_share where editstatus=0'; $result2 = $adb->pquery($sql2, array()); $num_rows = $adb->num_rows($result2); - +$cache = new corebos_cache(); for ($i=0; $i<$num_rows; $i++) { $ruleid=$adb->query_result($result2, $i, 'ruleid'); $tabid=$adb->query_result($result2, $i, 'tabid'); + $activepermission=$adb->query_result($result2, $i, 'permission'); $reqval = $tabid.'_per'; $permission=(isset($_REQUEST[$reqval]) ? $_REQUEST[$reqval] : 2); + if ($cache->isUsable() && $activepermission != $permission) { + $cache->getCacheClient()->clear(); + } $sql7='update vtiger_def_org_share set permission=? where tabid=? and ruleid=?'; $adb->pquery($sql7, array($permission, $tabid, $ruleid)); diff --git a/modules/com_vtiger_workflow/saveworkflow.php b/modules/com_vtiger_workflow/saveworkflow.php index ad44c018d9..eadc62c9ab 100644 --- a/modules/com_vtiger_workflow/saveworkflow.php +++ b/modules/com_vtiger_workflow/saveworkflow.php @@ -88,6 +88,12 @@ function vtWorkflowSave($adb, $request) { } else { $relatemodule = ''; } + if ($executionCondition == 'RECORD_ACCESS_CONTROL') { + $cache = new corebos_cache(); + if ($cache->isUsable()) { + $cache->getCacheClient()->clear(); + } + } $wm = new VTWorkflowManager($adb); if ($saveType == 'new') {