protected function _canViewAttachment(array $attachment, array $viewingUser)
{
$postModel = $this->_getPostModel();
$post = $postModel->getPostById($attachment['content_id'], array(
'join' => XenForo_Model_Post::FETCH_THREAD | XenForo_Model_Post::FETCH_FORUM | XenForo_Model_Post::FETCH_USER,
'permissionCombinationId' => $viewingUser['permission_combination_id']
));
if (!$post)
{
return false;
}
$permissions = XenForo_Permission::unserializePermissions($post['node_permission_cache']);
$canViewPost = $postModel->canViewPostAndContainer(
$post, $post, $post, $null, $permissions, $viewingUser
);
if (!$canViewPost)
{
return false;
}
return $postModel->canViewAttachmentOnPost(
$post, $post, $post, $null, $permissions, $viewingUser
);
}