2016-10-14 03:30:05 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Control\Tests\RequestHandlingTest;
|
|
|
|
|
|
|
|
use SilverStripe\Control\Controller;
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Controller for the test
|
|
|
|
*/
|
|
|
|
class AllowedController extends Controller implements TestOnly
|
|
|
|
{
|
2017-03-02 03:24:38 +01:00
|
|
|
private static $url_segment = 'AllowedController';
|
|
|
|
|
2020-04-20 19:58:09 +02:00
|
|
|
private static $url_handlers = [
|
2016-12-16 05:34:21 +01:00
|
|
|
// The double-slash is need here to ensure that
|
|
|
|
'$Action//$ID/$OtherID' => "handleAction",
|
2020-04-20 19:58:09 +02:00
|
|
|
];
|
2016-12-16 05:34:21 +01:00
|
|
|
|
2020-04-20 19:58:09 +02:00
|
|
|
private static $allowed_actions = [
|
2016-12-16 05:34:21 +01:00
|
|
|
'failoverMethod', // part of the failover object
|
|
|
|
'blockMethod' => '->provideAccess(false)',
|
|
|
|
'allowMethod' => '->provideAccess',
|
2020-04-20 19:58:09 +02:00
|
|
|
];
|
2016-12-16 05:34:21 +01:00
|
|
|
|
2020-04-20 19:58:09 +02:00
|
|
|
private static $extensions = [
|
2016-12-16 05:34:21 +01:00
|
|
|
ControllerExtension::class,
|
|
|
|
AllowedControllerExtension::class,
|
2020-04-20 19:58:09 +02:00
|
|
|
];
|
2016-12-16 05:34:21 +01:00
|
|
|
|
|
|
|
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';
|
|
|
|
}
|
2016-10-14 03:30:05 +02:00
|
|
|
}
|