public function HeartbeatMessageBuilder::checkNodeAccess in Heartbeat 6.4
Check the node access.
1 call to HeartbeatMessageBuilder::checkNodeAccess()
- HeartbeatMessageBuilder::checkAccess in includes/
heartbeatmessagebuilder.inc - Function to check access on messages This behaviour is set by a heartbeat message configuration to overrule the chosen display access type
File
- includes/
heartbeatmessagebuilder.inc, line 269 - Strategy with access behaviour
Class
- HeartbeatMessageBuilder
- Class HeartbeatMessageBuilder Message builder that fetches and customizes users activity on the site. The builder takes a heartbeataccess object to handle the request to fetch the messages.
Code
public function checkNodeAccess(&$message, $user) {
if ($message->nid > 0) {
// node_access only needs, nid, uid, type & format.
$message_node = new stdClass();
$message_node->nid = $message->nid;
$message_node->uid = $message->nid_info['uid'];
$message_node->type = $message->nid_info['type'];
$message_node->format = $message->nid_info['format'];
$message_node->status = 1;
// unpublished nodes ignore access control
//if (!node_access('view', node_load($message->nid), $user)) {
if (!node_access('view', $message_node, $user)) {
$message->nid_access = FALSE;
$this
->addError('Activity message #' . $message->uaid . ' is filtered from display, because this message is blocked by node access.');
}
if ($message->nid_target > 0) {
$message_node_target = new stdClass();
$message_node_target->nid = $message->nid_target;
$message_node_target->uid = $message->nid_target_info['uid'];
$message_node_target->type = $message->nid_target_info['type'];
$message_node_target->format = $message->nid_target_info['format'];
$message_node_target->status = 1;
// unpublished nodes ignore access control
//if (!node_access('view', node_load($message->nid_target), $user)) {
if (!node_access('view', $message_node_target, $user)) {
$message->nid_target_access = FALSE;
$this
->addError('Activity message #' . $message->uaid . ' is filtered from display, because this message is blocked by node target access.');
}
}
}
}