summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Pott2018-12-06 15:03:43 (GMT)
committerAlex Pott2018-12-06 15:03:51 (GMT)
commit3e22551b1d8031b7557ced7ef0c87ffa50b4004e (patch)
tree09ccf2cbffd52cf8128c26135eefe3609b156d53
parent6eb1915a2068325af8273c413a797dd25a2c0316 (diff)
Issue #2883553 by govind.maloo, msankhala, seanB, Berdir, xjm, alexpott: Obsolete argument for hasPermission in node_node_access()
(cherry picked from commit 269c716d1d51e24c814eb343995eeffd0d5d3a79)
-rw-r--r--core/modules/node/node.api.php8
-rw-r--r--core/modules/node/node.module8
-rw-r--r--core/modules/node/tests/modules/node_access_test/node_access_test.module2
-rw-r--r--core/modules/node/tests/src/Functional/NodeRevisionPermissionsTest.php2
4 files changed, 10 insertions, 10 deletions
diff --git a/core/modules/node/node.api.php b/core/modules/node/node.api.php
index e18cf66..a5f4e9e 100644
--- a/core/modules/node/node.api.php
+++ b/core/modules/node/node.api.php
@@ -338,19 +338,19 @@ function hook_node_access(\Drupal\node\NodeInterface $node, $op, \Drupal\Core\Se
return AccessResult::allowedIfHasPermission($account, 'create ' . $type . ' content');
case 'update':
- if ($account->hasPermission('edit any ' . $type . ' content', $account)) {
+ if ($account->hasPermission('edit any ' . $type . ' content')) {
return AccessResult::allowed()->cachePerPermissions();
}
else {
- return AccessResult::allowedIf($account->hasPermission('edit own ' . $type . ' content', $account) && ($account->id() == $node->getOwnerId()))->cachePerPermissions()->cachePerUser()->addCacheableDependency($node);
+ return AccessResult::allowedIf($account->hasPermission('edit own ' . $type . ' content') && ($account->id() == $node->getOwnerId()))->cachePerPermissions()->cachePerUser()->addCacheableDependency($node);
}
case 'delete':
- if ($account->hasPermission('delete any ' . $type . ' content', $account)) {
+ if ($account->hasPermission('delete any ' . $type . ' content')) {
return AccessResult::allowed()->cachePerPermissions();
}
else {
- return AccessResult::allowedIf($account->hasPermission('delete own ' . $type . ' content', $account) && ($account->id() == $node->getOwnerId()))->cachePerPermissions()->cachePerUser()->addCacheableDependency($node);
+ return AccessResult::allowedIf($account->hasPermission('delete own ' . $type . ' content') && ($account->id() == $node->getOwnerId()))->cachePerPermissions()->cachePerUser()->addCacheableDependency($node);
}
default:
diff --git a/core/modules/node/node.module b/core/modules/node/node.module
index d9489f6..b2df378 100644
--- a/core/modules/node/node.module
+++ b/core/modules/node/node.module
@@ -944,19 +944,19 @@ function node_node_access(NodeInterface $node, $op, $account) {
return AccessResult::allowedIfHasPermission($account, 'create ' . $type . ' content');
case 'update':
- if ($account->hasPermission('edit any ' . $type . ' content', $account)) {
+ if ($account->hasPermission('edit any ' . $type . ' content')) {
return AccessResult::allowed()->cachePerPermissions();
}
else {
- return AccessResult::allowedIf($account->hasPermission('edit own ' . $type . ' content', $account) && ($account->id() == $node->getOwnerId()))->cachePerPermissions()->cachePerUser()->addCacheableDependency($node);
+ return AccessResult::allowedIf($account->hasPermission('edit own ' . $type . ' content') && ($account->id() == $node->getOwnerId()))->cachePerPermissions()->cachePerUser()->addCacheableDependency($node);
}
case 'delete':
- if ($account->hasPermission('delete any ' . $type . ' content', $account)) {
+ if ($account->hasPermission('delete any ' . $type . ' content')) {
return AccessResult::allowed()->cachePerPermissions();
}
else {
- return AccessResult::allowedIf($account->hasPermission('delete own ' . $type . ' content', $account) && ($account->id() == $node->getOwnerId()))->cachePerPermissions()->cachePerUser()->addCacheableDependency($node);
+ return AccessResult::allowedIf($account->hasPermission('delete own ' . $type . ' content') && ($account->id() == $node->getOwnerId()))->cachePerPermissions()->cachePerUser()->addCacheableDependency($node);
}
default:
diff --git a/core/modules/node/tests/modules/node_access_test/node_access_test.module b/core/modules/node/tests/modules/node_access_test/node_access_test.module
index 5a9756b..9fca50c 100644
--- a/core/modules/node/tests/modules/node_access_test/node_access_test.module
+++ b/core/modules/node/tests/modules/node_access_test/node_access_test.module
@@ -52,7 +52,7 @@ use Drupal\node\NodeInterface;
function node_access_test_node_grants($account, $op) {
$grants = [];
$grants['node_access_test_author'] = [$account->id()];
- if ($op == 'view' && $account->hasPermission('node test view', $account)) {
+ if ($op == 'view' && $account->hasPermission('node test view')) {
$grants['node_access_test'] = [8888, 8889];
}
diff --git a/core/modules/node/tests/src/Functional/NodeRevisionPermissionsTest.php b/core/modules/node/tests/src/Functional/NodeRevisionPermissionsTest.php
index ed632a7..d0aa88e 100644
--- a/core/modules/node/tests/src/Functional/NodeRevisionPermissionsTest.php
+++ b/core/modules/node/tests/src/Functional/NodeRevisionPermissionsTest.php
@@ -153,7 +153,7 @@ class NodeRevisionPermissionsTest extends NodeTestBase {
foreach ($permutations as $case) {
// Skip this test if there are no revisions for the node.
if (!($revision->isDefaultRevision() && (db_query('SELECT COUNT(vid) FROM {node_field_revision} WHERE nid = :nid', [':nid' => $revision->id()])->fetchField() == 1 || $case['op'] == 'update' || $case['op'] == 'delete'))) {
- if (!empty($case['account']->is_admin) || $case['account']->hasPermission($this->typeMap[$case['op']], $case['account'])) {
+ if (!empty($case['account']->is_admin) || $case['account']->hasPermission($this->typeMap[$case['op']])) {
$this->assertTrue($node_revision_access->checkAccess($revision, $case['account'], $case['op']), "{$this->typeMap[$case['op']]} granted.");
}
else {