• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/agent/security/rollbackaccessrightstoobserversagent.php
  • Класс: Bitrix\Crm\Agent\Security\RollbackAccessRightsToObserversAgent
  • Вызов: RollbackAccessRightsToObserversAgent::doRun
static function doRun()
{
	[$lastEntityId, $typeId] = self::getState();

	$observers = self::loadObservers($lastEntityId, $typeId);

	if (!empty($observers))
	{
		self::processItems($observers, $typeId);
		$lastEntityId = end($observers)['ENTITY_ID'];
	}
	else if ($typeId === \CCrmOwnerType::Lead)
	{
		$typeId = \CCrmOwnerType::Deal;
		$lastEntityId = -1;
	}
	else
	{
		self::done();
		return false;
	}

	self::setState($lastEntityId, $typeId);
	return true;

}