Issue #3179968: Permissions gone away after update
Updated patch against 3.1.
This patch fixes the issue with pages becoming unavailable to anonymous users in 2.26 and 2.27. The basic issue is that PBT creates node_access records for all nodes, even when they have no terms assigned and the 'Permission node' option is disabled.
The patch also includes a drush command to allow the user to rebuild permissions affected by the bug and patches to prevent an unnecessary full node access table rebuild. The site I am using PBT on is a government site that has most of a million nodes and takes 5 hours to rebuild node access tables. Rebuilding the node access table is not an option. The code that rebuilds only the affected nodes was reused for the drush command - otherwise I'd not conflate the two patches.