This is only acceptable if the ban is justified on grounds of security, reputation, and neutrality, on the one hand, and is proportionate, on the other.
If not, there is a significant risk that this could be seen as an infringement of employees' freedom of expression.