Implement access control

This gist fairly well explains the idea: https://gist.github.com/brianloveswords/598ae13da64718c6a605