Merge remote branch 'cbarberis/master'

This commit is contained in:
Sam Minnee 2011-02-14 16:34:02 +13:00
commit 8d05811734
21 changed files with 108 additions and 14 deletions

View File

@ -123,6 +123,10 @@ class RestfulServer extends Controller {
*/ */
protected $member; protected $member;
static $allowed_actions = array(
'index'
);
/* /*
function handleItem($request) { function handleItem($request) {
return new RestfulServer_Item(DataObject::get_by_id($request->param("ClassName"), $request->param("ID"))); return new RestfulServer_Item(DataObject::get_by_id($request->param("ClassName"), $request->param("ID")));

View File

@ -26,6 +26,11 @@ class SapphireSoapServer extends Controller {
'binary' => 'xsd:base64Binary', 'binary' => 'xsd:base64Binary',
); );
static $allowed_actions = array(
'index',
'wsdl'
);
function wsdl() { function wsdl() {
$this->getResponse()->addHeader("Content-Type", "text/xml"); $this->getResponse()->addHeader("Content-Type", "text/xml");

View File

@ -6,6 +6,11 @@
* @subpackage integration * @subpackage integration
*/ */
class VersionedRestfulServer extends Controller { class VersionedRestfulServer extends Controller {
static $allowed_actions = array(
'index'
);
function handleRequest($request) { function handleRequest($request) {
Versioned::reading_stage('Live'); Versioned::reading_stage('Live');
$restfulserver = new RestfulServer(); $restfulserver = new RestfulServer();

View File

@ -11,6 +11,10 @@
*/ */
abstract class CliController extends Controller { abstract class CliController extends Controller {
static $allowed_actions = array(
'index'
);
function init() { function init() {
parent::init(); parent::init();
// Unless called from the command line, all CliControllers need ADMIN privileges // Unless called from the command line, all CliControllers need ADMIN privileges

View File

@ -7,11 +7,17 @@
*/ */
class CodeViewer extends Controller { class CodeViewer extends Controller {
public static $url_handlers = array ( public static $url_handlers = array(
'' => 'browse', '' => 'browse',
'$Class' => 'viewClass' '$Class' => 'viewClass'
); );
static $allowed_actions = array(
'index',
'browse',
'viewClass'
);
/** /**
* Define a simple finite state machine. * Define a simple finite state machine.
* Top keys are the state names. 'start' is the first state, and 'die' is the error state. * Top keys are the state names. 'start' is the first state, and 'die' is the error state.

View File

@ -17,6 +17,17 @@ class DevelopmentAdmin extends Controller {
'$Action//$Action/$ID' => 'handleAction', '$Action//$Action/$ID' => 'handleAction',
); );
static $allowed_actions = array(
'index',
'tests',
'jstests',
'tasks',
'viewmodel',
'build',
'reset',
'viewcode'
);
function init() { function init() {
parent::init(); parent::init();

View File

@ -6,6 +6,10 @@
*/ */
class InstallerTest extends Controller { class InstallerTest extends Controller {
static $allowed_actions = array(
'testrewrite'
);
function testrewrite() { function testrewrite() {
echo "OK"; echo "OK";
} }

View File

@ -42,6 +42,13 @@ class JSTestRunner extends Controller {
'$TestCase' => 'only', '$TestCase' => 'only',
); );
static $allowed_actions = array(
'index',
'all',
'browse',
'only'
);
/** /**
* Override the default reporter with a custom configured subclass. * Override the default reporter with a custom configured subclass.
* *

View File

@ -24,6 +24,10 @@ define('30719',E_ALL);
*/ */
class SapphireREPL extends Controller { class SapphireREPL extends Controller {
static $allowed_actions = array(
'index'
);
public function error_handler( $errno, $errstr, $errfile, $errline, $errctx ) { public function error_handler( $errno, $errstr, $errfile, $errline, $errctx ) {
// Ignore unless important error // Ignore unless important error
if ( ($errno & ~( 2048 | 8192 | 16384 )) == 0 ) return ; if ( ($errno & ~( 2048 | 8192 | 16384 )) == 0 ) return ;

View File

@ -10,6 +10,10 @@ class TaskRunner extends Controller {
'$TaskName' => 'runTask' '$TaskName' => 'runTask'
); );
static $allowed_actions = array(
'index'
);
function init() { function init() {
parent::init(); parent::init();

View File

@ -40,6 +40,21 @@ class TestRunner extends Controller {
'$TestCase' => 'only', '$TestCase' => 'only',
); );
static $allowed_actions = array(
'index',
'browse',
'coverage',
'startsession',
'endsession',
'cleanupdb',
'module',
'all',
'build',
'only'
);
/** /**
* @var Array Blacklist certain directories for the coverage report. * @var Array Blacklist certain directories for the coverage report.
* Filepaths are relative to the webroot, without leading slash. * Filepaths are relative to the webroot, without leading slash.

View File

@ -616,6 +616,10 @@ class Email extends ViewableData {
*/ */
class Email_BounceHandler extends Controller { class Email_BounceHandler extends Controller {
static $allowed_actions = array(
'index'
);
function init() { function init() {
BasicAuth::protect_entire_site(false); BasicAuth::protect_entire_site(false);
parent::init(); parent::init();

View File

@ -21,6 +21,11 @@
*/ */
class Upload extends Controller { class Upload extends Controller {
static $allowed_actions = array(
'index',
'load'
);
/** /**
* A File object * A File object
* @var File * @var File

View File

@ -6,6 +6,18 @@
*/ */
class Security extends Controller { class Security extends Controller {
static $allowed_actions = array(
'index',
'login',
'logout',
'basicauthlogin',
'lostpassword',
'passwordsent',
'changepassword',
'ping',
'LoginForm'
);
/** /**
* Default user name. Only used in dev-mode by {@link setDefaultAdmin()} * Default user name. Only used in dev-mode by {@link setDefaultAdmin()}
* *

View File

@ -139,7 +139,7 @@ class ControllerTest extends FunctionalTest {
/** /**
* Simple controller for testing * Simple controller for testing
*/ */
class ControllerTest_Controller extends Controller { class ControllerTest_Controller extends Controller implements TestOnly {
public $Content = "default content"; public $Content = "default content";
function methodaction() { function methodaction() {
@ -156,7 +156,7 @@ class ControllerTest_Controller extends Controller {
/** /**
* Controller with an $allowed_actions value * Controller with an $allowed_actions value
*/ */
class ControllerTest_SecuredController extends Controller { class ControllerTest_SecuredController extends Controller implements TestOnly {
static $allowed_actions = array( static $allowed_actions = array(
"methodaction", "methodaction",
"adminonly" => "ADMIN", "adminonly" => "ADMIN",
@ -179,7 +179,7 @@ class ControllerTest_SecuredController extends Controller {
} }
} }
class ControllerTest_FullSecuredController extends Controller { class ControllerTest_FullSecuredController extends Controller implements TestOnly {
static $allowed_actions = array( static $allowed_actions = array(
"*" => "ADMIN", "*" => "ADMIN",
@ -195,7 +195,7 @@ class ControllerTest_FullSecuredController extends Controller {
} }
} }
class ControllerTest_UnsecuredController extends ControllerTest_SecuredController {} class ControllerTest_UnsecuredController extends ControllerTest_SecuredController implements TestOnly {}
class ControllerTest_HasAction extends Controller { class ControllerTest_HasAction extends Controller {
@ -210,7 +210,7 @@ class ControllerTest_HasAction extends Controller {
} }
class ControllerTest_HasAction_Unsecured extends ControllerTest_HasAction { class ControllerTest_HasAction_Unsecured extends ControllerTest_HasAction implements TestOnly {
public function defined_action() { } public function defined_action() { }

View File

@ -265,7 +265,7 @@ Director::addRules(50, array(
/** /**
* Controller for the test * Controller for the test
*/ */
class RequestHandlingTest_Controller extends Controller { class RequestHandlingTest_Controller extends Controller implements TestOnly {
static $url_handlers = array( static $url_handlers = array(
// The double-slash is need here to ensure that // The double-slash is need here to ensure that
'$Action//$ID/$OtherID' => "handleAction", '$Action//$ID/$OtherID' => "handleAction",
@ -383,7 +383,7 @@ class RequestHandlingTest_ControllerExtension extends Extension {
/** /**
* Controller for the test * Controller for the test
*/ */
class RequestHandlingTest_AllowedController extends Controller { class RequestHandlingTest_AllowedController extends Controller implements TestOnly {
static $url_handlers = array( static $url_handlers = array(
// The double-slash is need here to ensure that // The double-slash is need here to ensure that
'$Action//$ID/$OtherID' => "handleAction", '$Action//$ID/$OtherID' => "handleAction",
@ -458,7 +458,7 @@ class RequestHandlingTest_Form extends Form {
} }
} }
class RequestHandlingTest_ControllerFormWithAllowedActions extends Controller { class RequestHandlingTest_ControllerFormWithAllowedActions extends Controller implements TestOnly {
function Form() { function Form() {
return new RequestHandlingTest_FormWithAllowedActions( return new RequestHandlingTest_FormWithAllowedActions(

View File

@ -37,7 +37,7 @@ class WebserverRoutingTest extends SapphireTest {
* @package sapphire * @package sapphire
* @subpackage tests * @subpackage tests
*/ */
class WebserverRoutingTest_Controller extends Controller { class WebserverRoutingTest_Controller extends Controller implements TestOnly {
function index() { function index() {
BasicAuth::protect_entire_site(false); BasicAuth::protect_entire_site(false);

View File

@ -134,7 +134,7 @@ class RestfulServiceTest extends SapphireTest {
} }
} }
class RestfulServiceTest_Controller extends Controller { class RestfulServiceTest_Controller extends Controller implements TestOnly {
public function init() { public function init() {
$this->basicAuthEnabled = false; $this->basicAuthEnabled = false;
parent::init(); parent::init();

View File

@ -368,7 +368,7 @@ class FormTest_Team extends DataObject implements TestOnly {
); );
} }
class FormTest_Controller extends Controller { class FormTest_Controller extends Controller implements TestOnly {
static $url_handlers = array( static $url_handlers = array(
'$Action//$ID/$OtherID' => "handleAction", '$Action//$ID/$OtherID' => "handleAction",
); );
@ -424,7 +424,7 @@ class FormTest_Controller extends Controller {
} }
} }
class FormTest_ControllerWithSecurityToken extends Controller { class FormTest_ControllerWithSecurityToken extends Controller implements TestOnly {
static $url_handlers = array( static $url_handlers = array(
'$Action//$ID/$OtherID' => "handleAction", '$Action//$ID/$OtherID' => "handleAction",
); );

View File

@ -288,7 +288,7 @@ class TableFieldTest extends SapphireTest {
/** /**
* Stub controller * Stub controller
*/ */
class TableFieldTest_Controller extends Controller { class TableFieldTest_Controller extends Controller implements TestOnly {
function Link($action = null) { function Link($action = null) {
return Controller::join_links('TableFieldTest/', $action); return Controller::join_links('TableFieldTest/', $action);
} }

View File

@ -150,6 +150,10 @@ class Widget_Controller extends Controller {
*/ */
protected $widget; protected $widget;
static $allowed_actions = array(
'editablesegment'
);
function __construct($widget = null) { function __construct($widget = null) {
// TODO This shouldn't be optional, is only necessary for editablesegment() // TODO This shouldn't be optional, is only necessary for editablesegment()
if($widget) { if($widget) {