Fixed Flex Pages allowing root page to be deleted

This commit is contained in:
Matias Griese
2020-02-03 21:16:38 +02:00
parent 5db91538c6
commit 1d8b87e33f
2 changed files with 6 additions and 0 deletions

View File

@@ -4,6 +4,7 @@
1. [](#bugfix)
* Regression: Flex not working in PHP 7.2 or older
* Fixed creating first user from admin not clearing Flex User directory cache
* Fixed Flex Pages allowing root page to be deleted
# v1.7.0-rc.4
## 02/03/2020

View File

@@ -123,6 +123,11 @@ trait PageAuthorsTrait
*/
protected function isAuthorizedOverride(UserInterface $user, string $action, string $scope, bool $isMe): ?bool
{
if ($action === 'delete' && $this->root()) {
// Do not allow deleting root.
return false;
}
$isAuthor = !$isMe || $user->authorized ? $this->hasAuthor($user->username) : false;
return $this->isAuthorizedByGroup($user, $action, $scope, $isMe, $isAuthor) ?? parent::isAuthorizedOverride($user, $action, $scope, $isMe);