Skip to content

Commit

Permalink
Ensure only list owners can update their lists
Browse files Browse the repository at this point in the history
  • Loading branch information
engram-design committed Sep 3, 2020
1 parent 2546a39 commit 0385f4f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/controllers/ListsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ public function actionUpdate()
// Check if we're allowed to manage lists
$this->enforceEnabledList($list);
$this->enforceListPermissions($list);

// Only owners can update their own lists
if (!WishList::$plugin->getLists()->isListOwner($list)) {
throw new Exception(Craft::t('wishlist', 'You can only update your own list.'));
}

if (!Craft::$app->getElements()->saveElement($list)) {
return $this->returnError('Unable to update list.', ['list' => $list]);
Expand Down

0 comments on commit 0385f4f

Please sign in to comment.