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
f0e3932e
Commit
f0e3932e
authored
4 years ago
by
Eric Bremner
Committed by
Lily Yan
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ISTWCMS-4093: adding comments and cleaning up code
parent
209f10f6
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/Access/UwNodeAccessCheck.php
+8
-0
8 additions, 0 deletions
src/Access/UwNodeAccessCheck.php
uw_cfg_common.routing.yml
+0
-5
0 additions, 5 deletions
uw_cfg_common.routing.yml
with
8 additions
and
5 deletions
src/Access/UwNodeAccessCheck.php
+
8
−
0
View file @
f0e3932e
...
@@ -25,11 +25,19 @@ class UwNodeAccessCheck implements AccessInterface {
...
@@ -25,11 +25,19 @@ class UwNodeAccessCheck implements AccessInterface {
* The access result.
* The access result.
*/
*/
public
function
access
(
RouteMatchInterface
$route_match
,
AccountInterface
$account
)
{
public
function
access
(
RouteMatchInterface
$route_match
,
AccountInterface
$account
)
{
// Get the node object, which is in the route match variable.
$node
=
$route_match
->
getParameter
(
'node'
);
$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.
if
(
$node
&&
$node
->
bundle
()
==
'uw_ct_sidebar'
&&
!
$account
->
hasPermission
(
'edit any uw_ct_sidebar content'
))
{
if
(
$node
&&
$node
->
bundle
()
==
'uw_ct_sidebar'
&&
!
$account
->
hasPermission
(
'edit any uw_ct_sidebar content'
))
{
throw
new
NotFoundHttpException
();
throw
new
NotFoundHttpException
();
}
}
// We have to return some type of access, so we are going to return allowed, if they do not have access,
// the new exception is going to be thrown above.
return
AccessResult
::
allowed
();
return
AccessResult
::
allowed
();
}
}
}
}
This diff is collapsed.
Click to expand it.
uw_cfg_common.routing.yml
+
0
−
5
View file @
f0e3932e
...
@@ -5,8 +5,3 @@ uw_contact_access.form:
...
@@ -5,8 +5,3 @@ uw_contact_access.form:
_form
:
'
\Drupal\uw_cfg_common\Form\UwContentAccessForm'
_form
:
'
\Drupal\uw_cfg_common\Form\UwContentAccessForm'
requirements
:
requirements
:
_permission
:
'
access
content
access
form'
_permission
:
'
access
content
access
form'
#uw_node_access.node:
# pattern: '/node/{nid}'
# arguments: ['@current_user']
# requirements:
# _uw_node_access_check: 'TRUE'
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