Trump's order IS legal. I refer you to this lovely piece of law (see page 133)...
https://www.gpo.gov/fdsys/pkg/USCOD...11-title8-chap12-subchapII-partII-sec1182.pdf
https://www.gpo.gov/fdsys/pkg/USCOD...11-title8-chap12-subchapII-partII-sec1182.pdf