I agree with @aleifuuwork, this feature is desirable. I have modified the relevant files to hide reports menus that are not authorized.
In reporting/includes/reports_classes.inc file:
Change report Class to include $access variable like this:
class Report
{
var $id;
var $name;
var $ar_params;
var $controls;
var $access;
function __construct($id, $name, $ar_params = null, $access = null)
{
$this->id = $id;
$this->name = $name;
if ($ar_params) $this->set_controls($ar_params);
$this->access = $access;
}
function set_controls($ar_params) {
$this->controls = $ar_params;
}
function get_controls() {
return $this->controls;
}
}
In reports_classes.inc file line 83 getDisplay function, add:
if($report->access != null && !$_SESSION["wa_current_user"]->can_access($report->access) && $_SESSION["wa_current_user"]->hide_inaccessible_menu_items())
continue;
Finally modify each $reports->addReport call in reporting/reports_main.php to include the $access variable.
e.g Customer Balances report:
$reports->addReport(RC_CUSTOMER, 101, _('Customer &Balances'),
array( _('Start Date') => 'DATEBEGIN',
_('End Date') => 'DATEENDM',
_('Customer') => 'CUSTOMERS_NO_FILTER',
_('Show Balance') => 'YES_NO',
_('Currency Filter') => 'CURRENCY',
_('Suppress Zeros') => 'YES_NO',
_('Comments') => 'TEXTBOX',
_('Orientation') => 'ORIENTATION',
_('Destination') => 'DESTINATION'),'SA_CUSTPAYMREP');
Edited, Also modify addReport() function in reports_classes.inc file like this:
function addReport($class, $id, $rep_name, $params=null,$access=null)
{
unset($this->ar_reports[$class][$id]); // unset std report if any
$this->ar_reports[$class][$id] = new Report($id, $rep_name, $params, $access);
}
This solution will allow for backward compatibility especially for extensions that implement reports.
If this solution is acceptable to the core, I will modify the whole reports_main.php file to affect all reports.