Create session for a user without loggin in

Hello,

Anyone knows if I can create a session for a user without using a password?

I came across this:

// Create entry in stat table…
Stat::create(
Stat::TYPE_LOCAL_AUTH,
_user->id, array_merge( isset( _SESSION ) ? _SESSION : array(), _user->getAttributes()
)
);

So in theory, fetching the user object and running this code should create a session?

Thanks

Assuming you are talking about logging in from PHP code running in the DSP context. If so, then have a look at the lib-php-common-platform library /src/Resources/User/Session.php:userLogin() and /src/Services/SystemManager.php:autoLoginAdmin(). I am not sure if you want the actual session info generated or just a logged user, either way this should give you some ideas.

Thats the one thanks