Upgrade to 3.2.5
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user