path: root/core/modules/node/src/Cache
diff options
authorNathaniel Catchpole2015-07-27 12:20:35 (GMT)
committerNathaniel Catchpole2015-07-27 12:20:35 (GMT)
commit49dc087276ca7b013411082a65af61ea8f6232af (patch)
treee218808c1be9b2fb1197573f1032696e6b031b27 /core/modules/node/src/Cache
parent37c1ee8c4776c66c01641d20b1a32681d43a0e0a (diff)
Issue #2533768 by Wim Leers, lauriii: Add the user entity cache tag to user.* cache contexts that need it
Diffstat (limited to 'core/modules/node/src/Cache')
1 files changed, 5 insertions, 0 deletions
diff --git a/core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php b/core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php
index d304bf7..767d286 100644
--- a/core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php
+++ b/core/modules/node/src/Cache/NodeAccessGrantsCacheContext.php
@@ -93,6 +93,11 @@ class NodeAccessGrantsCacheContext extends UserCacheContextBase implements Calcu
return $cacheable_metadata;
+ // The node grants may change if the user is updated. (The max-age is set to
+ // zero below, but sites may override this cache context, and change it to a
+ // non-zero value. In such cases, this cache tag is needed for correctness.)
+ $cacheable_metadata->setCacheTags(['user:' . $this->user->id()]);
// If the site is using node grants, this cache context can not be
// optimized.
return $cacheable_metadata->setCacheMaxAge(0);