Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
paragraphs
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
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
project
paragraphs
Merge requests
!48
Issue
#3340086
: Expand permissions for paragraphs_library_item
Code
Review changes
Check out branch
Download
Patches
Plain diff
Open
Issue
#3340086
: Expand permissions for paragraphs_library_item
issue/paragraphs-3340086:3340086-expand-permissions-for
into
8.x-1.x
Overview
0
Commits
2
Pipelines
0
Changes
2
Open
Adam Bramley
requested to merge
issue/paragraphs-3340086:3340086-expand-permissions-for
into
8.x-1.x
2 years ago
Overview
0
Commits
2
Pipelines
0
Changes
2
Expand
0
0
Merge request reports
Viewing commit
210d1864
Prev
Next
Show latest version
2 files
+
6
−
7
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
210d1864
Apply new permissions to access
· 210d1864
Adam Bramley
authored
2 years ago
modules/paragraphs_library/src/LibraryItemAccessControlHandler.php
+
2
−
3
Options
@@ -3,7 +3,6 @@
namespace
Drupal\paragraphs_library
;
use
Drupal\Core\Access\AccessResult
;
use
Drupal\Core\Entity\Entity
;
use
Drupal\Core\Entity\EntityAccessControlHandler
;
use
Drupal\Core\Entity\EntityInterface
;
use
Drupal\Core\Session\AccountInterface
;
@@ -33,9 +32,9 @@ class LibraryItemAccessControlHandler extends EntityAccessControlHandler {
$access
=
$access
->
andIf
(
AccessResult
::
allowedIfHasPermissions
(
$account
,
[
'edit paragraph library item'
,
$this
->
entityType
->
getAdminPermission
()],
'OR'
));
}
//
Only users with admin permission can delete library items
.
//
Allow delete access with a specific or admin permission
.
if
(
$operation
===
'delete'
)
{
$access
=
$access
->
andIf
(
AccessResult
::
allowedIfHasPermission
(
$account
,
$this
->
entityType
->
getAdminPermission
()));
$access
=
$access
->
andIf
(
AccessResult
::
allowedIfHasPermission
s
(
$account
,
[
'delete paragraph library item'
,
$this
->
entityType
->
getAdminPermission
()
],
'OR'
));
}
/** @var \Drupal\paragraphs\Entity\Paragraph $paragraph */
Loading