• Модуль: webdav
  • Путь к файлу: ~/bitrix/modules/webdav/classes/iblock.php
  • Класс: CWebDavIblock
  • Вызов: CWebDavIblock::_get_section_info_arr
function _get_section_info_arr(&$arr)
{
	$arr["SHOW"] = array(
		"EDIT" => ($this->permission > "U" && !$this->check_creator ? "Y" : "N"),
		"DELETE" => ($this->permission > "U" && !$this->check_creator ? "Y" : "N"),
		"PERMISSIONS" => ($this->permission > "W"),
		"UNDELETE" => "N",
		"RIGHTS" => ($this->e_rights ? "Y" : "N")
	);

	$info = array();
	if (!isset($arr["~NAME"])) $arr["~NAME"] = $arr["NAME"];
	$arr["PATH"] = str_replace("//", "/", CWebDavIblock::_get_path($arr["IBLOCK_SECTION_ID"], false)."/".$arr["NAME"]);
	if ($_SERVER['REQUEST_METHOD'] == 'PROPFIND')
	{
		$info["path"]  = $arr["PATH"];
		if (SITE_CHARSET != "UTF-8")
			$info["path"] = $GLOBALS["APPLICATION"]->ConvertCharset($info["path"], SITE_CHARSET, "UTF-8");
		$info["props"] = array();

		$info["props"][] = array('ns'=>'DAV:', 'name'=>"resourcetype", 'val'=>"collection");
		$info["props"][] = array('ns'=>'DAV:', 'name'=>"getcontenttype", 'val'=>"httpd/unix-directory");
		$info["props"][] = array('ns'=>'DAV:', 'name'=>"creationdate", 'val'=>
			(isset($arr["DATE_CREATE_UNIX"]) ? $arr["DATE_CREATE_UNIX"] : MakeTimeStamp($arr["DATE_CREATE"])));
		$info["props"][] = array('ns'=>'DAV:', 'name'=>"getlastmodified", 'val'=>
			(isset($arr["TIMESTAMP_X_UNIX"]) ? $arr["TIMESTAMP_X_UNIX"] : MakeTimeStamp($arr["TIMESTAMP_X"])));
		$info["props"][] = array('ns'=>'DAV:', 'name'=>"iscollection", 1);
		$info["props"][] = $this->_get_lock_prop();
	}

	if ($this->_parse_webdav_info($arr) && is_array($arr["PROPS"]))
	{
		foreach ($arr["PROPS"] as $ns_name => $ns_props)
		{
			foreach ($ns_props as $prop_name => $prop_val)
			{
				if(is_scalar($prop_val))
				{
					if ($ns_name == "BX:" && $prop_name == "UNDELETE")
					{
						$arr["SHOW"]["EDIT"] = "N";
						if ($this->permission > "W")
						{
							$arr["SHOW"]["DELETE"] = "Y";
							$arr["SHOW"]["UNDELETE"] = "Y";
						}
						else
						{
							$arr["SHOW"]["DELETE"] = "N";
						}
						$arr["UNDELETE"] = $prop_val;
					}
					$info["props"][] = CWebDavBase::_mkprop($ns_name, $prop_name, $prop_val);
				}
			}
		}
	}
	if ($this->e_rights)
	{
		$bSuperUser = $GLOBALS['USER']->CanDoOperation('webdav_change_settings');
		$arShow = array(
			'PERMISSIONS' => 'section_edit',
			'EDIT' => 'section_edit',
			'DELETE' => 'section_edit',
			'UNDELETE' => 'section_delete',
			"RIGHTS" => "element_rights_edit"
		);

		foreach($arShow as $action => $right)
		{
			if (!isset($arr['E_RIGHTS'][$right]) && !$bSuperUser)
				$arr['SHOW'][$action] = 'N';
		}
		$arr['SHOW']['SHARED'] = $arr['SHARED'];
	}
	return $info;
}