Restrict Individual Posts

Is there a way to restrict access to individual posts and programmatically allow access?