Issue Bug Closed

#68545Logical mistake in checkFileActionPermission?

Hannes Gesmann 07/27/15, 10:24 updated 02/26/16, 16:17

Description

Hey there,

I am a bit confused about a check in method RecourceStorage->checkFileActionPermission.
File: sysext/core/Classes/Resource/ResourceStorage.php

It says (TYPO3 Version 6.2.14), line 606ff.:

// Check 4: Check the capabilities of the storage (and the driver)
if ($isWriteCheck && ($isMissing || !$this->isWritable())) {
    return FALSE;
}

In human readable language:
IF (a write action is required AND (the file does not exists OR the storage is not writable)), THEN the required permissions are not granted.

So this check returns FALSE as soon as the file is missing – also in case that the storage IS writable…

From my point of view the code should be adopted like this:

// Check 4: Check the capabilities of the storage (and the driver)
if ($isWriteCheck && $isMissing && !$this->isWritable()) {
    return FALSE;
}

Am I wrong?
Feedback wanted. :)

P.S: Why is $isMissing checked anyway?

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.