Fix (and add test for) 404 at repositories.get_all_permissions.