Context of a request handler

0
I'm running into the following situation: I've replaced my login action. In my new login action, I execute microflows using the login context (i.e. Core.execute(getContext(), "microflow", parameters);). This microflow sets some user roles for the user who is logging in. Then, I create a session by calling Core.initializeSession(user, sessionID). This is working fine. Then, I have a request handler. I execute microflows using a system context (i.e. Core.execute(systemContext, "microflow", parameters);). This microflow sets some user roles for the user who is using the request handler. Then, I create a session by calling Core.initializeSession(user, sessionID). This is not working fine: the user gets the user roles which are in the database, not the ones that have been set by the microflows. My current understanding is this is caused by different contexts: in the login action, everything is executed in the same context, in the request handler the changes to the user are executed in the system context, while the session initialization is executed in a different context. I cannot call getContext() in the request handler, nor can I execute the Core.initializeSession() in a system context: Core.initializeSession(IContext, IUser, String, String) simply calls Core.initializeSession(user, String) and discards the context. I have two questions: Is my understanding of the problem correct, i.e. is this different behavior of the same microflows and same core actions caused by different contexts? If so, how do I fix this?
asked
0 answers