Is it actually legal for the university to do this?
They probably don't have the right, and count on your inability to effectively sue them.
As an aside, I'm not sure this would be governed by contract law. In .au, this sort of thing has been the subject of administrative law cases...
Under which wicked jurisdiction discrimination could ever be considered legal?