- Модуль: webdav
- Путь к файлу: ~/bitrix/modules/webdav/classes/iblockbizproc.php
- Класс: CIBlockDocumentWebdav
- Вызов: CIBlockDocumentWebdav::GetAllowableUserGroups
static function GetAllowableUserGroups($documentType, $withExtended = false)
{
if($storage = self::needProxyToDiskByDocType($documentType))
{
return self::proxyToDisk(__FUNCTION__, array(BitrixDiskBizProcDocumentCompatible::generateDocumentType($storage->getId())));
}
$iblockId = intval(mb_substr($documentType, mb_strlen("iblock_")));
if ($iblockId <= 0)
throw new CBPArgumentOutOfRangeException("documentType", $documentType);
$documentType = trim($documentType);
if ($documentType == '')
return false;
$iblockId = intval(mb_substr($documentType, mb_strlen("iblock_")));
$arResult = array("Author" => GetMessage("IBD_DOCUMENT_AUTHOR"));
$arRes = array(1);
if(CIBlock::GetArrayByID($iblockId, "RIGHTS_MODE") === "E")
{
$obRights = new CIBlockRights($iblockId);
foreach($obRights->GetGroups("element_bizproc_start") as $GROUP_CODE)
if(preg_match("/^G(\d+)$/", $GROUP_CODE, $match))
$arRes[] = $match[1];
}
else
{
$arGroups = CIBlock::GetGroupPermissions($iblockId);
foreach ($arGroups as $groupId => $perm)
{
if ($perm >= "R")
$arRes[] = $groupId;
}
}
//Crutch for Bitrix24 context (user group management is not suppotted)
if(IsModuleInstalled('bitrix24'))
{
$siteID = CAllSite::GetDefSite();
$dbResult = CGroup::GetList(
'',
'',
array('STRING_ID' => 'EMPLOYEES_'.$siteID,
'STRING_ID_EXACT_MATCH' => 'Y')
);
if($arEmployeeGroup = $dbResult->Fetch())
{
$employeeGroupID = intval($arEmployeeGroup['ID']);
if(!in_array($employeeGroupID, $arRes, true))
{
$arRes[] = $employeeGroupID;
}
}
}
$dbGroupsList = CGroup::GetListEx(array("NAME" => "ASC"), array("ID" => $arRes));
while ($arGroup = $dbGroupsList->Fetch())
$arResult[$arGroup["ID"]] = $arGroup["NAME"];
return $arResult;
}