on 12-15-2017 4:47 PM
Hi all,
When should I use an ImpersonationContext with ImpersonationService and when sould I use executeInLocalView with SessionService ?
Like with the ImpersonationService :
ImpersonationContext context = new ImpersonationContext();
context.setCatalogVersions(Arrays.asList(catalog));
context.setCurrency(currency);
context.setSite(site);
impersonationService.executeInContext(context, () -> myContextAwareFunction());
With the sessionService :
sessionService.executeInLocalView(new SessionExecutionBody()
{
@Override
public void executeWithoutResult()
{
// set current currency
// set current baseStore
}
}
For instance in a Job task, I need to work in a specific baseStore and currency.
Thanks, JL
The ImpersonationService uses SessionService behind the scenes.
The ImpersonationService - if using a commerce-licensed Hybris, is an easier way to indicate catalog, currency, user group, and session for running a method within a specific user context.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.