Michaela School was entitled to enforce a ban on prayer rituals, the High Court has ruled.