Adding the permission checker left out from previous commit.