• Модуль: dav
  • Путь к файлу: ~/bitrix/modules/dav/classes/general/addressbookhandler.php
  • Класс: CDavAddressbookHandler
  • Вызов: CDavAddressbookHandler::Propfind
public function Propfind(&$arResources, $siteId, $account, $arPath, $id = null)
{
	$collectionId = $this->GetCollectionId($siteId, $account, $arPath);

	$currentPrincipal = $this->groupdav->GetRequest()->GetPrincipal();
	$currentPrincipalId = $currentPrincipal->Id();
	//HACK: maybe it should extract here to higher for all DAV requests
	if ($account[1] !== $currentPrincipalId)
		return '403 Access denied';

	if ($collectionId == null)
		return '404 Not Found';
	$request = $this->groupdav->GetRequest();
	$path = CDav::CheckIfRightSlashAdded($request->GetPath());


	if (!$this->IsMacAgent())
	{
		if (!empty($arPath[0]) && !empty($this->addressbookCollections[$arPath[0]]))
		{
			return $this->addressbookCollections[$arPath[0]]->Propfind($arResources, $collectionId, $account, $arPath, $id);
		}
		elseif (!empty($arPath[0]))
		{
			return '501 Not Implemented';
		}
		elseif (CDav::EndsWith($path, 'addressbook/'))
		{
			foreach ($this->addressbookCollections as $key => $collection)
			{
				if ($collection->CheckPrivileges('DAV:read', $currentPrincipal, $collectionId))
				{
					$resource = new CDavResource($path . $collection->GetUri());
					$resource->AddProperty('resourcetype',
						array(
							array('collection', ''),
							array('vcard-collection', '', CDavGroupDav::GROUPDAV),
							array('addressbook', '', CDavGroupDav::CARDDAV),
						)
					);
					$resource->AddProperty('displayname', $collection->GetName());
					$arResources[] = $resource;
				}
			}
		}
	}
	else
	{
		return $this->GetDefaultResourceProvider()->Propfind($arResources, $collectionId, $account, $arPath, $id);
	}


	return true;
}