class UserServiceImpl implements UserService {

    @Override
    public boolean existsAndHasRole(Long userId, Role role) {
        RestResult<UserResource> result = userRestService.retrieveUserById(userId);

        if (result.isFailure()) {
            return false;
        }

        UserResource user = result.getSuccess();

        return user != null && user.hasRole(role);
    }

}