Many supporters and opponents of President Trump's executive order are conflating the terms "immigrant" (which encompasses green card holders), "nonimmigrant," and "refugee."
It's not lawful to ban immigrants because of "nationality, place of birth, or place of residence." This nondiscrimination provision comes from a 1965 law (8 U.S.C. 1152 Sec. 202(a)(1)(A)) that limits the 1952 law (8 U.S.C. 1182 Sec. 212(f)) that the president cites.
It's lawful to ban nonimmigrants for almost any reason. These are people who are temporarily visiting the United States, like tourists or students.
It's lawful to ban refugees for almost any reason. But banning all refugees from particular countries is harsh and unwise. We still should admit well-vetted persons.
Understanding these distinctions is important because supporters of President Trump's executive order continue to wrongly insist that the order is lawful and that President Obama did almost the same thing in 2011. And opponents of President Trump's executive order continue to wrongly insist that banning refugees violates the Constitution or the law.
President Trump's executive order covers not only refugees but also immigrants and nonimmigrants. As noted above, it's not lawful to discriminate in the issuance of an *immigrant* visa because of the person's "nationality, place of birth, or place of residence."
President Obama's action (which wasn't disclosed at the time) covered only refugees and, therefore, did not violate the Constitution or the law, even if one finds it objectionable for other reasons.