Replace all hard-coded occurences of user_id

It's better to use the explicit methods to get and set the user instead of fiddling with the session manually.

Related to https://github.com/owncloud/core/issues/12891 - first step to migrating the incognito mode. - More coming…

\cc @schiesbn @PVince81 
What id `$user` is null or the user is not found ?
This seems to change the behavior, not simply replace hard-coded occurrence (which I thought would be a trivial change)