The European Court of Justice (ECJ) has given guidance on the extent to which dress codes (whether formal or informal) can be imposed on those who want to wear religious or political signs. In essence, the guidance from the ECJ is that it will be potentially indirect discrimination unless the employer can objectively justify the dress code. That, therefore, means the employer must show a legitimate aim (e.g. showing neutrality to customers and clients) and demonstrate that their way of achieving that aim is both appropriate and proportionate.
The guidance is fairly vague, but most commentators have interpreted it as meaning that different standards may apply to those who have no contact with customers, as opposed to those who are in customer facing roles. But, the key point is that the imposition of such a ban will not automatically be direct discrimination, but can be indirect discrimination unless there is an objective justification. As always, the best advice is to have a clearly worded dress code which sets out guidelines (and which presumably distinguishes between those who see customers and those who do not).