?
auth.hasRole
Returns true if the current user holds any of the listed roles, false otherwise, without throwing.
auth.hasRole(...roles) → boolean
The non-throwing counterpart to requireRole. It checks whether the current user holds any of the listed roles and returns a boolean instead of throwing, so a method can branch or shape its response rather than refuse outright. Use requireRole to block a call, hasRole to branch within one.
Parameters
roles
string[]
RequiredAny-of role ids.
Branch on role
if (auth.hasRole('admin')) return allUsers;