userIsAdmin #
Available since 2.19.3
Returns true if the user associated with the request has the admin profile, false otherwise (including when the request has no user).
Arguments #
userIsAdmin (): booleanExample #
if (! request.userIsAdmin()) {
throw new ForbiddenError('Only administrators can do this');
}