[server] return NULL if username is empty in check_repo_permission