Fixes mainly for functional tests

This PR fixes all unit and functional tests for the new permissions model.

In addition to that it makes the test suite faster by 'manually' running the GC, I've experimented a 3-minute speedup (11m to 8m) See [this](https://37signals.com/svn/posts/2742-the-road-to-faster-tests#all_comments) for a more comprehensive explanation.