mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-09-11 20:21:34 +02:00
API Add HasRequestHandler interface API Refactor Link() and url handling behaviour from Controller into RequestHandler API RequestHandler classes now must define url_segment to have a default Link() API Clean up redirectBack()
57 lines
1.2 KiB
PHP
57 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace SilverStripe\Control\Tests\RequestHandlingTest;
|
|
|
|
use SilverStripe\Control\Controller;
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
/**
|
|
* Controller for the test
|
|
*/
|
|
class AllowedController extends Controller implements TestOnly
|
|
{
|
|
private static $url_segment = 'AllowedController';
|
|
|
|
private static $url_handlers = array(
|
|
// The double-slash is need here to ensure that
|
|
'$Action//$ID/$OtherID' => "handleAction",
|
|
);
|
|
|
|
private static $allowed_actions = array(
|
|
'failoverMethod', // part of the failover object
|
|
'blockMethod' => '->provideAccess(false)',
|
|
'allowMethod' => '->provideAccess',
|
|
);
|
|
|
|
private static $extensions = array(
|
|
ControllerExtension::class,
|
|
AllowedControllerExtension::class,
|
|
);
|
|
|
|
public function __construct()
|
|
{
|
|
$this->failover = new ControllerFailover();
|
|
parent::__construct();
|
|
}
|
|
|
|
public function index($request)
|
|
{
|
|
return "This is the controller";
|
|
}
|
|
|
|
function provideAccess($access = true)
|
|
{
|
|
return $access;
|
|
}
|
|
|
|
function blockMethod($request)
|
|
{
|
|
return 'blockMethod';
|
|
}
|
|
|
|
function allowMethod($request)
|
|
{
|
|
return 'allowMethod';
|
|
}
|
|
}
|