This involved moving a lot of stuff to the platform layer since I don't
want event interfaces leaking out.
Also this includes a fix to the user authentication which I had
previously broken by making a platform-layer user object independent of
the database layer.