我如何强制Joomla更新用户会话

I'm updating the ACL for a given user on a PayPal callback. I'm doing this by updating the #__user_usergroup_map table directly. Now i need the user session to be updated with the new information without logging out and in again.

From this question's answers i tried the following:

$user = JFactory::getUser();
$session = JFactory::getSession();
$session->set('user', new JUser($user->id));

However this does not work for me and from JUser it looks like JUser has been deprecated.

Can anyone hint me in the right direction?

I realized that the answer from the other question will actually work.

$user = JFactory::getUser();
$session = JFactory::getSession();
$session->set('user', new JUser($user->id));

The reason it wouldn't update the user session in my case is that this code was called on the callback from PayPal which do not hold the user session.