Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
uw_cfg_common
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
WCMS
uw_cfg_common
Commits
38e1bade
Commit
38e1bade
authored
3 years ago
by
Igor Biki
Committed by
l26yan
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-5190: Using access denied instead of 404 when user has no edit permissions.
parent
c25db734
No related branches found
No related tags found
1 merge request
!176
ISTWCMS-5190: Using access denied instead of 404 when user has no edit permissions.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Access/UwNodeAccessCheck.php
+6
-9
6 additions, 9 deletions
src/Access/UwNodeAccessCheck.php
with
6 additions
and
9 deletions
src/Access/UwNodeAccessCheck.php
+
6
−
9
View file @
38e1bade
...
...
@@ -8,7 +8,6 @@ use Drupal\Core\Routing\RouteMatchInterface;
use
Drupal\Core\Session\AccountInterface
;
use
Drupal\menu_admin_per_menu
\Access\MenuAdminPerMenuAccess
;
use
Drupal\uw_cfg_common
\Service\UWService
;
use
Symfony\Component\HttpKernel\Exception\NotFoundHttpException
;
/**
* Checks access for displaying configuration translation page.
...
...
@@ -65,19 +64,17 @@ class UwNodeAccessCheck implements AccessInterface {
$node
=
$route_match
->
getParameter
(
'node'
);
// Check if this is a sidebar content type and if the user has permission
// to edit the content type. We want to throw a 404 (NotFoundHttpException)
// if they do not have access. This is the case when a user is not logged
// in, and when they do not have permission to edit it.
// to edit the content type. Return access denied when user has no edit
// permission.
if
(
$node
&&
$node
->
bundle
()
==
'uw_ct_sidebar'
&&
!
$account
->
hasPermission
(
'edit any uw_ct_sidebar content'
))
{
throw
new
NotFoundHttpExceptio
n
();
return
AccessResult
::
forbidde
n
();
}
// Check if this is a sidebar content type and if the user has permission
// to edit the content type. We want to throw a 404 (NotFoundHttpException)
// if they do not have access. This is the case when a user is not logged
// in, and when they do not have permission to edit it.
// to edit the content type. Return access denied when user has no edit
// permission.
if
(
$node
&&
$node
->
bundle
()
==
'uw_ct_site_footer'
&&
!
$account
->
hasPermission
(
'edit any uw_ct_site_footer content'
))
{
throw
new
NotFoundHttpExceptio
n
();
return
AccessResult
::
forbidde
n
();
}
// We have to return some type of access, so we are going to return
...
...
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