• Модуль: main
  • Путь к файлу: ~/bitrix/modules/main/classes/general/user.php
  • Класс: CAllUser
  • Вызов: CAllUser::CheckAuthActions
public function CheckAuthActions()
{
	if (!$this->IsAuthorized())
	{
		return;
	}

	if (!is_array(static::$kernelSession["AUTH_ACTIONS_PERFORMED"]))
	{
		static::$kernelSession["AUTH_ACTIONS_PERFORMED"] = [];
	}

	$now = new MainTypeDateTime();

	$actions = MainUserAuthActionTable::getList([
		"filter" => ["=USER_ID" => $this->getContext()->getUserId()],
		"order" => ["USER_ID" => "ASC", "PRIORITY" => "ASC", "ID" => "DESC"],
		"cache" => ["ttl" => 3600],
	]);

	while ($action = $actions->fetch())
	{
		if (isset(static::$kernelSession["AUTH_ACTIONS_PERFORMED"][$action["ID"]]))
		{
			//already processed the action in this session
			continue;
		}

		if ($action["APPLICATION_ID"] != '' && $this->getContext()->getApplicationId() != $action["APPLICATION_ID"])
		{
			//this action is for the specific application only
			continue;
		}

		/** @var MainTypeDateTime $actionDate */
		$actionDate = $action["ACTION_DATE"];

		if ($actionDate <= $now)
		{
			//remember that we already did the action
			static::$kernelSession["AUTH_ACTIONS_PERFORMED"][$action["ID"]] = true;

			if ($this->IsJustAuthorized())
			{
				//no need to update the session
				continue;
			}

			switch ($action["ACTION"])
			{
				case MainUserAuthActionTable::ACTION_LOGOUT:
					if ($this->GetParam("AUTH_ACTION_SKIP_LOGOUT"))
					{
						//user's changed password by himself, skip logout
						$this->SetParam("AUTH_ACTION_SKIP_LOGOUT", false);
						break;
					}
					//redirect is possible
					$this->Logout();
					break;

				case MainUserAuthActionTable::ACTION_UPDATE:
					$this->UpdateSessionData($this->getContext());
					break;
			}

			//we need to process only the first action by proirity
			break;
		}
	}
}