From 66ad65a141b8779722dd80a9edffce61681ba4e4 Mon Sep 17 00:00:00 2001 From: catch <catch@35733.no-reply.drupal.org> Date: Tue, 26 Nov 2019 14:01:44 +0000 Subject: [PATCH] Issue #3093217 by amateescu, Wim Leers: Remove workflows.module BC layers --- .../src/WorkflowDeleteAccessCheck.php | 49 ------------------- ...ateTransitionOperationsAccessCheckTest.php | 30 ------------ core/modules/workflows/workflows.services.yml | 6 +-- 3 files changed, 1 insertion(+), 84 deletions(-) delete mode 100644 core/modules/workflows/src/WorkflowDeleteAccessCheck.php diff --git a/core/modules/workflows/src/WorkflowDeleteAccessCheck.php b/core/modules/workflows/src/WorkflowDeleteAccessCheck.php deleted file mode 100644 index a93e0eb37602..000000000000 --- a/core/modules/workflows/src/WorkflowDeleteAccessCheck.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - -namespace Drupal\workflows; - -use Drupal\Core\Routing\RouteMatchInterface; -use Drupal\Core\Session\AccountInterface; - -/** - * Provides a access checker for deleting a workflow state. - * - * @internal - * Marked as internal for use by the workflows module only. - * - * @deprecated - * Using the _workflow_state_delete_access check is deprecated in Drupal 8.6.0 - * and will be removed before Drupal 9.0.0, you can use _workflow_access in - * route definitions instead. - * @code - * # The old approach: - * requirements: - * _workflow_state_delete_access: 'true' - * # The new approach: - * requirements: - * _workflow_access: 'delete-state' - * @endcode - * As an internal API the ability to use _workflow_state_delete_access may - * also be removed in a minor release. - * - * @see \Drupal\workflows\WorkflowStateTransitionOperationsAccessCheck - * @see https://www.drupal.org/node/2929327 - */ -class WorkflowDeleteAccessCheck extends WorkflowStateTransitionOperationsAccessCheck { - - /** - * {@inheritdoc} - */ - public function access(RouteMatchInterface $route_match, AccountInterface $account) { - @trigger_error('Using the _workflow_state_delete_access check is deprecated in Drupal 8.6.0 and will be removed before Drupal 9.0.0, use _workflow_access instead. As an internal API _workflow_state_delete_access may also be removed in a minor release.', E_USER_DEPRECATED); - return parent::access($route_match, $account); - } - - /** - * {@inheritdoc} - */ - protected function getOperation(RouteMatchInterface $route_match) { - return 'delete-state'; - } - -} diff --git a/core/modules/workflows/tests/src/Unit/WorkflowStateTransitionOperationsAccessCheckTest.php b/core/modules/workflows/tests/src/Unit/WorkflowStateTransitionOperationsAccessCheckTest.php index d99390e26472..deb29bdf855c 100644 --- a/core/modules/workflows/tests/src/Unit/WorkflowStateTransitionOperationsAccessCheckTest.php +++ b/core/modules/workflows/tests/src/Unit/WorkflowStateTransitionOperationsAccessCheckTest.php @@ -6,7 +6,6 @@ use Drupal\Core\Routing\RouteMatch; use Drupal\Core\Session\AccountInterface; use Drupal\Tests\UnitTestCase; -use Drupal\workflows\WorkflowDeleteAccessCheck; use Drupal\workflows\WorkflowStateTransitionOperationsAccessCheck; use Drupal\workflows\WorkflowInterface; use Prophecy\Argument; @@ -147,33 +146,4 @@ public function invalidOperationNameTestCases() { ]; } - /** - * @covers \Drupal\workflows\WorkflowDeleteAccessCheck::access - * @expectedDeprecation Using the _workflow_state_delete_access check is deprecated in Drupal 8.6.0 and will be removed before Drupal 9.0.0, use _workflow_access instead. As an internal API _workflow_state_delete_access may also be removed in a minor release. - * @group legacy - */ - public function testLegacyWorkflowStateDeleteAccessCheck() { - $workflow_entity_access_result = AccessResult::allowed(); - - // When using the legacy access check, passing a route with a state called - // 'foo-state' will result in an entity access check of - // 'delete-state:foo-state'. - $workflow = $this->prophesize(WorkflowInterface::class); - $workflow->access('delete-state:foo-state', Argument::type(AccountInterface::class), TRUE) - ->shouldBeCalled() - ->willReturn($workflow_entity_access_result); - - $route = new Route('', [ - 'workflow' => NULL, - 'workflow_state' => NULL, - ], ['_workflow_state_delete_access' => 'true']); - $route_match = new RouteMatch(NULL, $route, [ - 'workflow' => $workflow->reveal(), - 'workflow_state' => 'foo-state', - ]); - - $access_check = new WorkflowDeleteAccessCheck(); - $this->assertEquals($workflow_entity_access_result, $access_check->access($route_match, $this->prophesize(AccountInterface::class)->reveal())); - } - } diff --git a/core/modules/workflows/workflows.services.yml b/core/modules/workflows/workflows.services.yml index c6e60afe0af2..ff4932763e92 100644 --- a/core/modules/workflows/workflows.services.yml +++ b/core/modules/workflows/workflows.services.yml @@ -5,10 +5,6 @@ services: tags: - { name: plugin_manager_cache_clear } workflows.access_check.extended_permissions: - class: \Drupal\workflows\WorkflowStateTransitionOperationsAccessCheck + class: Drupal\workflows\WorkflowStateTransitionOperationsAccessCheck tags: - { name: access_check, applies_to: _workflow_access } - workflows.access_check.delete_state: - class: \Drupal\workflows\WorkflowDeleteAccessCheck - tags: - - { name: access_check, applies_to: _workflow_state_delete_access } -- GitLab