- Модуль: socialnetwork
- Путь к файлу: ~/bitrix/modules/socialnetwork/lib/access/voteaccesscontroller.php
- Класс: BitrixSocialnetworkAccessVoteAccessController
- Вызов: VoteAccessController::check
public function check(string $typeId, int $entityId): bool
{
if (!$this->userId)
{
return false;
}
// $types = Provider::getEntityTypes();
$logId = $this->getLogId($typeId, $entityId);
// if (
// !in_array($typeId, $types)
// && !$logId
// )
// {
// // do nothing if there is no record
// return true;
// }
if (!$logId)
{
return true;
}
$logRights = $this->getLogRights($logId);
if (empty($logRights))
{
// this mean that socnet haven't got control for access right for log entry
return true;
}
if ($this->isExtranetUser($this->userId))
{
$extranetSiteId = CExtranet::GetExtranetSiteID();
$logSites = $this->getLogSites($logId);
if (!in_array($extranetSiteId, $logSites))
{
return false;
}
}
if (in_array("UA", $logRights))
{
return true;
}
if (
in_array("AU", $logRights)
&& $this->userId
)
{
return true;
}
$accessCodes = $this->getAccessCodes();
$isAccess = !empty(array_intersect($accessCodes, $logRights));
if (
$typeId === 'TASK'
&& Loader::includeModule('tasks')
)
{
$isAccess = $isAccess || TaskAccessController::can($this->userId, ActionDictionary::ACTION_TASK_READ, $entityId);
}
return $isAccess;
}