Made allowed_actions case insensitive

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@62213 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2008-09-11 00:15:31 +00:00
parent 62414fdfa6
commit f7806129f5
2 changed files with 19 additions and 0 deletions

View File

@ -165,6 +165,11 @@ class RequestHandlingData extends ViewableData {
if($action == 'index') return true; if($action == 'index') return true;
// Make checkAccessAction case-insensitive
$action = strtolower($action);
foreach($access as $k => $v) $newAccess[strtolower($k)] = strtolower($v);
$access = $newAccess;
if(isset($access[$action])) { if(isset($access[$action])) {
$test = $access[$action]; $test = $access[$action];
if($test === true) return true; if($test === true) return true;

View File

@ -115,6 +115,13 @@ class RequestHandlingTest_Form extends Form {
"GET " => "handleGet", "GET " => "handleGet",
); );
// These are a different case from those in url_handlers to confirm that it's all case-insensitive
static $allowed_actions = array(
'handlesubmission',
'handlefield',
'handleget',
);
function handleField($request) { function handleField($request) {
return $this->dataFieldByName($request->param('FieldName')); return $this->dataFieldByName($request->param('FieldName'));
} }
@ -139,6 +146,13 @@ class RequestHandlingTest_FormField extends FormField {
'$Action' => '$Action', '$Action' => '$Action',
); );
// These contain uppercase letters to test that allowed_actions doesn't need to be all lowercase
static $allowed_actions = array(
'TEST',
'handleField',
'handleInPLACEEDIT',
);
function test() { function test() {
return "Test method on $this->name"; return "Test method on $this->name";
} }