mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-29 21:48:45 +02:00
* N°6933 - SF 6.4 - Remove deprecated calls
- BrowseBrickController (services access)
* N°6933 - SF 6.4 - Remove deprecated calls
- AggregatePageBrickController (services access)
* N°6933 - SF 6.4 - Remove deprecated calls
- CreateBrickController (services access)
* N°6933 - SF 6.4 - Remove deprecated calls
- ManageBrickController (services access)
* N°6933 - SF 6.4 - Remove deprecated calls
- ObjectController (services access)
* N°6933 - SF 6.4 - Remove deprecated calls
- SessionMessageController (services access)
* N°6933 - SF 6.4 - Remove deprecated calls
- UserProfileBrickController (services access)
* N°6933 - SF 6.4 - Remove deprecated calls
- AbstractController (remove getSubscribedServices override, add setter for router service injection)
* Fix SessionMessageController Call to a member function AddMessage() on null
* Fix depreciation on Request::HEADER_X_FORWARDED_ALL constant in index.php
Chose to move the protection to the yaml config instead as it is possible since Symfony 5.2
Also removed default support for the $_SERVER['TRUSTED_PROXIES'], seems too untrusty. Use TRUSTED_PROXIES env var instead !
See https://jolicode.com/blog/symfony-reverse-proxies-and-ip-protection
* ✏️ N°6933 - SF 6.4 - Remove deprecated calls
- AbstractController (typo)
* N°6933 - SF 6.4 - Remove deprecated calls
- CreateBrickController (remove return type)
* Revert "Fix depreciation on Request::HEADER_X_FORWARDED_ALL constant in index.php"
This reverts commit be4daef79a.
* Update datamodels/2.x/itop-portal-base/portal/src/Controller/AbstractController.php
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update datamodels/2.x/itop-portal-base/portal/src/Controller/BrowseBrickController.php
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update datamodels/2.x/itop-portal-base/portal/src/Controller/BrowseBrickController.php
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update datamodels/2.x/itop-portal-base/portal/src/Controller/ObjectController.php
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update datamodels/2.x/itop-portal-base/portal/src/Controller/AggregatePageBrickController.php
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update datamodels/2.x/itop-portal-base/portal/src/Controller/UserProfileBrickController.php
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update datamodels/2.x/itop-portal-base/portal/src/Controller/UserProfileBrickController.php
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update datamodels/2.x/itop-portal-base/portal/src/Controller/UserProfileBrickController.php
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update datamodels/2.x/itop-portal-base/portal/src/Controller/SessionMessageController.php
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* Update datamodels/2.x/itop-portal-base/portal/src/Controller/BrowseBrickController.php
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
* N°6933 - SF 6.4 - Remove deprecated calls
- ALl controllers (php doc and parameters names)
---------
Co-authored-by: Pierre Goiffon <pierre.goiffon@combodo.com>
Co-authored-by: Molkobain <lajarige.guillaume@free.fr>
79 lines
2.4 KiB
PHP
79 lines
2.4 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Copyright (C) 2013-2023 Combodo SARL
|
|
*
|
|
* This file is part of iTop.
|
|
*
|
|
* iTop is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* iTop is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
*/
|
|
|
|
namespace Combodo\iTop\Portal\Controller;
|
|
|
|
use Combodo\iTop\Portal\Helper\RequestManipulatorHelper;
|
|
use Combodo\iTop\Portal\Helper\SessionMessageHelper;
|
|
use Symfony\Component\HttpFoundation\JsonResponse;
|
|
use Symfony\Component\HttpFoundation\Request;
|
|
use Symfony\Component\HttpFoundation\Response;
|
|
use Symfony\Component\HttpKernel\Exception\HttpException;
|
|
|
|
/**
|
|
* Class SessionMessageController
|
|
*
|
|
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
|
|
* @package Combodo\iTop\Portal\Controller
|
|
* @since 2.7.0
|
|
*/
|
|
class SessionMessageController extends AbstractController
|
|
{
|
|
|
|
/**
|
|
* @param \Combodo\iTop\Portal\Helper\RequestManipulatorHelper $oRequestManipulatorHelper
|
|
* @param \Combodo\iTop\Portal\Helper\SessionMessageHelper $oSessionMessageHelper
|
|
*
|
|
* @since 3.2.0 N°6933
|
|
*/
|
|
public function __construct(
|
|
protected RequestManipulatorHelper $oRequestManipulatorHelper,
|
|
protected SessionMessageHelper $oSessionMessageHelper
|
|
)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* @param \Symfony\Component\HttpFoundation\Request $oRequest
|
|
*
|
|
* @return \Symfony\Component\HttpFoundation\Response
|
|
*/
|
|
public function AddMessageAction(Request $oRequest)
|
|
{
|
|
$aData = array();
|
|
|
|
// Retrieve parameters
|
|
$sMessageSeverity = $this->oRequestManipulatorHelper->ReadParam('sSeverity');
|
|
$sMessageContent = $this->oRequestManipulatorHelper->ReadParam('sContent');
|
|
|
|
// Check parameters consistency
|
|
if (empty($sMessageSeverity) || empty($sMessageContent))
|
|
{
|
|
throw new HttpException(Response::HTTP_BAD_REQUEST, 'Message must have a severity and a content, make sure both sSeverity & sContent parameters are sent.');
|
|
}
|
|
|
|
// Add message
|
|
$this->oSessionMessageHelper->AddMessage(uniqid(), $sMessageContent, $sMessageSeverity);
|
|
|
|
return new JsonResponse($aData);
|
|
}
|
|
|
|
}
|