You are here

function notifications_content_node_allow in Notifications 5

Same name and namespace in other branches
  1. 6.4 notifications_content/notifications_content.module \notifications_content_node_allow()
  2. 6 notifications_content/notifications_content.module \notifications_content_node_allow()
  3. 6.2 notifications_content/notifications_content.module \notifications_content_node_allow()
  4. 6.3 notifications_content/notifications_content.module \notifications_content_node_allow()

Determine whether the specified user may view the specified node.

Does a user switching and checks for node permissions. Looking for a better way but it seems that all the node_access hooks cant be invokes without this.

1 call to notifications_content_node_allow()
notifications_content_notifications in notifications_content/notifications_content.module
Implementation of hook_notifications()

File

notifications_content/notifications_content.module, line 774
Subscriptions to content events

Code

function notifications_content_node_allow($account, $node) {
  static $access;
  global $user;
  if (!isset($access[$account->uid][$node->nid])) {

    // Security! Prevent session saving while user switching
    session_save_session(FALSE);
    $current = $user;
    $user = $account;
    $access[$account->uid][$node->nid] = node_access('view', $node);
    $user = $current;
    session_save_session(TRUE);
  }
  return $access[$account->uid][$node->nid];
}