Fixed view_permission_filter callback of v2 template endpoints, and added tests.