Test shutoff

Adds custom authorization for testlog tastypie endpoint to ensure that students cannot record answers after a test has been deactivated. Teachers are still able to do so.

The resulting error message is poorly rendered on the client side - we need a general way to parse Tastypie Unauthorized messages well on the client. Would also be good to enforce a redirect as a result.

I can try to look at this in the near future, but wanted to get something shippable in first.

@aronasorman @jamalex Please take a quick look. Tests written for the functionality pass.
Yeah, I think it should. Seems to be a generic Python thing, so not just for tests. Will use a mixin when I address #2350 .