Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3504114
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3504114
Commits
e4be93b0
Commit
e4be93b0
authored
2 months ago
by
catch
Browse files
Options
Downloads
Patches
Plain Diff
Move things back where they were, but keep comment.
parent
025c6e98
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/node/src/NodeAccessControlHandler.php
+8
-8
8 additions, 8 deletions
core/modules/node/src/NodeAccessControlHandler.php
with
8 additions
and
8 deletions
core/modules/node/src/NodeAccessControlHandler.php
+
8
−
8
View file @
e4be93b0
...
...
@@ -207,23 +207,23 @@ protected function checkViewAccess(NodeInterface $node, AccountInterface $accoun
// we need to add the node as a cacheable dependency.
$cacheability
->
addCacheableDependency
(
$node
);
// Due to the check below, it is not possible to rely only on account
// permissions to determine whether the 'view own unpublished content'
// permission can be checked, instead we also need to check if the user has
// the authenticated role. Just in case anonymous and authenticated users
// are both granted the 'view own unpublished content' permission and also
// have otherwise identical permissions.
if
(
$node
->
isPublished
())
{
return
NULL
;
}
$cacheability
->
addCacheContexts
([
'user.permissions'
]);
$cacheability
->
addCacheContexts
([
'user.roles:authenticated'
]);
if
(
!
$account
->
hasPermission
(
'view own unpublished content'
))
{
return
NULL
;
}
// Due to the check below, it is not possible to rely only on account
// permissions to determine whether the 'view own unpublished content'
// permission can be checked, instead we also need to check if the user has
// the authenticated role. Just in case anonymous and authenticated users
// are both granted the 'view own unpublished content' permission and also
// have otherwise identical permissions.
$cacheability
->
addCacheContexts
([
'user.roles:authenticated'
]);
// The "view own unpublished content" permission must not be granted
// to anonymous users for security reasons.
if
(
!
$account
->
isAuthenticated
())
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment