Initial set of tests for permission checking

Also includes code for filter api permissions.