- Модуль: disk
- Путь к файлу: ~/bitrix/modules/disk/lib/bizprocdocument.php
- Класс: BitrixDiskBizProcDocument
- Вызов: BizProcDocument::getAllowableUserGroups
static function getAllowableUserGroups($documentType)
{
$storageId = self::getStorageIdByType($documentType);
if(!$storageId)
{
throw new CBPArgumentNullException('documentType');
}
/** @var Storage $storage */
$storage = Storage::loadById($storageId, array('ROOT_OBJECT'));
if(!$storage)
{
throw new CBPArgumentNullException('documentType');
}
if($storage->getProxyType() instanceof ProxyTypeGroup && Loader::includeModule("socialnetwork"))
{
$resultUserGroups = array();
$resultUserGroups["author"] = Loc::getMessage("DISK_USER_GROUPS_AUTHOR");
$resultUserGroups[SONET_ROLES_OWNER] = Loc::getMessage("DISK_USER_GROUPS_OWNER");
$resultUserGroups[SONET_ROLES_MODERATOR] = Loc::getMessage("DISK_USER_GROUPS_MODS");
$resultUserGroups[SONET_ROLES_USER] = Loc::getMessage("DISK_USER_GROUPS_MEMBERS");
return $resultUserGroups;
}
else
{
$resultUserGroups = array('Author' => Loc::getMessage("DISK_USER_GROUPS_AUTHOR"));
$groupIds = array(1);
foreach(Driver::getInstance()->getRightsManager()->getSpecificRights($storage->getRootObject()) as $right)
{
if(preg_match("/^G(\d+)$/", $right['ACCESS_CODE'], $match))
{
$groupIds[] = $match[1];
}
}
unset($right);
//Crutch for Bitrix24 context (user group management is not supported)
if(ModuleManager::isModuleInstalled('bitrix24'))
{
$siteId = CSite::getDefSite();
$employeeGroup = CGroup::getList('', '', array(
'STRING_ID' => 'EMPLOYEES_' . $siteId,
'STRING_ID_EXACT_MATCH' => 'Y'
))->fetch();
if($employeeGroup)
{
$employeeGroupId = (int)$employeeGroup['ID'];
if(!in_array($employeeGroupId, $groupIds, true))
{
$groupIds[] = $employeeGroupId;
}
}
}
$dbGroupsList = CGroup::getListEx(array('NAME' => 'ASC'), array('ID' => $groupIds));
while($group = $dbGroupsList->fetch())
{
$resultUserGroups[$group['ID']] = $group['NAME'];
}
return $resultUserGroups;
}
}