EU-domstolen har fastslagit att religiös klädsel kan förbjudas inom offentliga yrken.