public static function GetAccessPermissionsArray($collectionId = 0, $oCollections = false) { static $arAllTasks; if (is_array($arAllTasks[$collectionId])) { return $arAllTasks[$collectionId]; } $col = $oCollections[$collectionId]; $arCols = array(); $resTask = array(); if ($col || $collectionId == 0) { $arCols[] = $collectionId; if (intVal($col['PARENT_ID']) > 0) { $col_ = $col; while ($col_ && intVal($col_['PARENT_ID']) > 0) { $arCols[] = $col_['PARENT_ID']; $col_ = $oCollections[$col_['PARENT_ID']]; } } $arCols[] = 0; $arPerm = CMedialib::_GetAccessPermissions($arCols); for ($i = count($arCols); $i >= 0; $i--) { $colId = $arCols[$i]; if (is_array($arPerm[$colId])) { for ($j = 0, $n = count($arPerm[$colId]); $j < $n; $j++) { $resTask[$arPerm[$colId][$j]['GROUP_ID']] = $arPerm[$colId][$j]['TASK_ID']; } } } } if (!is_array($arAllTasks)) { $arAllTasks = array(); } $arAllTasks[$collectionId] = $resTask; return $resTask; }