mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #3576 from tractorcow/pulls/3.1/upload-attach
BUG File attach handler is no longer accessible if attachment is disallowed or disabled
This commit is contained in:
commit
2176a6dea8
@ -1089,6 +1089,7 @@ class UploadField extends FileField {
|
||||
* @return UploadField_ItemHandler
|
||||
*/
|
||||
public function handleSelect(SS_HTTPRequest $request) {
|
||||
if(!$this->canAttachExisting()) return $this->httpError(403);
|
||||
return UploadField_SelectHandler::create($this, $this->getFolderName());
|
||||
}
|
||||
|
||||
|
@ -621,6 +621,12 @@ class UploadFieldTest extends FunctionalTest {
|
||||
(bool)$parser->getBySelector('#CanAttachExistingFalseField .ss-uploadfield-fromfiles'),
|
||||
'Removes "From files" button'
|
||||
);
|
||||
|
||||
// Test requests to select files have the correct given permission
|
||||
$response2 = $this->get('UploadFieldTest_Controller/Form/field/CanAttachExistingFalseField/select');
|
||||
$this->assertEquals(403, $response2->getStatusCode());
|
||||
$response3 = $this->get('UploadFieldTest_Controller/Form/field/HasOneFile/select');
|
||||
$this->assertEquals(200, $response3->getStatusCode());
|
||||
}
|
||||
|
||||
public function testSelect() {
|
||||
|
Loading…
Reference in New Issue
Block a user