Upgrade to 3.2.0
This commit is contained in:
@@ -5,12 +5,17 @@ namespace Kirby\Cms;
|
||||
use Kirby\Exception\DuplicateException;
|
||||
use Kirby\Exception\InvalidArgumentException;
|
||||
use Kirby\Exception\LogicException;
|
||||
use Kirby\Exception\NotFoundException;
|
||||
use Kirby\Exception\PermissionException;
|
||||
use Kirby\Toolkit\Str;
|
||||
|
||||
/**
|
||||
* Validators for all page actions
|
||||
*
|
||||
* @package Kirby Cms
|
||||
* @author Bastian Allgeier <bastian@getkirby.com>
|
||||
* @link https://getkirby.com
|
||||
* @copyright Bastian Allgeier GmbH
|
||||
* @license https://getkirby.com/license
|
||||
*/
|
||||
class PageRules
|
||||
{
|
||||
@@ -257,6 +262,20 @@ class PageRules
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function duplicate(Page $page, string $slug, array $options = []): bool
|
||||
{
|
||||
if ($page->permissions()->duplicate() !== true) {
|
||||
throw new PermissionException([
|
||||
'key' => 'page.duplicate.permission',
|
||||
'data' => [
|
||||
'slug' => $page->slug()
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function update(Page $page, array $content = []): bool
|
||||
{
|
||||
if ($page->permissions()->update() !== true) {
|
||||
|
Reference in New Issue
Block a user