Skip to content

Commit

Permalink
Fix salesagility#2221 - Restrict Reports based on Target Module - ame…
Browse files Browse the repository at this point in the history
…ndment
  • Loading branch information
MikeyJC committed Sep 14, 2016
1 parent 5bd38f3 commit 0d90963
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 10 deletions.
52 changes: 46 additions & 6 deletions include/Smarty/plugins/function.checkTargetModuleAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,50 @@
* Time: 11:15
*/

function smarty_function_checkTargetModuleAccess ($params, &$smarty)
{
if(ACLController::checkAccess($GLOBALS['FOCUS']->report_module, 'list', true))
{$smarty->assign('access', 'true');}
else
{$smarty->assign('access', 'false');}
/**
*
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2016 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address [email protected].
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
*/

function smarty_function_checkTargetModuleAccess ($params, &$smarty) {
if(ACLController::checkAccess($GLOBALS['FOCUS']->report_module, 'list', true)) {
$smarty->assign('access', 'true');
}
else {
$smarty->assign('access', 'false');
}
}
3 changes: 1 addition & 2 deletions modules/AOR_Reports/AOR_Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -976,8 +976,7 @@ function build_report_query($group_value ='', $extra = array()){
$query_array = array();

//Check if the user has access to the target module
if(!(ACLController::checkAccess($this->report_module, 'list', true)))
{
if(!(ACLController::checkAccess($this->report_module, 'list', true))) {
return false;
}

Expand Down
3 changes: 1 addition & 2 deletions modules/AOW_WorkFlow/aow_utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ function getModuleFields($module, $view='EditView',$value = '', $valid = array()
if(isset($beanList[$module]) && $beanList[$module]){
$mod = new $beanList[$module]();
foreach($mod->field_defs as $name => $arr){
if(ACLController::checkAccess($mod->module_dir, 'list', true))
{
if(ACLController::checkAccess($mod->module_dir, 'list', true)) {
if($arr['type'] != 'link' &&((!isset($arr['source']) || $arr['source'] != 'non-db') || ($arr['type'] == 'relate' && isset($arr['id_name']))) && (empty($valid) || in_array($arr['type'], $valid)) && $name != 'currency_name' && $name != 'currency_symbol'){
if(isset($arr['vname']) && $arr['vname'] != ''){
$fields[$name] = rtrim(translate($arr['vname'],$mod->module_dir), ':');
Expand Down

0 comments on commit 0d90963

Please sign in to comment.