CRm-11925 permission hook backport (cut-down version)
Merge branch '4.2-master' of github.com:fuzionnz/civicrm into 4.2-master