Basic auth error fixes

Basic authentication fixes for the backend. Users that don't have the correct `roles_mask` are redirected to the homepage with an appropriate error.