Add support for courseware partitioning based on cohort.

@andy-armstrong @cahrens 

suspect i'm going to need to wire something into stevedore - @andy-armstrong ?

please take heed of the notes in the first commit message - there's a database migration needed. 
This test is great but it took me a while to grok it. I wonder if you could introduce helper methods to make it clearer why the expected results are as they are. Another option might be to use named students, groups and partitions because all the 0s and 1s make it hard to be sure that the logic is correct.