2022-06-17 17:51:59 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Kirby\Cms;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* PagePermissions
|
|
|
|
*
|
|
|
|
* @package Kirby Cms
|
|
|
|
* @author Bastian Allgeier <bastian@getkirby.com>
|
|
|
|
* @link https://getkirby.com
|
|
|
|
* @copyright Bastian Allgeier
|
|
|
|
* @license https://getkirby.com/license
|
|
|
|
*/
|
|
|
|
class PagePermissions extends ModelPermissions
|
|
|
|
{
|
2025-04-21 18:57:21 +02:00
|
|
|
protected string $category = 'pages';
|
2022-06-17 17:51:59 +02:00
|
|
|
|
2022-08-31 15:02:43 +02:00
|
|
|
protected function canChangeSlug(): bool
|
|
|
|
{
|
|
|
|
return $this->model->isHomeOrErrorPage() !== true;
|
|
|
|
}
|
2022-06-17 17:51:59 +02:00
|
|
|
|
2022-08-31 15:02:43 +02:00
|
|
|
protected function canChangeStatus(): bool
|
|
|
|
{
|
|
|
|
return $this->model->isErrorPage() !== true;
|
|
|
|
}
|
2022-06-17 17:51:59 +02:00
|
|
|
|
2022-08-31 15:02:43 +02:00
|
|
|
protected function canChangeTemplate(): bool
|
|
|
|
{
|
2022-12-19 14:56:05 +01:00
|
|
|
if ($this->model->isErrorPage() === true) {
|
2022-08-31 15:02:43 +02:00
|
|
|
return false;
|
|
|
|
}
|
2022-06-17 17:51:59 +02:00
|
|
|
|
2022-08-31 15:02:43 +02:00
|
|
|
if (count($this->model->blueprints()) <= 1) {
|
|
|
|
return false;
|
|
|
|
}
|
2022-06-17 17:51:59 +02:00
|
|
|
|
2022-08-31 15:02:43 +02:00
|
|
|
return true;
|
|
|
|
}
|
2022-06-17 17:51:59 +02:00
|
|
|
|
2022-08-31 15:02:43 +02:00
|
|
|
protected function canDelete(): bool
|
|
|
|
{
|
|
|
|
return $this->model->isHomeOrErrorPage() !== true;
|
|
|
|
}
|
2022-06-17 17:51:59 +02:00
|
|
|
|
2025-04-21 18:57:21 +02:00
|
|
|
protected function canMove(): bool
|
|
|
|
{
|
|
|
|
return $this->model->isHomeOrErrorPage() !== true;
|
|
|
|
}
|
|
|
|
|
2022-08-31 15:02:43 +02:00
|
|
|
protected function canSort(): bool
|
|
|
|
{
|
|
|
|
if ($this->model->isErrorPage() === true) {
|
|
|
|
return false;
|
|
|
|
}
|
2022-06-17 17:51:59 +02:00
|
|
|
|
2022-08-31 15:02:43 +02:00
|
|
|
if ($this->model->isListed() !== true) {
|
|
|
|
return false;
|
|
|
|
}
|
2022-06-17 17:51:59 +02:00
|
|
|
|
2022-08-31 15:02:43 +02:00
|
|
|
if ($this->model->blueprint()->num() !== 'default') {
|
|
|
|
return false;
|
|
|
|
}
|
2022-06-17 17:51:59 +02:00
|
|
|
|
2022-08-31 15:02:43 +02:00
|
|
|
return true;
|
|
|
|
}
|
2022-06-17 17:51:59 +02:00
|
|
|
}
|