Permalink
Browse files

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
  • Loading branch information...
1 parent d8a8635 commit 2d82ae621732f25487deeb75b6f07e6d524d47d8 @sminnee sminnee committed Oct 19, 2010
Showing with 6 additions and 0 deletions.
  1. +2 −0 forms/ComplexTableField.php
  2. +4 −0 tests/forms/ComplexTableFieldTest.php
@@ -1060,6 +1060,8 @@ function __construct($controller, $name, $fields, $validator, $readonly, $dataOb
}
parent::__construct($controller, $name, $fields, $actions, $validator);
+
+ if(!$this->dataObject->canEdit()) $this->makeReadonly();
}
function forTemplate() {
@@ -38,6 +38,8 @@ function testCorrectNumberOfRowsInTable() {
}
function testAddingManyManyNewPlayer() {
+ $this->logInWithPermission('ADMIN');
+
$team = DataObject::get_one('ComplexTableFieldTest_Team', "\"Name\" = 'The Awesome People'");
$this->post('ComplexTableFieldTest_Controller/ManyManyForm/field/Players/AddForm', array(
@@ -57,6 +59,8 @@ function testAddingManyManyNewPlayer() {
}
function testAddingHasManyData() {
+ $this->logInWithPermission('ADMIN');
+
$team = DataObject::get_one('ComplexTableFieldTest_Team', "\"Name\" = 'The Awesome People'");
$this->post('ComplexTableFieldTest_Controller/HasManyForm/field/Sponsors/AddForm', array(

0 comments on commit 2d82ae6

Please sign in to comment.