Upgrade to 3.2.5

This commit is contained in:
Bastian Allgeier
2019-09-24 11:00:59 +02:00
parent ff9b5b1861
commit 447a9dd266
234 changed files with 1990 additions and 1224 deletions

View File

@@ -25,6 +25,11 @@ class UserPermissions extends ModelPermissions
protected function canChangeRole(): bool
{
// only one role, makes no sense to change it
if ($this->user->kirby()->roles()->count() < 2) {
return false;
}
// users who are not admins cannot change their own role
if ($this->user->is($this->model) === true && $this->user->isAdmin() === false) {
return false;
@@ -33,6 +38,21 @@ class UserPermissions extends ModelPermissions
return $this->model->isLastAdmin() !== true;
}
protected function canCreate(): bool
{
// the admin can always create new users
if ($this->user->isAdmin() === true) {
return true;
}
// users who are not admins cannot create admins
if ($this->model->isAdmin() === true) {
return false;
}
return true;
}
protected function canDelete(): bool
{
return $this->model->isLastAdmin() !== true;