/** Function to check if the outlook user is permitted to perform the specified action * @param $module -- Module Name:: Type varchar * @param $actionname -- Action Name:: Type varchar * @param $recordid -- Record Id:: Type integer * @returns yes or no. If Yes means this action is allowed for the currently logged in user. If no means this action is not allowed for the currently logged in user * */ function isAllowed_Outlook($module, $action, $user_id, $record_id) { global $log; $log->debug("Entering isAllowed_Outlook(" . $module . "," . $action . "," . $user_id . "," . $record_id . ") method ..."); $permission = "no"; if ($module == 'Users' || $module == 'Home' || $module == 'Administration' || $module == 'uploads' || $module == 'Settings' || $module == 'Calendar') { //These modules done have security $permission = "yes"; } else { global $adb; global $current_user; $tabid = getTabid($module); $actionid = getActionid($action); $profile_id = fetchUserProfileId($user_id); $tab_per_Data = getAllTabsPermission($profile_id); $permissionData = getTabsActionPermission($profile_id); $defSharingPermissionData = getDefaultSharingAction(); $others_permission_id = $defSharingPermissionData[$tabid]; //Checking whether this vtiger_tab is allowed if ($tab_per_Data[$tabid] == 0) { $permission = 'yes'; //Checking whether this action is allowed if ($permissionData[$tabid][$actionid] == 0) { $permission = 'yes'; $rec_owner_id = ''; if ($record_id != '' && $module != 'Faq') { $rec_owner_id = getUserId($record_id); } if ($record_id != '' && $others_permission_id != '' && $module != 'Faq' && $rec_owner_id != 0) { if ($rec_owner_id != $current_user->id) { if ($others_permission_id == 0) { if ($action == 'EditView' || $action == 'Delete') { $permission = "no"; } else { $permission = "yes"; } } elseif ($others_permission_id == 1) { if ($action == 'Delete') { $permission = "no"; } else { $permission = "yes"; } } elseif ($others_permission_id == 2) { $permission = "yes"; } elseif ($others_permission_id == 3) { if ($action == 'DetailView' || $action == 'EditView' || $action == 'Delete') { $permission = "no"; } else { $permission = "yes"; } } } else { $permission = "yes"; } } } else { $permission = "no"; } } else { $permission = "no"; } } $log->debug("Exiting isAllowed_Outlook method ..."); return $permission; }
$tab_edit_per_id = getDisplayOutput($tab_edit_per_id, $tabid, '1'); //Delete Permission $tab_delete_per_id = $action_array['2']; $tab_delete_per = getDisplayOutput($tab_delete_per_id, $tabid, '2'); //View Permission $tab_view_per_id = $action_array['4']; $tab_view_per = getDisplayOutput($tab_view_per_id, $tabid, '4'); $stand[] = $entity_name; $stand[] = $tab_edit_per_id; $stand[] = $tab_delete_per; $stand[] = $tab_view_per; $stand[] = $tab_create_per; $privileges_stand[$tabid] = $stand; } } else { $act_perr_arry = getTabsActionPermission(1); foreach ($act_perr_arry as $tabid => $action_array) { $stand = array(); $entity_name = getTabModuleName($tabid); //Create Permission $tab_create_per_id = $action_array['7']; $tab_create_per = getDisplayOutput(0, $tabid, '7'); //Edit Permission $tab_edit_per_id = $action_array['1']; $tab_edit_per_id = getDisplayOutput(0, $tabid, '1'); //Delete Permission $tab_delete_per_id = $action_array['2']; $tab_delete_per = getDisplayOutput(0, $tabid, '2'); //View Permission $tab_view_per_id = $action_array['4']; $tab_view_per = getDisplayOutput(0, $tabid, '4');