mirror of
https://github.com/getgrav/grav.git
synced 2026-07-13 01:03:28 +02:00
Fixed Flex Pages allowing root page to be deleted
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user