[TASK] Add ResourceStorage getEvaluatePermissions() 90/28690/5
authorFrans Saris <franssaris@gmail.com>
Mon, 24 Mar 2014 08:16:41 +0000 (09:16 +0100)
committerFrans Saris <franssaris@gmail.com>
Mon, 24 Mar 2014 09:12:30 +0000 (10:12 +0100)
#51326 introduced a setEvaluatePermissions() method
to enable/disable permission checking in the
ResourceStorage. But a getter is missing so there
is no way to get the current setting.
This is needed if you only want to disable the
checks temporary and you do not know what the
current state is.

This changes adds a getter for the evaluatePermissions
value so you can fetch the current value.

Resolves: #57220
Releases: 6.2
Change-Id: I3fd22c112fb1f251b85d23fd8fa553091e3e3fc4
Reviewed-on: https://review.typo3.org/28690
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
Reviewed-by: Alexander Opitz
Tested-by: Alexander Opitz
Reviewed-by: Frans Saris
Tested-by: Frans Saris
typo3/sysext/core/Classes/Resource/ResourceStorage.php
typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php

index a232fcd..c55d317 100644 (file)
@@ -489,6 +489,9 @@ class ResourceStorage implements ResourceStorageInterface {
        }
 
        /**
+        * Sets whether the permissions to access or write
+        * into this storage should be checked or not.
+        *
         * @param boolean $evaluatePermissions
         */
        public function setEvaluatePermissions($evaluatePermissions) {
@@ -496,6 +499,16 @@ class ResourceStorage implements ResourceStorageInterface {
        }
 
        /**
+        * Gets whether the permissions to access or write
+        * into this storage should be checked or not.
+        *
+        * @return boolean $evaluatePermissions
+        */
+       public function getEvaluatePermissions() {
+               return $this->evaluatePermissions;
+       }
+
+       /**
         * Sets the user permissions of the storage
         *
         * @param array $userPermissions
index 26a50ea..c0ba9ae 100644 (file)
@@ -358,6 +358,24 @@ class ResourceStorageTest extends \TYPO3\CMS\Core\Tests\Unit\Resource\BaseTestCa
 
        /**
         * @test
+        */
+       public function getEvaluatePermissionsWhenSetFalse() {
+               $this->prepareFixture(array());
+               $this->fixture->setEvaluatePermissions(FALSE);
+               $this->assertFalse($this->fixture->getEvaluatePermissions());
+       }
+
+       /**
+        * @test
+        */
+       public function getEvaluatePermissionsWhenSetTrue() {
+               $this->prepareFixture(array());
+               $this->fixture->setEvaluatePermissions(TRUE);
+               $this->assertTrue($this->fixture->getEvaluatePermissions());
+       }
+
+       /**
+        * @test
         * @group integration
         * @TODO: Rewrite or move to functional suite
         */