Search code examples
angularspartacus-storefront

How can I detect current user's User-Group in Spartacus


I have a requirement to get the current user's User-Group in Angular Application with Spartacus.

I saw, there are OOTB controllers inside Hybris but no way to call them from spartacus.


Solution

  • You have to use B2BUserService. There is a method designed to load and return that data:

      getUserGroups(
        orgCustomerId: string,
        params: SearchConfig
      ): Observable<EntitiesModel<UserGroup>>