mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
API Fix issue with namespaced reports
Add permission code to reports Fix include paths
This commit is contained in:
parent
a325bfb222
commit
a96ab15af3
@ -154,11 +154,21 @@ class SS_Report extends ViewableData
|
|||||||
{
|
{
|
||||||
return Controller::join_links(
|
return Controller::join_links(
|
||||||
ReportAdmin::singleton()->Link('show'),
|
ReportAdmin::singleton()->Link('show'),
|
||||||
get_class($this),
|
$this->sanitiseClassName(get_class($this)),
|
||||||
$action
|
$action
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sanitise a model class' name for inclusion in a link
|
||||||
|
*
|
||||||
|
* @param string $class
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function sanitiseClassName($class) {
|
||||||
|
return str_replace('\\', '-', $class);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* counts the number of objects returned
|
* counts the number of objects returned
|
||||||
|
@ -44,6 +44,8 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider
|
|||||||
*/
|
*/
|
||||||
protected $reportObject;
|
protected $reportObject;
|
||||||
|
|
||||||
|
private static $required_permission_codes = 'CMS_ACCESS_ReportAdmin';
|
||||||
|
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
parent::init();
|
parent::init();
|
||||||
@ -105,7 +107,7 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider
|
|||||||
|
|
||||||
public function handleAction($request, $action)
|
public function handleAction($request, $action)
|
||||||
{
|
{
|
||||||
$this->reportClass = $request->param('ReportClass');
|
$this->reportClass = $this->unsanitiseClassName($request->param('ReportClass'));
|
||||||
|
|
||||||
// Check report
|
// Check report
|
||||||
if ($this->reportClass) {
|
if ($this->reportClass) {
|
||||||
@ -120,6 +122,16 @@ class ReportAdmin extends LeftAndMain implements PermissionProvider
|
|||||||
return parent::handleAction($request, $action);
|
return parent::handleAction($request, $action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Unsanitise a model class' name from a URL param
|
||||||
|
*
|
||||||
|
* @param string $class
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
protected function unsanitiseClassName($class) {
|
||||||
|
return str_replace('-', '\\', $class);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if we have reports and need
|
* Determine if we have reports and need
|
||||||
* to display the "Reports" main menu item
|
* to display the "Reports" main menu item
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
<div class="cms-content-header north">
|
<div class="cms-content-header north">
|
||||||
<% with $EditForm %>
|
<% with $EditForm %>
|
||||||
<div class="cms-content-header-info">
|
<div class="cms-content-header-info">
|
||||||
<% include BackLink_Button %>
|
<% include SilverStripe\\Admin\\BackLink_Button %>
|
||||||
<% with $Controller %>
|
<% with $Controller %>
|
||||||
<% include CMSBreadcrumbs %>
|
<% include SilverStripe\\Admin\\CMSBreadcrumbs %>
|
||||||
<% end_with %>
|
<% end_with %>
|
||||||
</div>
|
</div>
|
||||||
<% end_with %>
|
<% end_with %>
|
||||||
|
Loading…
Reference in New Issue
Block a user