What permissions does HAS_DBACCESS check?
HAS_DBACCESS returns 1 if:


the current Login / User has the ability to access the DB (whether through an Instance-level permission, or by having a User in that DB that is mapped to the current Login)
the DB is not OFFLINE or SUSPECT
the DB is in


MULTI_USER mode, or
SINGLE_USER mode and the current Login / User is that single user
RESTRICTED_USER mode and the current Login / User is either a member of the dbcreator or sysadmin fixed server roles, or is a member of the db_owner fixed database role



As far as my testing (with a low-privileged Login / User) shows, this appears to be equivalent to the following:

SELECT HAS_PERMS_BY_NAME('{database_name}', 'DATABASE', 'ANY');


I tried other permissions besides ANY (i.e. AUTHENTICATE and CONNECT) and they did not always match HAS_DBACCESS.