- Issue created by @Glottus
- πΊπΈUnited States Glottus
My second test (triggered by a simple entity view) has a similar result:
event: machine_name: eca.content_entity.view
event:machine_name: eca.content_entity.view
session_user:
session_user:account-name:
session_user:uid:
session_user:id:
current_user: 7
current_user:account-name: harri740
current_user:uid: 7
current_user:id:In this case, I'm actually logged in as user 1 and masquerading under my personal account, which is correctly reflected under the [current_user] tokens, but the [session_user] still is not. To do this "the ECA way", I further modified this model to switch user to my personal account before displaying the message and re-triggered it as user 1 again (not masquerading), and the results were identical to the above.
- πΊπΈUnited States Glottus
UPDATE:
Never mind. Egg on my face, as I discovered buried under the ECA Settings an indication that [session_user] might only be available if I configured ECA to always run under a specific account. I had not done that (yet), and found that indeed this worked as advertised.
Perhaps this could be highlighted a bit more in the documentation? Or else maybe make the [session_user] ALWAYS available (especially as a feature when the "Switch User" Action is used)?
- π©πͺGermany jurgenhaas Gottmadingen
Thanks @Glottus for reporting this and then even finding the "resolution".
I agree, we should improve the documentation of the session_user token which can be done in the attributes for the
\Drupal\eca\EventSubscriber\EcaExecutionSwitchAccountSubscriber::onBeforeInitialExecution
method. Happy to review an MR, if anyone could get around to that.Using the same token for the switch user action isn't possible, I guess. This is because that action could be called several times, not only once.