Move BasicAuth check to "isLoggedIn()"

Ensures that Basic Auth works properly for APIs and removes the need for some even uglier lines of code.
Merge pull request #11158 from owncloud/fix_basic_auth

Move BasicAuth check to isLoggedIn