CAllCrmCompany::BuildPermSql

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. CAllCrmCompany
  4. BuildPermSql
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/classes/general/crm_company.php
  • Класс: \CAllCrmCompany
  • Вызов: CAllCrmCompany::BuildPermSql
static function BuildPermSql($sAliasPrefix = 'L', $mPermType = 'READ', $arOptions = [])
{
	$arOptions = (array)$arOptions;
	$permissionTypeHelper = new PermissionEntityTypeHelper(CCrmOwnerType::Company);
	$permissionEntityTypes = $permissionTypeHelper->getPermissionEntityTypesFromOptions($arOptions);

	$userId = null;
	if (isset($arOptions['PERMS']) && is_object($arOptions['PERMS']))
	{
		/** @var \CCrmPerms $arOptions['PERMS'] */
		$userId = $arOptions['PERMS']->GetUserID();
	}
	$builderOptions =
		Crm\Security\QueryBuilder\Options::createFromArray($arOptions)
			->setOperations((array)$mPermType)
			->setAliasPrefix((string)$sAliasPrefix)
			->setReadAllAllowed(true)
			->setSkipCheckOtherEntityTypes($permissionTypeHelper->getAllowSkipOtherEntityTypesFromOptions($arOptions))
	;

	$queryBuilder = Container::getInstance()
		->getUserPermissions($userId)
		->createListQueryBuilder($permissionEntityTypes, $builderOptions)
	;

	return $queryBuilder->buildCompatible();
}

Добавить комментарий