If you read  8 USC Section 1182 (which was passed back in the 1950's), you will discover that between Attorney General Sessions, Secy of State Tillerson and the President, there is a great deal that is within their respective 'sole discretion' or 'reason to believe' when it comes to this sort of thing.

This is the law about the Presidential 'ban'.  


(f) Suspension of entry or imposition of restrictions by President

"Whenever the President finds that the entry of any aliens or of any class of aliens into the United States would be detrimental to the interests of the United States, he may by proclamation, and for such period as he shall deem necessary, suspend the entry of all aliens or any class of aliens as immigrants or nonimmigrants, or impose on the entry of aliens any restrictions he may deem to be appropriate."





https://www.law.cornell.edu/uscode/text/8/1182