Agree, this legal unless you have a binding employment contract to the contrary. You just can't be discriminated against due to a reason prohibited by law (ie age, religion, gender....).