• Модуль: lists
  • Путь к файлу: ~/bitrix/modules/lists/lib/bizprocdocument.php
  • Класс: BizprocDocument
  • Вызов: BizprocDocument::GetAllowableUserGroups
static function GetAllowableUserGroups($documentType, $withExtended = false)
{
	$documentType = trim($documentType);
	if ($documentType == '')
		return false;

	$iblockId = intval(mb_substr($documentType, mb_strlen("iblock_")));

	$result = array("Author" => GetMessage("IBD_DOCUMENT_AUTHOR"));

	$groupsId = array(1);
	$extendedGroupsCode = array();
	if(CIBlock::getArrayByID($iblockId, "RIGHTS_MODE") === "E")
	{
		$rights = new CIBlockRights($iblockId);
		foreach($rights->getGroups(/*"element_bizproc_start"*/) as $iblockGroupCode)
			if(preg_match("/^G(\d+)$/", $iblockGroupCode, $match))
				$groupsId[] = $match[1];
			else
				$extendedGroupsCode[] = $iblockGroupCode;
	}
	else
	{
		foreach(CIBlock::getGroupPermissions($iblockId) as $groupId => $perm)
		{
			if ($perm > "R")
				$groupsId[] = $groupId;
		}
	}

	$groupsIterator = CGroup::getListEx(array("NAME" => "ASC"), array("ID" => $groupsId));
	while ($group = $groupsIterator->fetch())
		$result[$group["ID"]] = $group["NAME"];

	if ($withExtended && $extendedGroupsCode)
	{
		foreach ($extendedGroupsCode as $groupCode)
		{
			$result['group_'.$groupCode] = CBPHelper::getExtendedGroupName($groupCode);
		}
	}

	return $result;
}