Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions data/CRMEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
46 changes: 27 additions & 19 deletions include/ListView/ListViewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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 .= "<a href=\"$edit_link&start=".$navigationInfo['start']."\">".getTranslatedString('LNK_EDIT', $module).'</a> ';
} else {
$actionLinkInfo .= "<a href=\"$edit_link\">".getTranslatedString('LNK_EDIT', $module).'</a> ';
$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 .= "<a href=\"$edit_link&start=".$navigationInfo['start']."\">".getTranslatedString('LNK_EDIT', $module).'</a> ';
} else {
$actionLinkInfo .= "<a href=\"$edit_link\">".getTranslatedString('LNK_EDIT', $module).'</a> ';
}
}
}
}

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.="<a href='javascript:confirmdelete(\"".addslashes(urlencode($del_link))."\")'>".getTranslatedString('LNK_DELETE', $module).'</a>';
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.="<a href='javascript:confirmdelete(\"".addslashes(urlencode($del_link))."\")'>".getTranslatedString('LNK_DELETE', $module).'</a>';
}
}
}
if ($cache->isUsable()) {
$cache->getCacheClient()->set($cacheId, $actionLinkInfo);
}
}

$customlink_params['RECORD'] = $recordId;
Expand Down
12 changes: 11 additions & 1 deletion include/utils/UserInfoUtil.php
Original file line number Diff line number Diff line change
Expand Up @@ -533,13 +533,21 @@ 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';
}
$log->debug('> isPermitted '.$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 = '';
}
Expand Down Expand Up @@ -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;
}
Expand Down
6 changes: 5 additions & 1 deletion modules/Users/SaveOrgSharing.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down
6 changes: 6 additions & 0 deletions modules/com_vtiger_workflow/saveworkflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down