Fixed some problems with authorization.
This is now safe to put in production. NOTE! There has been refactoring done, all user accounts will be destroyed when doing the database migration to this version.

Signed-off-by: Michael Englehorn <michael@englehorn.com>