Skip to content

Commit

Permalink
[SS-2016-012] FIX Missing ACL check on ReportAdmin
Browse files Browse the repository at this point in the history
This issue exposed reports to users able to guess the URL of a Report that they were not allowed to view the report
  • Loading branch information
dhensby authored and Damian Mooyman committed Aug 15, 2016
1 parent f17fad1 commit c1525c8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions code/ReportAdmin.php
Expand Up @@ -34,10 +34,12 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider {
*/
protected $reportClass;

/**
* @var SS_Report
*/
protected $reportObject;

public function init() {
parent::init();

//set the report we are currently viewing from the URL
$this->reportClass = (isset($this->urlParams['ReportClass']) && $this->urlParams['ReportClass'] !== 'index')
Expand All @@ -46,6 +48,8 @@ public function init() {
$allReports = SS_Report::get_reports();
$this->reportObject = (isset($allReports[$this->reportClass])) ? $allReports[$this->reportClass] : null;

parent::init();

// Set custom options for TinyMCE specific to ReportAdmin
HtmlEditorConfig::get('cms')->setOption('content_css', project() . '/css/editor.css');
HtmlEditorConfig::get('cms')->setOption('Lang', i18n::get_tinymce_lang());
Expand All @@ -69,7 +73,8 @@ public function canView($member = null) {

if(!parent::canView($member)) return false;

$hasViewableSubclasses = false;
if ($this->reportObject) return $this->reportObject->canView($member);

foreach($this->Reports() as $report) {
if($report->canView($member)) return true;
}
Expand Down

0 comments on commit c1525c8

Please sign in to comment.