Loading core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php +4 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,10 @@ public static function getLabel() { * {@inheritdoc} */ public function getContext($operation = NULL) { // If there are no grants at all, then always return all. if (!\Drupal::moduleHandler()->hasImplementations('node_grants')) { return 'all'; } // If the current user either can bypass node access then we don't need to // determine the exact node grants for the current user. if ($this->user->hasPermission('bypass node access')) { Loading core/modules/node/tests/src/Functional/NodeAccessGrantsCacheContextTest.php +3 −3 Original line number Diff line number Diff line Loading @@ -180,10 +180,10 @@ public function testCacheContext(): void { // Uninstall the node_access_test module. \Drupal::service('module_installer')->uninstall(['node_access_test']); $this->assertUserCacheContext([ 0 => 'view.all', 0 => 'all', $this->adminUser->id() => 'all', $this->accessUser->id() => 'view.all', $this->noAccessUser->id() => 'view.all', $this->accessUser->id() => 'all', $this->noAccessUser->id() => 'all', ]); } Loading Loading
core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php +4 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,10 @@ public static function getLabel() { * {@inheritdoc} */ public function getContext($operation = NULL) { // If there are no grants at all, then always return all. if (!\Drupal::moduleHandler()->hasImplementations('node_grants')) { return 'all'; } // If the current user either can bypass node access then we don't need to // determine the exact node grants for the current user. if ($this->user->hasPermission('bypass node access')) { Loading
core/modules/node/tests/src/Functional/NodeAccessGrantsCacheContextTest.php +3 −3 Original line number Diff line number Diff line Loading @@ -180,10 +180,10 @@ public function testCacheContext(): void { // Uninstall the node_access_test module. \Drupal::service('module_installer')->uninstall(['node_access_test']); $this->assertUserCacheContext([ 0 => 'view.all', 0 => 'all', $this->adminUser->id() => 'all', $this->accessUser->id() => 'view.all', $this->noAccessUser->id() => 'view.all', $this->accessUser->id() => 'all', $this->noAccessUser->id() => 'all', ]); } Loading