Skip to content

Commit

Permalink
Don't show the Duplicate action for users w/out create permission
Browse files Browse the repository at this point in the history
Fixes #5566
  • Loading branch information
brandonkelly committed Feb 2, 2020
1 parent 0ec898c commit 3990453
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

### Fixed
- Fixed a bug where the `update` command was backing up the database twice.
- Fixed a bug where the “Duplicate” element action was available for users who didn’t have permission to create new entries in the section. ([#5566](https://github.com/craftcms/cms/issues/5566))

## 3.4.2 - 2019-01-31

Expand Down
5 changes: 4 additions & 1 deletion src/elements/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,10 @@ protected static function defineActions(string $source = null): array
}

// Duplicate
if ($userSession->checkPermission('publishEntries:' . $section->uid)) {
if (
$userSession->checkPermission('createEntries:' . $section->uid) &&
$userSession->checkPermission('publishEntries:' . $section->uid)
) {
$actions[] = Duplicate::class;

if ($section->type === Section::TYPE_STRUCTURE && $section->maxLevels != 1) {
Expand Down

0 comments on commit 3990453

Please sign in to comment.