Core
Framework v2.x
2

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 (): boolean

Example #

if (! request.userIsAdmin()) {
  throw new ForbiddenError('Only administrators can do this');
}