Upgrade to 3.4.3

This commit is contained in:
Bastian Allgeier
2020-09-15 10:25:09 +02:00
parent 54b9ba3047
commit d8e797dd9b
108 changed files with 1750 additions and 523 deletions

View File

@@ -13,8 +13,16 @@ namespace Kirby\Cms;
*/
class UserPermissions extends ModelPermissions
{
/**
* @var string
*/
protected $category = 'users';
/**
* UserPermissions constructor
*
* @param \Kirby\Cms\Model $model
*/
public function __construct(Model $model)
{
parent::__construct($model);
@@ -23,11 +31,17 @@ class UserPermissions extends ModelPermissions
$this->category = $this->user && $this->user->is($model) ? 'user' : 'users';
}
/**
* @return bool
*/
protected function canChangeRole(): bool
{
return $this->model->roles()->count() > 1;
}
/**
* @return bool
*/
protected function canCreate(): bool
{
// the admin can always create new users
@@ -43,6 +57,9 @@ class UserPermissions extends ModelPermissions
return true;
}
/**
* @return bool
*/
protected function canDelete(): bool
{
return $this->model->isLastAdmin() !== true;