When Sh'khem and his father Hamor approached Ya'aqob Abinu and his sons asking for Dinah to become Sh'khem's wife the verse reported:
וַיענו בני יעקב את שכם ואת חמור אביו במרמה וידברו
And the sons of Ya'aqob answered Sh'khem and Hamor his father with a (trick) and they spoke
Even though מרמה usually means a trick or in a deceptive way, Onkalos translated it in this verse as in a wise way. The Radaq pointed out that Ya'aqob Avinu did not actually speak himself when his children were tricking Sh'khem and Hamor. Perhaps this is because according to our Rabbis, Ya'aqob Abinu's trait was truth. However, the Radaq acknowledged that Ya'aqob allowed his children to answer in a deceptive way and that his children considered this to be justified considering the fact that Sh'khem had dishonored their sister Dinah in the manner that he did.
Ramban maintained that Ya'aqob let his children answer on his behalf since the whole situation was humiliating to him, and his children, out of respect for their father, wanted to speak for him in order to spare him from participating in such an undignified situation.
Then the Ramban asked, if Ya'aqob Abinu let them answer in a tricky way on his behalf, why was he angry at them afterwards? And why did he curse Shim'on and Levi's anger before he died? The Ramban answered that Ya'aqob had no intention of allowing Dinah to marry Sh'khem, so he was agreeable to making the Milah request as a way of getting out of the marriage. And in the event that they did agree to circumcise, then they could just rescue Dinah on the third day, when the people of the city were in too much pain to stop them. But what Ya'aqob Abinu did disapprove of was killing the entire city, since they weren't directly involved with Sh'khem taking Dinah. At most Ya'aqob might have agreed to kill Sh'khem for his act against Dinah. And this leads to another question, how could Shim'on and Levi kill all of those people? How could they justify killing people who weren't directly involved with Sh'khem taking Dinah?
At first Ramban quoted HaRambam who wrote the following regarding Noah's descendants in Hilkhot Melakhim (9:14): How are they (the descendants of Noah) commanded regarding (judging) the laws? They are obligated to place judges in each and every location to adjudicate the (other) six laws (that apply to the descendants of Noah) and to warn the nation (to observe them). And a descendant of Noah who violated one of the seven laws is put to death by a sword. And then HaRambam continued and explained, and because of this all of the citizens of Sh'khem were liable for death, since Sh'khem stole (kidnapped) and they (the people of Sh'khem) saw and knew and did not judge him (for his violation). HaRambam also added: A descendant of Noah is put to death (based on the testimony of) one witness (and the ruling of) one judge, and on the testimony of relatives...
But Ramban himself disagreed with the HaRambam. One matter of disagreement is whether the failure to judge a court case by the descendants of Noah is punishable by death. According to HaRambam all seven laws, including the failure to judge a court case, is punishable by death. But according to Ramban only violation of the negative commandments like the prohibitions of killing and stealing etc. are punishable by death, but the obligation to judge court cases is a positive commandment which is not punishable by death. However Ramban did say that the people of the city of Sh'khem were guilty of idol worship and promiscuity both of which are violations of the laws for the descendants of Noah and are punishable by death. But even so Ramban wrote that Ya'aqob Abinu had three objections to his sons killing all of the men of Sh'khem.
1) Ya'aqob and his children were not obligated to kill them. With regards to judging the descendants of Noah even an actual judge can withdraw from a court case for any reason. And in this particular situation Ya'aqob and his children were never the judges of that city.
2) Killing the entire city put them in danger with the inhabitants of the surrounding cities.
3) Since they agreed to circumcise and wanted to become one nation with Ya'aqob and his children, it is likely that they would have repented from their sins and followed the ways of HaShem.
Shim'on and Levi did not take the fact that they circumcised seriously, because they only did so because Hamor and Sh'khem promised them good business and marriage opportunities. They relied on the fact that the people were guilty of violating the negative commandments that were punishable by death, and they also felt that a harsh response like that could prevent any further attempts to violate their sisters or daughters.
So to summarize, according to HaRambam killing all of the men of the city was justified because of their failure to judge Sh'khem and sentence him to death for kidnapping Dinah. According to Ramban, Ya'aqob was upset with and admonished his sons, since they were not obligated to administer justice to violators of even the negative commandments of the descendants of Noah, and doing so was both dangerous and perhaps prevented those people from repenting and following HaShem. Shim'on and Levi felt that a harsh response was necessary and relied on the fact that the people of the city deserved to die for general violations of the seven commandments. But because of their harsh response, Ya'aqob cursed their anger and spread them out in the land of Israel. The tribe of Levi did not receive their own land portion, they only had cities in the other tribe's land portions. Similarly the tribe of Shim'on also only got cities all of which were located in Yehudah's land portion.