Can a B2B customer ever be anonymous in Hybris?

Viewed 149

Is there any scenario where the B2B customer can be anonymous as well in Hybris?

The method:

public CustomerModel getAnonymousUser() {
    return (CustomerModel)this.getSessionService().executeInLocalView(new SessionExecutionBody() {
        public Object execute() {
            DefaultUserService.this.searchRestrictionService.disableSearchRestrictions();
            return DefaultUserService.this.getUserForUID(UserConstants.ANONYMOUS_CUSTOMER_UID, CustomerModel.class);
        }
    });
}

in DefaultUserService.java suggests that the anonymous user will be of type Customer.

Is there any scenario where it can be of type B2BCustomer?

2 Answers

No. AnonymousUser is the non-authenticated user that just picks up generic site default settings. B2BCustomer is about specific individuals linked to specific B2BUnit (account structure) records, there is no 'generic' B2B user concept.

No, it can't.

If you check in Backoffice, under Customers node, you can find an anonymous instance, and its type is Customer (if you check in Administration tab).

B2BCustomer is a subtype of Customer, and they share the same unique attribute: uid. So, you can't have another B2BCustomer instance whose uid is also anonymous.

Related