There a lots of ways of restricting access to a node, including many contributed modules. But in the spirit of hooking into Drupal and doing things another way, there is a simple hook to use where you can enter in your logic and return if access should be allowed or not.
Keep in mind you should not have multiple modules controlling node access, but sometimes you don’t need a fully-featured module to satisfy a simple business requirement on a single node type.
/**
* Implements hook_node_access().
*/
function mymodule_node_access($op, $node) {
global $user;
if ($op == 'view' && $node->type == 'page') {
// do some logic; lets look to see if current user is node author
if ($user->uid != $node->uid) {
return FALSE; // return false to deny access
}
}
return node_access($op, $node);
}