diff --git a/nodeaccess.module b/nodeaccess.module
index eacdfc7..3a4cb02 100644
--- a/nodeaccess.module
+++ b/nodeaccess.module
@@ -603,8 +603,8 @@ function theme_nodeaccess_grants_form($form) {
  * Implementation of hook_node_grants().
  */
 function nodeaccess_node_grants($account, $op) {
-	$roles = is_array($account->roles) ? array_keys($account->roles) : array(-1);
-	return array('nodeaccess_rid' => $roles, 'nodeaccess_uid' => array($account->uid), 'nodeaccess_author' => array($account->uid));
+  $roles = is_array($account->roles) ? array_keys($account->roles) : array(-1);
+  return array('nodeaccess_rid' => $roles, 'nodeaccess_uid' => array($account->uid), 'nodeaccess_author' => array($account->uid));
 
 }
 
@@ -712,7 +712,13 @@ function nodeaccess_node_access_records($node) {
   // Include author grant even with all values false, it may be
   // needed to overwrite an older value.
   $grants[] = $grant;
-  return $grants;
+
+  if (!empty($grants)) {
+    // Allow other modules to change the grants.
+    drupal_alter('nodeaccess_grants', $grants, $node);
+    return $grants;
+  }
+  return null;
 }
 
 /**
