When a foreigner is in the U.S., she becomes a legal permanent resident through adjustment of status (AOS), whether the petitioner is a family member or an employer. The details of AOS are such that it reminds me of a maze. Start: must be in legal status. Twist: unless foreigner is "245(i) grandfathered" (more on this another day) or another exception applies. Continue: must never have worked in the U.S. without authorization. Twist: unless the case is based on employment and the foreigner did not work without authorization for more than 180 days in the aggregate since last entry.