hook node access drupal 7, not working when the node is updated
I cant seem anything that stands out as a problem other than maybe moving:

if (in_array('contributor', array_values($user-&gt;roles))) {


Into the hook_node_access and change $user for $account.

However when troubleshooting problems like this I would firstly ensure you do not have any other access control modules enabled, they can often override each other depending on the modules weight in the system table.

Turn off all modules but core and try isolate parts of your code to get it working bit by bit. For example start off initially with:

function publish_entities_node_access($node, $op, $account) {

        if ($op == 'view') {
            if ($account-&gt;uid == $node-&gt;uid) {
                  return NODE_ACCESS_ALLOW;
            }
            else {
                  return NODE_ACCESS_DENY;
            }
        }
 }


This code should work and easy to test, if you are not the author of the node then you will not be able to view it. You can then start adding on your additional if statements above until you run into a problem. 

You can also install the devel module to nicely output the array's to ensure the values you are using conditionally in your code are available.