-
-
Notifications
You must be signed in to change notification settings - Fork 66
Description
Deprecation: #108568 - BackendUserAuthentication::recordEditAccessInternals() and $errorMsg
Deprecation: #108568 - BackendUserAuthentication::recordEditAccessInternals() and $errorMsg
See 108568
Description
The method
\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::recordEditAccessInternals()
and the property
\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::$errorMsg
have been deprecated.
These methods and properties represented an anti-pattern where the
method returned a boolean value but communicated error details through a
class property, making the API difficult to use and test.
A new method checkRecordEditAccess() has been introduced that returns
an \TYPO3\CMS\Core\Authentication\AccessCheckResult value object
containing both the access decision and any error message.
Impact
Calling the deprecated method recordEditAccessInternals() or accessing
the deprecated property $errorMsg will trigger a deprecation-level log
entry and will stop working in TYPO3 v15.0.
The extension scanner reports usages as a strong match.
Affected installations
Instances or extensions that directly call recordEditAccessInternals()
or access the $errorMsg property are affected.
Migration
Replace calls to recordEditAccessInternals() with
checkRecordEditAccess(). The new method returns an AccessCheckResult
object with two public properties:
isAllowed- boolean indicating if access is grantederrorMessage- string containing the error message (empty if access
is allowed)
Before
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
$backendUser = $this->getBackendUser();
if ($backendUser->recordEditAccessInternals($table, $record)) {
// Access granted
} else {
// Access denied, error message is in $backendUser->errorMsg
$errorMessage = $backendUser->errorMsg;
}After
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
$backendUser = $this->getBackendUser();
$accessResult = $backendUser->checkRecordEditAccess($table, $record);
if ($accessResult->isAllowed) {
// Access granted
} else {
// Access denied
$errorMessage = $accessResult->errorMessage;
}PHP-API, FullyScanned, ext:core