Skip to content

Kirby 3.7.5

UserRules::changeRole()

Validates if the role can be changed

UserRules::changeRole(Kirby\Cms\User $user, string $role): bool

Parameters

Name Type Default
$user * Kirby\Cms\User
$role * string

Return type

bool

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

Parent class

Kirby\Cms\UserRules