New permissions

This will be a big change, affecting quite a few files, so it's broken into smaller changes to make it manageable.