public function canDownloadVersion(array $version, array $resource, array $category, &$errorPhraseKey = '', array $viewingUser = null, array $categoryPermissions = null)
{
$this->standardizeViewingUserReferenceForCategory($category, $viewingUser, $categoryPermissions);
if (!$this->_getResourceModel()->canDownloadResource($resource, $category, $errorPhraseKey, $viewingUser))
{
return false;
}
if ($version['version_state'] == 'moderated')
{
if (!XenForo_Permission::hasContentPermission($categoryPermissions, 'viewModerated'))
{
if (!$viewingUser['user_id'] || $viewingUser['user_id'] != $resource['user_id'])
{
return false;
}
}
}
else if ($version['version_state'] == 'deleted')
{
if (!XenForo_Permission::hasContentPermission($categoryPermissions, 'viewDeleted'))
{
return false;
}
}
return true;
}