Merge "Add capability checks to all functions."