- Модуль: main
- Путь к файлу: ~/bitrix/modules/main/classes/general/main.php
- Класс: CAllMain
- Вызов: CAllMain::RemoveFileAccessPermission
public function RemoveFileAccessPermission($path, $arGroups=false)
{
global $CACHE_MANAGER;
CMain::InitPathVars($site, $path);
$DOC_ROOT = CSite::GetSiteDocRoot($site);
$path = rtrim($path, "/");
if($path == '')
$path = "/";
if(($p = bxstrrpos($path, "/")) !== false)
{
$path_file = mb_substr($path, $p + 1);
$path_dir = mb_substr($path, 0, $p);
}
else
return false;
$PERM = array();
$io = CBXVirtualIo::GetInstance();
if (!$io->FileExists($DOC_ROOT.$path_dir."/.access.php"))
return true;
include($io->GetPhysicalName($DOC_ROOT.$path_dir."/.access.php"));
$str = "$arPerm)
{
if($file != $path_file || $arGroups !== false)
{
foreach($arPerm as $group=>$perm)
{
$bExists = false;
if(is_array($arGroups))
{
//compatibility with group id
if(in_array($group, $arGroups))
$bExists = true;
elseif(preg_match('/^G[0-9]+$/', $group) && in_array(mb_substr($group, 1), $arGroups))
$bExists = true;
elseif(preg_match('/^[0-9]+$/', $group) && in_array('G'.$group, $arGroups))
$bExists = true;
}
if($file != $path_file || ($arGroups !== false && !$bExists))
$str .= "$PERM["".EscapePHPString($file).""]["".EscapePHPString($group).""]="".EscapePHPString($perm)."";n";
}
}
}
$str .= "?".">";
$this->SaveFileContent($DOC_ROOT.$path_dir."/.access.php", $str);
$CACHE_MANAGER->CleanDir("menu");
CBitrixComponent::clearComponentCache("bitrix:menu");
unset($this->FILE_PERMISSION_CACHE[$site."|".$path_dir."/.access.php"]);
foreach(GetModuleEvents("main", "OnChangePermissions", true) as $arEvent)
ExecuteModuleEventEx($arEvent, array(array($site, $path), array()));
return true;
}