Yates was the acting chief executive of a department of the US government. That gives her broad discretion in how to run her department. It is within her authority to direct her department in pretty much any way she sees fit. That includes saying that the President's position is legally untenable and that the department would not defend it.
In the same regard, President Trump is the head of the US government, and Yates reported to Trump. And in Trump's capacity as the head, he is able to fire underlings for a broad variety of reasons. This time the reason was clear and justified.
Now that's all technicalities really. In reality Yates was protesting the orders knowing full well it would get her fired. So while technically speaking no officer of the government overstepped their bounds here, the reality is that Yates was essentially quitting in protest.