Optimize permission checking