UserRules::changeRole()
Validates if the role can be changed
UserRules::changeRole(Kirby\Cms\User $user, string $role): void
Parameters
| Name | Type | Default |
|---|---|---|
| $userrequired | Kirby\Cms\User |
no default value |
| $rolerequired | string |
no default value |
Exceptions
| Type | Description |
|---|---|
Kirby\Exception\LogicException |
If the user is the last admin |
Kirby\Exception\PermissionException |
If the user is not allowed to change the role |