• Модуль: socialnetwork
  • Путь к файлу: ~/bitrix/modules/socialnetwork/lib/access/voteaccesscontroller.php
  • Класс: BitrixSocialnetworkAccessVoteAccessController
  • Вызов: VoteAccessController::checkEvent
static function checkEvent(array $info = []): array
{
	$result = new VoteAccessResult();
	$result
		->setResult(true)
		->setMessage('')
		->setErrorType('');

	if (
		!array_key_exists('CHECK_RIGHTS', $info)
		|| $info['CHECK_RIGHTS'] !== 'Y'
	)
	{
		return $result->toArray();
	}

	if (array_key_exists('CURRENT_USER_ID', $info))
	{
		$userId = (int) $info['CURRENT_USER_ID'];
	}
	else
	{
		global $USER;
		$userId = (int) $USER->getId();
	}

	if (!array_key_exists('ENTITY_TYPE_ID', $info))
	{
		return $result->toArray();
	}
	$entityTypeId = (string) $info['ENTITY_TYPE_ID'];

	if (!array_key_exists('ENTITY_ID', $info))
	{
		return $result->toArray();
	}
	$entityId = (int) $info['ENTITY_ID'];

	$controller = new self($userId);
	if (!$controller->check($entityTypeId, $entityId))
	{
		return (new VoteAccessResult())->toArray();
	}

	return $result->toArray();
}