So you've come across a scenerio where you need to give users special access to nodes, but the collection of content access control modules available on drupal.org don't quite meet your need. Then you my friend need to build your own solution.
I found myself in the same boat, so I thought I'd share some of the articles that really helped me grasp custom node access.
If you've ever tried to learn by just studying one of the popular modules like Taxonomy Access Control or Content Access, you likely found yourself overwhelmed. But the combination of these articles really helped me get my head around custom node access.
Long story short, node access is really built around two functions: hook_node_grants() and hook_node_access_records(). With these two functions alone, you can write your own node access functioniality. Everything else around that is the logic to get these two functions what they need.