Following and site canedit (closes #255, closes #246)

All the changes from #246, with the addition of canEdit and createGatekeeper from #255, done as a separate branch to give the option of trying other approaches.