#201536 by chx: centralizing permission checking code in node revision handling, removing lots of duplicate code