• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/security/controller/compatible.php
  • Класс: Bitrix\Crm\Security\Controller\Compatible
  • Вызов: Compatible::register
public function register(string $entityType, int $entityId, ?RegisterOptions $options = null): void
{
	$this->unregister($entityType, $entityId);

	$connection = Application::getConnection();
	$sqlHelper = $connection->getSqlHelper();

	$entityType = $sqlHelper->forSql(mb_strtoupper($entityType));
	$entityAttributes = $options ? $options->getEntityAttributes() : [];
	if (!empty($entityAttributes))
	{
		foreach ($entityAttributes as $attribute)
		{
			$attribute = $sqlHelper->forSql($attribute);
			$connection->query("INSERT INTO b_crm_entity_perms(ENTITY, ENTITY_ID, ATTR) VALUES ('{$entityType}', {$entityId}, '{$attribute}')");
		}
	}
}