Enable assigining a code for students to automatically assign a cohort

@kvirani  This is the finished version of feature 133.  Please review and merge.