Supreme Court allows legal aid residence test appeal