Fix getting group '0' from database backend

Fix #9972
Fix isLoggedIn() check for user '0'

Fix #9972
Merge pull request #10144 from owncloud/issue/9972

Issue/9972 Fix issues with group and username `0`