The Constitution gives the President and the Congress fairly wide latitude in matters of immigration policy. This has always been the case.
That could have been the entirety of SCOTUS written decision in this particular case ... but of course they've got to write pages and pages about it ... because they're lawyers.