diff --git a/core/lib/Drupal/Core/Action/ActionInterface.php b/core/lib/Drupal/Core/Action/ActionInterface.php index 4f1b98c..cbf826f 100644 --- a/core/lib/Drupal/Core/Action/ActionInterface.php +++ b/core/lib/Drupal/Core/Action/ActionInterface.php @@ -9,7 +9,6 @@ use Drupal\Component\Plugin\PluginInspectionInterface; use Drupal\Core\Executable\ExecutableInterface; -use Drupal\Core\Access\AccessibleInterface; use Drupal\Core\Session\AccountInterface; /** @@ -47,11 +46,8 @@ public function executeMultiple(array $objects); /** - * Checks data value access. + * Checks object access. * - * @param string $operation - * The operation to be performed. 'execute' for checking access whether the - * $account can execute the action on the particular $object. * @param mixed $object * The object to execute the action on. * @param \Drupal\Core\Session\AccountInterface $account @@ -67,6 +63,6 @@ public function executeMultiple(array $objects); * returned, i.e. TRUE means access is explicitly allowed, FALSE means * access is either explicitly forbidden or "no opinion". */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE); + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE); } diff --git a/core/modules/action/src/Plugin/Action/EmailAction.php b/core/modules/action/src/Plugin/Action/EmailAction.php index febcef4..d93152d 100644 --- a/core/modules/action/src/Plugin/Action/EmailAction.php +++ b/core/modules/action/src/Plugin/Action/EmailAction.php @@ -189,7 +189,7 @@ public function submitConfigurationForm(array &$form, FormStateInterface $form_s /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { $result = AccessResult::allowed(); return $return_as_object ? $result : $result->isAllowed(); } diff --git a/core/modules/action/src/Plugin/Action/GotoAction.php b/core/modules/action/src/Plugin/Action/GotoAction.php index 96d590d..c925c5c 100644 --- a/core/modules/action/src/Plugin/Action/GotoAction.php +++ b/core/modules/action/src/Plugin/Action/GotoAction.php @@ -118,7 +118,7 @@ public function submitConfigurationForm(array &$form, FormStateInterface $form_s /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { $result = AccessResult::allowed(); return $return_as_object ? $result : $result->isAllowed(); } diff --git a/core/modules/action/src/Plugin/Action/MessageAction.php b/core/modules/action/src/Plugin/Action/MessageAction.php index a1e980f..c87b606 100644 --- a/core/modules/action/src/Plugin/Action/MessageAction.php +++ b/core/modules/action/src/Plugin/Action/MessageAction.php @@ -94,7 +94,7 @@ public function submitConfigurationForm(array &$form, FormStateInterface $form_s /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { $result = AccessResult::allowed(); return $return_as_object ? $result : $result->isAllowed(); } diff --git a/core/modules/action/src/Tests/BulkFormTest.php b/core/modules/action/src/Tests/BulkFormTest.php index 0ceba4c..24a741c 100644 --- a/core/modules/action/src/Tests/BulkFormTest.php +++ b/core/modules/action/src/Tests/BulkFormTest.php @@ -63,8 +63,8 @@ public function testBulkForm() { $edit["node_bulk_form[$i]"] = TRUE; } - // Login as a user with 'administer nodes' permission to have access - // to the bulk operation. + // Log in as a user with 'administer nodes' permission to have access to the + // bulk operation. $admin_user = $this->drupalCreateUser(['administer nodes']); $this->drupalLogin($admin_user); diff --git a/core/modules/comment/src/Plugin/Action/PublishComment.php b/core/modules/comment/src/Plugin/Action/PublishComment.php index d92881d..0b82741 100644 --- a/core/modules/comment/src/Plugin/Action/PublishComment.php +++ b/core/modules/comment/src/Plugin/Action/PublishComment.php @@ -7,9 +7,7 @@ namespace Drupal\comment\Plugin\Action; -use Drupal\Core\Access\AccessResult; use Drupal\Core\Action\ActionBase; -use Drupal\comment\CommentInterface; use Drupal\Core\Session\AccountInterface; /** @@ -34,7 +32,7 @@ public function execute($comment = NULL) { /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\comment\CommentInterface $object */ return $object->status->access('edit', $account, $return_as_object); } diff --git a/core/modules/comment/src/Plugin/Action/SaveComment.php b/core/modules/comment/src/Plugin/Action/SaveComment.php index 549f64b..eb2ee42 100644 --- a/core/modules/comment/src/Plugin/Action/SaveComment.php +++ b/core/modules/comment/src/Plugin/Action/SaveComment.php @@ -31,7 +31,7 @@ public function execute($comment = NULL) { /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\comment\CommentInterface $object */ return $object->access('update', $account, $return_as_object); } diff --git a/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php b/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php index 45daaa8..cbba192 100644 --- a/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php +++ b/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php @@ -8,9 +8,7 @@ namespace Drupal\comment\Plugin\Action; use Drupal\Component\Utility\Tags; -use Drupal\Core\Access\AccessResult; use Drupal\Core\Action\ConfigurableActionBase; -use Drupal\comment\CommentInterface; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Session\AccountInterface; @@ -72,7 +70,7 @@ public function submitConfigurationForm(array &$form, FormStateInterface $form_s /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\comment\CommentInterface $object */ return $object->access('update', $account, $return_as_object); } diff --git a/core/modules/comment/src/Plugin/Action/UnpublishComment.php b/core/modules/comment/src/Plugin/Action/UnpublishComment.php index 60e1416..9264bef 100644 --- a/core/modules/comment/src/Plugin/Action/UnpublishComment.php +++ b/core/modules/comment/src/Plugin/Action/UnpublishComment.php @@ -7,9 +7,7 @@ namespace Drupal\comment\Plugin\Action; -use Drupal\Core\Access\AccessResult; use Drupal\Core\Action\ActionBase; -use Drupal\comment\CommentInterface; use Drupal\Core\Session\AccountInterface; /** @@ -34,11 +32,9 @@ public function execute($comment = NULL) { /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\comment\CommentInterface $object */ - if ($operation == 'execute') { - return $object->status->access('edit', $account, $return_as_object); - } + return $object->status->access('edit', $account, $return_as_object); } } diff --git a/core/modules/node/src/Plugin/Action/AssignOwnerNode.php b/core/modules/node/src/Plugin/Action/AssignOwnerNode.php index 2be6af7..5d67453 100644 --- a/core/modules/node/src/Plugin/Action/AssignOwnerNode.php +++ b/core/modules/node/src/Plugin/Action/AssignOwnerNode.php @@ -7,7 +7,6 @@ namespace Drupal\node\Plugin\Action; -use Drupal\Core\Access\AccessResult; use Drupal\Core\Action\ConfigurableActionBase; use Drupal\Core\Database\Connection; use Drupal\Core\Form\FormStateInterface; @@ -137,7 +136,7 @@ public function submitConfigurationForm(array &$form, FormStateInterface $form_s /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\node\NodeInterface $object */ return $object->access('update', $account, $return_as_object); } diff --git a/core/modules/node/src/Plugin/Action/DeleteNode.php b/core/modules/node/src/Plugin/Action/DeleteNode.php index 4e7f386..644630f 100644 --- a/core/modules/node/src/Plugin/Action/DeleteNode.php +++ b/core/modules/node/src/Plugin/Action/DeleteNode.php @@ -7,7 +7,6 @@ namespace Drupal\node\Plugin\Action; -use Drupal\Core\Access\AccessResult; use Drupal\Core\Action\ActionBase; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Session\AccountInterface; @@ -75,7 +74,7 @@ public function execute($object = NULL) { /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\node\NodeInterface $object */ return $object->access('delete', $account, $return_as_object); } diff --git a/core/modules/node/src/Plugin/Action/DemoteNode.php b/core/modules/node/src/Plugin/Action/DemoteNode.php index 197de78..4996247 100644 --- a/core/modules/node/src/Plugin/Action/DemoteNode.php +++ b/core/modules/node/src/Plugin/Action/DemoteNode.php @@ -7,7 +7,6 @@ namespace Drupal\node\Plugin\Action; -use Drupal\Core\Access\AccessResult; use Drupal\Core\Action\ActionBase; use Drupal\Core\Session\AccountInterface; @@ -30,10 +29,10 @@ public function execute($entity = NULL) { $entity->save(); } - /** + /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\node\NodeInterface $object */ return $object->promote->access('edit', $account, $return_as_object); } diff --git a/core/modules/node/src/Plugin/Action/PromoteNode.php b/core/modules/node/src/Plugin/Action/PromoteNode.php index ea59334..a7ca2d2 100644 --- a/core/modules/node/src/Plugin/Action/PromoteNode.php +++ b/core/modules/node/src/Plugin/Action/PromoteNode.php @@ -7,7 +7,6 @@ namespace Drupal\node\Plugin\Action; -use Drupal\Core\Access\AccessResult; use Drupal\Core\Action\ActionBase; use Drupal\Core\Session\AccountInterface; @@ -34,11 +33,12 @@ public function execute($entity = NULL) { /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\node\NodeInterface $object */ $status_access = $object->status->access('edit', $account, TRUE); $promoted_access = $object->promote->access('edit', $account, TRUE); - $access = $status_access->andIf($promoted_access); + $update_access = $object->access('update', $account, TRUE); + $access = $status_access->andIf($promoted_access)->andIf($update_access); return $return_as_object ? $access : $access->isAllowed(); } diff --git a/core/modules/node/src/Plugin/Action/PublishNode.php b/core/modules/node/src/Plugin/Action/PublishNode.php index bc1610b..155b588 100644 --- a/core/modules/node/src/Plugin/Action/PublishNode.php +++ b/core/modules/node/src/Plugin/Action/PublishNode.php @@ -7,7 +7,6 @@ namespace Drupal\node\Plugin\Action; -use Drupal\Core\Access\AccessResult; use Drupal\Core\Action\ActionBase; use Drupal\Core\Session\AccountInterface; @@ -33,7 +32,7 @@ public function execute($entity = NULL) { /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\node\NodeInterface $object */ return $object->status->access('edit', $account, $return_as_object); } diff --git a/core/modules/node/src/Plugin/Action/SaveNode.php b/core/modules/node/src/Plugin/Action/SaveNode.php index b32bd2d..4e56e8a 100644 --- a/core/modules/node/src/Plugin/Action/SaveNode.php +++ b/core/modules/node/src/Plugin/Action/SaveNode.php @@ -7,7 +7,6 @@ namespace Drupal\node\Plugin\Action; -use Drupal\Core\Access\AccessResult; use Drupal\Core\Action\ActionBase; use Drupal\Core\Session\AccountInterface; @@ -32,7 +31,7 @@ public function execute($entity = NULL) { /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\node\NodeInterface $object */ return $object->access('update', $account, $return_as_object); } diff --git a/core/modules/node/src/Plugin/Action/StickyNode.php b/core/modules/node/src/Plugin/Action/StickyNode.php index ff1ce87..021161a 100644 --- a/core/modules/node/src/Plugin/Action/StickyNode.php +++ b/core/modules/node/src/Plugin/Action/StickyNode.php @@ -7,7 +7,6 @@ namespace Drupal\node\Plugin\Action; -use Drupal\Core\Access\AccessResult; use Drupal\Core\Action\ActionBase; use Drupal\Core\Session\AccountInterface; @@ -34,11 +33,12 @@ public function execute($entity = NULL) { /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\node\NodeInterface $object */ $status_access = $object->status->access('edit', $account, TRUE); $sticky_access = $object->sticky->access('edit', $account, TRUE); - $access = $status_access->andIf($sticky_access); + $update_access = $object->access('update', $account, TRUE); + $access = $status_access->andIf($sticky_access)->andIf($update_access); return $return_as_object ? $access : $access->isAllowed(); } diff --git a/core/modules/node/src/Plugin/Action/UnpublishByKeywordNode.php b/core/modules/node/src/Plugin/Action/UnpublishByKeywordNode.php index f34b266..30cdb53 100644 --- a/core/modules/node/src/Plugin/Action/UnpublishByKeywordNode.php +++ b/core/modules/node/src/Plugin/Action/UnpublishByKeywordNode.php @@ -69,7 +69,7 @@ public function submitConfigurationForm(array &$form, FormStateInterface $form_s /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\node\NodeInterface $object */ return $object->status->access('edit', $account, $return_as_object); } diff --git a/core/modules/node/src/Plugin/Action/UnpublishNode.php b/core/modules/node/src/Plugin/Action/UnpublishNode.php index 03a7d9b..ea5634a 100644 --- a/core/modules/node/src/Plugin/Action/UnpublishNode.php +++ b/core/modules/node/src/Plugin/Action/UnpublishNode.php @@ -7,7 +7,6 @@ namespace Drupal\node\Plugin\Action; -use Drupal\Core\Access\AccessResult; use Drupal\Core\Action\ActionBase; use Drupal\Core\Session\AccountInterface; @@ -33,7 +32,7 @@ public function execute($entity = NULL) { /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\node\NodeInterface $object */ return $object->status->access('edit', $account, $return_as_object); } diff --git a/core/modules/node/src/Plugin/Action/UnstickyNode.php b/core/modules/node/src/Plugin/Action/UnstickyNode.php index efd33a4..8d1b475 100644 --- a/core/modules/node/src/Plugin/Action/UnstickyNode.php +++ b/core/modules/node/src/Plugin/Action/UnstickyNode.php @@ -7,7 +7,6 @@ namespace Drupal\node\Plugin\Action; -use Drupal\Core\Access\AccessResult; use Drupal\Core\Action\ActionBase; use Drupal\Core\Session\AccountInterface; @@ -33,7 +32,7 @@ public function execute($entity = NULL) { /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\node\NodeInterface $object */ return $object->sticky->access('edit', $account, $return_as_object); } diff --git a/core/modules/node/src/Tests/Views/BulkFormAccessTest.php b/core/modules/node/src/Tests/Views/BulkFormAccessTest.php index 50ba410..e368703 100644 --- a/core/modules/node/src/Tests/Views/BulkFormAccessTest.php +++ b/core/modules/node/src/Tests/Views/BulkFormAccessTest.php @@ -6,9 +6,10 @@ */ namespace Drupal\node\Tests\Views; +use Drupal\node\Entity\Node; /** - * Tests if entity access is respected on a node bulk form. + * Tests if entity access is respected on a node bulk operations form. * * @group node * @see \Drupal\node\Plugin\views\field\BulkForm @@ -90,7 +91,7 @@ public function testNodeEditAccess() { ); $this->drupalPostForm('test-node-bulk-form', $edit, t('Apply')); // Re-load the node and check the status. - $node = entity_load('node', $node->id(), TRUE); + $node = Node::load($node->id()); $this->assertTrue($node->isPublished(), 'The node is still published.'); // Create an account that may view the private node, but can update the status @@ -110,7 +111,7 @@ public function testNodeEditAccess() { ); $this->drupalPostForm('test-node-bulk-form', $edit, t('Apply')); // Re-load the node and check the status. - $node = entity_load('node', $node->id(), TRUE); + $node = Node::load($node->id()); $this->assertFalse($node->isPublished(), 'The node is not published anymore.'); } @@ -156,10 +157,10 @@ public function testNodeDeleteAccess() { $this->drupalPostForm('test-node-bulk-form', $edit, t('Apply')); $this->drupalPostForm(NULL, array(), t('Delete')); // Ensure the private node still exists. - $private_node = entity_load('node', $private_node->id(), TRUE); + $private_node = Node::load($private_node->id()); $this->assertNotNull($private_node, 'The private node has not been deleted.'); // Ensure the own node is deleted. - $own_node = entity_load('node', $own_node->id(), TRUE); + $own_node = Node::load($own_node->id()); $this->assertNull($own_node, 'The own node is deleted.'); } } diff --git a/core/modules/system/src/Plugin/views/field/BulkForm.php b/core/modules/system/src/Plugin/views/field/BulkForm.php index d5432ab..9c1dd07 100644 --- a/core/modules/system/src/Plugin/views/field/BulkForm.php +++ b/core/modules/system/src/Plugin/views/field/BulkForm.php @@ -265,7 +265,7 @@ public function viewsFormSubmit(&$form, FormStateInterface $form_state) { $entity = $this->getEntity($row); // Skip execution if the user did not had access. - if (!$action->getPlugin()->access('execute', $entity, $this->view->getUser())) { + if (!$action->getPlugin()->access($entity, $this->view->getUser())) { continue; } diff --git a/core/modules/system/tests/modules/action_test/src/Plugin/Action/NoType.php b/core/modules/system/tests/modules/action_test/src/Plugin/Action/NoType.php index 4f33acc..aa92076 100644 --- a/core/modules/system/tests/modules/action_test/src/Plugin/Action/NoType.php +++ b/core/modules/system/tests/modules/action_test/src/Plugin/Action/NoType.php @@ -30,7 +30,7 @@ public function execute($entity = NULL) { /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { $result = AccessResult::allowed(); return $return_as_object ? $result : $result->isAllowed(); } diff --git a/core/modules/system/tests/modules/action_test/src/Plugin/Action/SaveEntity.php b/core/modules/system/tests/modules/action_test/src/Plugin/Action/SaveEntity.php index 8b93c75..f26af5a 100644 --- a/core/modules/system/tests/modules/action_test/src/Plugin/Action/SaveEntity.php +++ b/core/modules/system/tests/modules/action_test/src/Plugin/Action/SaveEntity.php @@ -7,7 +7,6 @@ namespace Drupal\action_test\Plugin\Action; -use Drupal\Core\Access\AccessResult; use Drupal\Core\Action\ActionBase; use Drupal\Core\Session\AccountInterface; @@ -32,7 +31,7 @@ public function execute($entity = NULL) { /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\Core\Entity\EntityInterface $object */ return $object->access('update', $account, $return_as_object); } diff --git a/core/modules/user/src/Plugin/Action/BlockUser.php b/core/modules/user/src/Plugin/Action/BlockUser.php index cacc2a2..6ff1d79 100644 --- a/core/modules/user/src/Plugin/Action/BlockUser.php +++ b/core/modules/user/src/Plugin/Action/BlockUser.php @@ -7,7 +7,6 @@ namespace Drupal\user\Plugin\Action; -use Drupal\Core\Access\AccessResult; use Drupal\Core\Action\ActionBase; use Drupal\Core\Session\AccountInterface; @@ -39,7 +38,7 @@ public function execute($account = NULL) { /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\user\UserInterface $object */ return $object->status->access('edit', $account, $return_as_object); } diff --git a/core/modules/user/src/Plugin/Action/CancelUser.php b/core/modules/user/src/Plugin/Action/CancelUser.php index f67443a..401d00a 100644 --- a/core/modules/user/src/Plugin/Action/CancelUser.php +++ b/core/modules/user/src/Plugin/Action/CancelUser.php @@ -7,7 +7,6 @@ namespace Drupal\user\Plugin\Action; -use Drupal\Core\Access\AccessResult; use Drupal\Core\Action\ActionBase; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Session\AccountInterface; @@ -75,7 +74,7 @@ public function execute($object = NULL) { /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\user\UserInterface $object */ return $object->access('delete', $account, $return_as_object); } diff --git a/core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php b/core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php index fca84be..ca98c75 100644 --- a/core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php +++ b/core/modules/user/src/Plugin/Action/ChangeUserRoleBase.php @@ -7,7 +7,6 @@ namespace Drupal\user\Plugin\Action; -use Drupal\Core\Access\AccessResult; use Drupal\Core\Action\ConfigurableActionBase; use Drupal\Core\Entity\DependencyTrait; use Drupal\Core\Entity\EntityTypeInterface; @@ -96,7 +95,7 @@ public function calculateDependencies() { /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\user\UserInterface $object */ return $object->access('update', $account, $return_as_object); } diff --git a/core/modules/user/src/Plugin/Action/UnblockUser.php b/core/modules/user/src/Plugin/Action/UnblockUser.php index 0104289..d24cb7f 100644 --- a/core/modules/user/src/Plugin/Action/UnblockUser.php +++ b/core/modules/user/src/Plugin/Action/UnblockUser.php @@ -7,7 +7,6 @@ namespace Drupal\user\Plugin\Action; -use Drupal\Core\Access\AccessResult; use Drupal\Core\Action\ActionBase; use Drupal\Core\Session\AccountInterface; @@ -36,7 +35,7 @@ public function execute($account = NULL) { /** * {@inheritdoc} */ - public function access($operation, $object, AccountInterface $account = NULL, $return_as_object = FALSE) { + public function access($object, AccountInterface $account = NULL, $return_as_object = FALSE) { /** @var \Drupal\user\UserInterface $object */ return $object->status->access('edit', $account, $return_as_object); } diff --git a/core/modules/user/src/Tests/Views/BulkFormAccessTest.php b/core/modules/user/src/Tests/Views/BulkFormAccessTest.php index 8fc3c6e..e798938 100644 --- a/core/modules/user/src/Tests/Views/BulkFormAccessTest.php +++ b/core/modules/user/src/Tests/Views/BulkFormAccessTest.php @@ -6,6 +6,7 @@ */ namespace Drupal\user\Tests\Views; +use Drupal\user\Entity\User; /** * Tests if entity access is respected on an user bulk form. @@ -54,7 +55,7 @@ public function testUserEditAccess() { $this->drupalPostForm('test-user-bulk-form', $edit, t('Apply')); $this->assertResponse(200); // Re-load the account "no_edit" and ensure it is blocked. - $account = entity_load('user', $account->id(), TRUE); + $account = User::load($account->id()); $this->assertTrue($account->isBlocked(), 'The user is blocked.'); // Login as user without the 'administer users' permission. @@ -67,7 +68,7 @@ public function testUserEditAccess() { $this->drupalPostForm('test-user-bulk-form', $edit, t('Apply')); // Re-load the account "no_edit" and ensure it is blocked. - $account = entity_load('user', $account->id(), TRUE); + $account = User::load($account->id()); $this->assertTrue($account->isBlocked(), 'The user is still blocked.'); } @@ -103,10 +104,10 @@ public function testUserDeleteAccess() { $this->drupalPostForm(NULL, $edit, t('Cancel accounts')); // Ensure the account "no_delete" still exists. - $account = entity_load('user', $account->id(), TRUE); + $account = User::load($account->id()); $this->assertNotNull($account, 'The user "no_delete" is not deleted.'); // Ensure the account "may_delete" no longer exists. - $account = entity_load('user', $account2->id(), TRUE); + $account = User::load($account2->id()); $this->assertNull($account, 'The user "may_delete" is deleted.'); } }