BUGFIX Enforcing canEdit() checks in ComplexTableField_Popup - making form readonly if the current user can't edit (from r110857)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@112863 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2010-10-19 03:00:45 +00:00
parent d8a8635374
commit 2d82ae6217
2 changed files with 6 additions and 0 deletions

View File

@ -1060,6 +1060,8 @@ class ComplexTableField_Popup extends Form {
} }
parent::__construct($controller, $name, $fields, $actions, $validator); parent::__construct($controller, $name, $fields, $actions, $validator);
if(!$this->dataObject->canEdit()) $this->makeReadonly();
} }
function forTemplate() { function forTemplate() {

View File

@ -38,6 +38,8 @@ class ComplexTableFieldTest extends FunctionalTest {
} }
function testAddingManyManyNewPlayer() { function testAddingManyManyNewPlayer() {
$this->logInWithPermission('ADMIN');
$team = DataObject::get_one('ComplexTableFieldTest_Team', "\"Name\" = 'The Awesome People'"); $team = DataObject::get_one('ComplexTableFieldTest_Team', "\"Name\" = 'The Awesome People'");
$this->post('ComplexTableFieldTest_Controller/ManyManyForm/field/Players/AddForm', array( $this->post('ComplexTableFieldTest_Controller/ManyManyForm/field/Players/AddForm', array(
@ -57,6 +59,8 @@ class ComplexTableFieldTest extends FunctionalTest {
} }
function testAddingHasManyData() { function testAddingHasManyData() {
$this->logInWithPermission('ADMIN');
$team = DataObject::get_one('ComplexTableFieldTest_Team', "\"Name\" = 'The Awesome People'"); $team = DataObject::get_one('ComplexTableFieldTest_Team', "\"Name\" = 'The Awesome People'");
$this->post('ComplexTableFieldTest_Controller/HasManyForm/field/Sponsors/AddForm', array( $this->post('ComplexTableFieldTest_Controller/HasManyForm/field/Sponsors/AddForm', array(