[TASK] Deprecate PageRepository->checkWorkspaceAccess 93/57593/7
authorBenni Mack <benni@typo3.org>
Fri, 13 Jul 2018 19:43:27 +0000 (21:43 +0200)
committerJigal van Hemert <jigal.van.hemert@typo3.org>
Sat, 21 Jul 2018 16:36:38 +0000 (18:36 +0200)
An unused if() statement removes the last occurrence
of this method, so it can be deprecated.

Resolves: #85554
Releases: master
Change-Id: Ica80f66f7fdce4d72c8d97d0405360c307ca14dd
Reviewed-on: https://review.typo3.org/57593
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
typo3/sysext/core/Documentation/Changelog/master/Deprecation-85554-PageRepository-checkWorkspaceAccess.rst [new file with mode: 0644]
typo3/sysext/frontend/Classes/Page/PageRepository.php
typo3/sysext/install/Configuration/ExtensionScanner/Php/MethodCallMatcher.php

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85554-PageRepository-checkWorkspaceAccess.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-85554-PageRepository-checkWorkspaceAccess.rst
new file mode 100644 (file)
index 0000000..983f48f
--- /dev/null
@@ -0,0 +1,33 @@
+.. include:: ../../Includes.txt
+
+==========================================================
+Deprecation: #85554 - PageRepository->checkWorkspaceAccess
+==========================================================
+
+See :issue:`85554`
+
+Description
+===========
+
+The unused method :php:`TYPO3\CMS\Frontend\Page\PageRepository->checkWorkspaceAccess()` has been marked as
+deprecated.
+
+
+Impact
+======
+
+Calling the method directly will trigger a deprecation message.
+
+
+Affected Installations
+======================
+
+TYPO3 installations with custom extensions calling this public method directly.
+
+
+Migration
+=========
+
+Implement the check on :php:`BE_USER->checkWorkspace($workspaceId)` directly in the callers' code.
+
+.. index:: Frontend, PHP-API, FullyScanned, ext:frontend
\ No newline at end of file
index c187a14..1a94990 100644 (file)
@@ -1654,7 +1654,7 @@ class PageRepository implements LoggerAwareInterface
             }
             // If workspace ids matches and ID of current online version is found, look up
             // the PID value of that:
-            if ($oid && ((int)$this->versioningWorkspaceId === 0 && $this->checkWorkspaceAccess($wsid) || (int)$wsid === (int)$this->versioningWorkspaceId)) {
+            if ($oid && (int)$wsid === (int)$this->versioningWorkspaceId) {
                 $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable($table);
                 $queryBuilder->getRestrictions()
                     ->removeAll()
@@ -1970,9 +1970,11 @@ class PageRepository implements LoggerAwareInterface
      *
      * @param int $wsid Workspace ID
      * @return bool true if the backend user has access to a certain workspace
+     * @deprecated since TYPO3 v9.4, will be removed in TYPO3 v10.0. Use $BE_USER->checkWorkspace() directly if necessary.
      */
     public function checkWorkspaceAccess($wsid)
     {
+        trigger_error('PageRepository->checkWorkspaceAccess() will be removed in TYPO3 v10.0.', E_USER_DEPRECATED);
         if (!$this->getBackendUser() || !ExtensionManagementUtility::isLoaded('workspaces')) {
             return false;
         }
@@ -2055,6 +2057,7 @@ class PageRepository implements LoggerAwareInterface
      * Returns the current BE user.
      *
      * @return \TYPO3\CMS\Core\Authentication\BackendUserAuthentication
+     * @deprecated will be removed in TYPO3 v10.0 as will not be used anymore then because checkWorkspaceAccess() will be removed.
      */
     protected function getBackendUser()
     {
index c612d84..783d651 100644 (file)
@@ -2445,7 +2445,7 @@ return [
             'Deprecation-85558-ContentObjectRenderer-enableFields.rst'
         ],
     ],
-    'TYPO3\CMS\Scheduler\Classes\Controller\SchedulerModuleController->addMessage' => [
+    'TYPO3\CMS\Scheduler\Controller\SchedulerModuleController->addMessage' => [
         'numberOfMandatoryArguments' => 1,
         'maximumNumberOfArguments' => 2,
         'restFiles' => [
@@ -2473,4 +2473,11 @@ return [
             'Deprecation-65578-ConfigconcatenateJsAndCssAndConcatenateFiles.rst',
         ],
     ],
+    'TYPO3\CMS\Frontend\Page\PageRepository->checkWorkspaceAccess' => [
+        'numberOfMandatoryArguments' => 1,
+        'maximumNumberOfArguments' => 1,
+        'restFiles' => [
+            'Deprecation-85554-PageRepository-checkWorkspaceAccess.rst',
+        ],
+    ],
 ];