protected function hasRolesOrRedirect(array $roles, $or, $redirectUrl, $originUrl = "") {

        $user = $this->getKernelEventListener()->getUser();

        if (false === UserHelper::hasRoles($user, $roles, $or)) {

            // Throw a bad user role exception with an anonymous user if user is null.
            $user = null !== $user ? $user : new User("anonymous", "");
            throw new BadUserRoleException($user, $roles, $redirectUrl, $originUrl);
        }

        return true;
    }