The federal judge said the Trump administration must allow the employees to seek reassignment or appeal their termination.