• Модуль: disk
  • Путь к файлу: ~/bitrix/modules/disk/lib/uf/sonetlogconnector.php
  • Класс: BitrixDiskUfSonetLogConnector
  • Вызов: SonetLogConnector::canRead
public function canRead($userId)
{
	if($this->canRead !== null)
	{
		return $this->canRead;
	}


	if (CSocNetUser::isCurrentUserModuleAdmin())
	{
		$this->canRead = true;

		return $this->canRead;
	}

	if ($log = $this->loadLogEntryData())
	{
		if (mb_strpos($log["EVENT_ID"], "crm_") === 0 && Loader::includeModule('crm'))
		{
			$userPermissions = CCrmPerms::getUserPermissions($userId);
			if ($log["ENTITY_TYPE"] == "CRMACTIVITY")
			{
				$bindings = CCRMActivity::getBindings($log["ENTITY_ID"]);
				foreach($bindings as $binding)
				{
					if (BitrixCrmSecurityEntityAuthorization::checkReadPermission(
						$binding["OWNER_TYPE_ID"],
						$binding["OWNER_ID"],
						$userPermissions
					))
					{
						$this->canRead = true;

						return $this->canRead;
					}
				}
			}
			else
			{
				if (BitrixCrmSecurityEntityAuthorization::checkReadPermission(
					CCrmLiveFeedEntity::resolveEntityTypeID($log["ENTITY_TYPE"]),
					$log["ENTITY_ID"],
					$userPermissions
				))
				{
					$this->canRead = true;

					return $this->canRead;
				}
				elseif (CSocNetLogRights::checkForUser($log["ID"], $userId))
				{
					$this->canRead = true;

					return $this->canRead;
				}
			}
		}
		elseif (CSocNetLogRights::checkForUser($log["ID"], $userId))
		{
			$this->canRead = true;

			return $this->canRead;
		}
	}

	$this->canRead = false;

	return $this->canRead;
}