diff --git a/core/modules/node/lib/Drupal/node/NodeAccessController.php b/core/modules/node/lib/Drupal/node/NodeAccessController.php index bb3e332..3b67629 100644 --- a/core/modules/node/lib/Drupal/node/NodeAccessController.php +++ b/core/modules/node/lib/Drupal/node/NodeAccessController.php @@ -172,7 +172,7 @@ protected function accessGrants(EntityInterface $node, $operation, $langcode, Ac /** * {@inheritdoc} */ - public function nodeAccessCheckAll($account) { + public function nodeAccessCheckAll(AccountInterface $account) { $query = $this->database->select('node_access'); $query->addExpression('COUNT(*)'); $query @@ -197,7 +197,7 @@ public function nodeAccessCheckAll($account) { /** * {@inheritdoc} */ - public function nodeAccessAlter($query, $tables, $op, $account, $base_table) { + public function nodeAccessAlter($query, array $tables, $op, AccountInterface $account, $base_table) { if (!$langcode = $query->getMetaData('langcode')) { $langcode = FALSE; } @@ -256,8 +256,12 @@ public function nodeAccessAlter($query, $tables, $op, $account, $base_table) { /** * {@inheritdoc} + * @param NodeInterface $node + * @param array $grants + * @param null $realm + * @param bool $delete */ - public function nodeAccessWriteGrants($node, $grants, $realm = NULL, $delete = TRUE) { + public function nodeAccessWriteGrants(NodeInterface $node, array $grants, $realm = NULL, $delete = TRUE) { if ($delete) { $query = $this->database->delete('node_access')->condition('nid', $node->nid); if ($realm) { diff --git a/core/modules/node/lib/Drupal/node/NodeAccessControllerInterface.php b/core/modules/node/lib/Drupal/node/NodeAccessControllerInterface.php index 45426b4..6d26c9d 100644 --- a/core/modules/node/lib/Drupal/node/NodeAccessControllerInterface.php +++ b/core/modules/node/lib/Drupal/node/NodeAccessControllerInterface.php @@ -9,6 +9,7 @@ use Drupal\Core\Database\Query\AlterableInterface; use Drupal\Core\Entity\EntityAccessControllerInterface; +use Drupal\Core\Session\AccountInterface; /** * Provides an interface for node access controllers. @@ -18,14 +19,14 @@ /** * Check access for a given node. * - * @param \Drupal\user\Plugin\Core\Entity\User $account + * @param \Drupal\Core\Session\AccountInterface $account * A user object representing the user for whom the operation is to be * performed. * * @return int. * Status of the access check. */ - public function nodeAccessCheckAll($account); + public function nodeAccessCheckAll(AccountInterface $account); /** * Alter a query when node access is required. @@ -40,7 +41,7 @@ public function nodeAccessCheckAll($account); * - "update" * - "delete" * - "create" - * @param \Drupal\user\Plugin\Core\Entity\User $account + * @param \Drupal\Core\Session\AccountInterface $account * A user object representing the user for whom the operation is to be * performed. * @param string $base_table @@ -49,7 +50,7 @@ public function nodeAccessCheckAll($account); * @return int * Status of the access check. */ - public function nodeAccessAlter($query, $tables, $op, $account, $base_table); + public function nodeAccessAlter($query, array $tables, $op, AccountInterface $account, $base_table); /** * Writes a list of grants to the database, deleting previously saved ones. @@ -62,7 +63,7 @@ public function nodeAccessAlter($query, $tables, $op, $account, $base_table); * Note: Don't call this method directly from a contributed module. Call * node_access_write_grants() instead. * - * @param \Drupal\node\Plugin\Core\Entity\Node $node + * @param \Drupal\node\NodeInterface $node * The node whose grants are being written. * @param array $grants * A list of grants to write. Each grant is an array that must contain the @@ -78,10 +79,11 @@ public function nodeAccessAlter($query, $tables, $op, $account, $base_table); * purposes, and assumes the caller has already performed a mass delete of * some form. Defaults to TRUE. * - * @see node_access_write_grants() + * @return mixed + @see node_access_write_grants() * @see node_access_acquire_grants() */ - public function nodeAccessWriteGrants($node, $grants, $realm = NULL, $delete = TRUE); + public function nodeAccessWriteGrants(NodeInterface $node, array $grants, $realm = NULL, $delete = TRUE); /** * Deletes all node access entries. diff --git a/core/modules/node/node.module b/core/modules/node/node.module index 5ed563e..7b9e086 100644 --- a/core/modules/node/node.module +++ b/core/modules/node/node.module @@ -2490,7 +2490,7 @@ function node_access($op, $node, $account = NULL, $langcode = NULL) { $account = user_load($account->uid); } - return entity_access_controller('node')->access($node, $op, $langcode, $account); + return Drupal::entityManager()->getAccessController('node')->access($node, $op, $langcode, $account); } /** @@ -2661,7 +2661,7 @@ function node_access_view_all_nodes($account = NULL) { $access[$account->uid] = TRUE; } else { - $access[$account->uid] = entity_access_controller('node')->nodeAccessCheckAll($account); + $access[$account->uid] = Drupal::entityManager()->getAccessController('node')->nodeAccessCheckAll($account); } return $access[$account->uid]; @@ -2786,7 +2786,7 @@ function node_access_acquire_grants(EntityInterface $node, $delete = TRUE) { */ function node_access_write_grants(EntityInterface $node, $delete = TRUE) { $grants = node_access_acquire_grants($node); - entity_access_controller('node')->nodeAccessWriteGrants($node, $grants, NULL, $delete); + Drupal::entityManager()->getAccessController('node')->nodeAccessWriteGrants($node, $grants, NULL, $delete); } /** @@ -2844,7 +2844,7 @@ function node_access_needs_rebuild($rebuild = NULL) { * @see node_access_needs_rebuild() */ function node_access_rebuild($batch_mode = FALSE) { - $controller = entity_access_controller('node'); + $controller = Drupal::entityManager()->getAccessController('node'); $controller->nodeAccessDelete(); // Only recalculate if the site is using a node_access module. if (count(module_implements('node_grants'))) {