mirror of
https://github.com/Combodo/iTop.git
synced 2026-05-21 08:12:26 +02:00
Merge branch 'develop' into feature/faf_event_service
# Conflicts: # core/cmdbobject.class.inc.php # core/dbobject.class.php # core/designdocument.class.inc.php # lib/composer/autoload_files.php # lib/composer/autoload_static.php
This commit is contained in:
@@ -69,10 +69,10 @@ Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
|
||||
|
||||
// Object form
|
||||
Dict::Add('ES CR', 'Spanish', 'Español, Castellano', array(
|
||||
'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Close this entry~~',
|
||||
'Portal:Form:Close:Warning' => '¿Desea abandorar esta forma? Datos modificados se perderan',
|
||||
'Portal:Error:ObjectCannotBeCreated' => 'Error: object cannot be created. Check associated objects and attachments before submitting again this form.~~',
|
||||
'Portal:Error:ObjectCannotBeUpdated' => 'Error: object cannot be updated. Check associated objects and attachments before submitting again this form.~~',
|
||||
'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Cerrar este registro',
|
||||
'Portal:Form:Close:Warning' => '¿Desea abandorar este formulario? Datos modificados se perderan',
|
||||
'Portal:Error:ObjectCannotBeCreated' => 'Error: no se puede crear el objeto. Verifique los objetos asociados y archivos adjuntos antes de enviar nuevamente este formulario.',
|
||||
'Portal:Error:ObjectCannotBeUpdated' => 'Error: no se puede actualizar el objeto. Verifique los objetos asociados y archivos adjuntos antes de enviar nuevamente este formulario.',
|
||||
));
|
||||
|
||||
// UserProfile brick
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
*/
|
||||
/**
|
||||
* @author Jeffrey Bostoen - <jbostoen.itop@outlook.com> (2018 - 2020)
|
||||
* @author Jeffrey Bostoen <info@jeffreybostoen.be> (2018 - 2022)
|
||||
*/
|
||||
// Portal
|
||||
Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
|
||||
@@ -68,10 +68,10 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
|
||||
|
||||
// Object form
|
||||
Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
|
||||
'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Close this entry~~',
|
||||
'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Sluit dit item.',
|
||||
'Portal:Form:Close:Warning' => 'Ben je zeker dat je dit venster wil sluiten? Ingevoerde gegevens kunnen verloren gaan.',
|
||||
'Portal:Error:ObjectCannotBeCreated' => 'Error: object cannot be created. Check associated objects and attachments before submitting again this form.~~',
|
||||
'Portal:Error:ObjectCannotBeUpdated' => 'Error: object cannot be updated. Check associated objects and attachments before submitting again this form.~~',
|
||||
'Portal:Error:ObjectCannotBeCreated' => 'Fout: object kan niet worden aangemaakt. Kijk verwante objecten en bijlagen na vooraleer dit formulier opnieuw te versturen.',
|
||||
'Portal:Error:ObjectCannotBeUpdated' => 'Fout: object kan niet worden aangepast. Kijk verwante objecten en bijlagen na vooraleer dit formulier opnieuw te versturen.',
|
||||
));
|
||||
|
||||
// UserProfile brick
|
||||
|
||||
@@ -18,10 +18,10 @@
|
||||
*/
|
||||
// Portal
|
||||
Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
|
||||
'Page:DefaultTitle' => 'Portal do usuário '.ITOP_APPLICATION_SHORT,
|
||||
'Page:DefaultTitle' => 'Portal do Usuário do '.ITOP_APPLICATION_SHORT,
|
||||
'Page:PleaseWait' => 'Aguarde...',
|
||||
'Page:Home' => 'Home',
|
||||
'Page:GoPortalHome' => 'Página Inicial',
|
||||
'Page:Home' => 'Página inicial',
|
||||
'Page:GoPortalHome' => 'Página inicial',
|
||||
'Page:GoPreviousPage' => 'Página anterior',
|
||||
'Page:ReloadPage' => 'Atualizar página',
|
||||
'Portal:Button:Submit' => 'Enviar',
|
||||
@@ -33,30 +33,30 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
|
||||
'Portal:Button:Delete' => 'Deletar',
|
||||
'Portal:EnvironmentBanner:Title' => 'Você está atualmente em <strong>%1$s</strong>',
|
||||
'Portal:EnvironmentBanner:GoToProduction' => 'Volte para o modo PRODUÇÃO',
|
||||
'Error:HTTP:400' => 'Pedido ruim',
|
||||
'Error:HTTP:400' => 'Solicitação inválida',
|
||||
'Error:HTTP:401' => 'Autenticação',
|
||||
'Error:HTTP:404' => 'Está página não existe',
|
||||
'Error:HTTP:500' => 'Oops! Ocorreu um erro, informe a T.I.',
|
||||
'Error:HTTP:GetHelp' => 'Por favor, entre em contato com a T.I para verificar este problema.',
|
||||
'Error:HTTP:GetHelp' => 'Por favor, entre em contato com a T.I. para verificar este problema.',
|
||||
'Error:XHR:Fail' => 'Não foi possível carregar dados, entre em contato com o T.I.',
|
||||
'Portal:ErrorUserLoggedOut' => 'Você está desconectado e precisa fazer o login novamente para continuar.',
|
||||
'Portal:ErrorUserLoggedOut' => 'Você foi desconectado e precisa fazer o login novamente para continuar.',
|
||||
'Portal:Datatables:Language:Processing' => 'Aguarde...',
|
||||
'Portal:Datatables:Language:Search' => 'Filtro:',
|
||||
'Portal:Datatables:Language:LengthMenu' => 'Lista _MENU_ itens por página',
|
||||
'Portal:Datatables:Language:LengthMenu' => 'Exibir _MENU_ item(ns) por página',
|
||||
'Portal:Datatables:Language:ZeroRecords' => 'Sem resultados',
|
||||
'Portal:Datatables:Language:Info' => 'Páginas: _PAGE_ of _PAGES_',
|
||||
'Portal:Datatables:Language:InfoEmpty' => 'Sem Informações',
|
||||
'Portal:Datatables:Language:InfoFiltered' => 'Filtrado de: _MAX_ items',
|
||||
'Portal:Datatables:Language:EmptyTable' => 'No data available in this table',
|
||||
'Portal:Datatables:Language:InfoFiltered' => 'Filtrado de: _MAX_ item(ns)',
|
||||
'Portal:Datatables:Language:EmptyTable' => 'Não há dados disponíveis nesta tabela',
|
||||
'Portal:Datatables:Language:DisplayLength:All' => 'Todos',
|
||||
'Portal:Datatables:Language:Paginate:First' => 'Primeira',
|
||||
'Portal:Datatables:Language:Paginate:Previous' => 'Anterior',
|
||||
'Portal:Datatables:Language:Paginate:Next' => 'Próximo',
|
||||
'Portal:Datatables:Language:Paginate:Last' => 'Anterior',
|
||||
'Portal:Datatables:Language:Sort:Ascending' => 'Habilitar para um tipo ascendente',
|
||||
'Portal:Datatables:Language:Sort:Descending' => 'Habilitar para um tipo descendentes',
|
||||
'Portal:Datatables:Language:Sort:Ascending' => 'Ordem ascendente',
|
||||
'Portal:Datatables:Language:Sort:Descending' => 'Ordem descendente',
|
||||
'Portal:Autocomplete:NoResult' => 'Sem dados',
|
||||
'Portal:Attachments:DropZone:Message' => 'Solte seus arquivos para adicioná-los como anexos.',
|
||||
'Portal:Attachments:DropZone:Message' => 'Arraste seus arquivos aqui para adicioná-los como anexos',
|
||||
'Portal:File:None' => 'Nenhum arquivo',
|
||||
'Portal:File:DisplayInfo' => '<a href="%2$s" class="file_download_link">%1$s</a>',
|
||||
'Portal:File:DisplayInfo+' => '%1$s (%2$s) <a href="%3$s" class="file_open_link" target="_blank">Abrir</a> / <a href="%4$s" class="file_download_link">Download</a>',
|
||||
@@ -65,29 +65,29 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
|
||||
|
||||
// Object form
|
||||
Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
|
||||
'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Close this entry~~',
|
||||
'Portal:Form:Close:Warning' => 'Você deseja abandonar esta página? Os dados digitados podem ser perdidos.',
|
||||
'Portal:Error:ObjectCannotBeCreated' => 'Error: object cannot be created. Check associated objects and attachments before submitting again this form.~~',
|
||||
'Portal:Error:ObjectCannotBeUpdated' => 'Error: object cannot be updated. Check associated objects and attachments before submitting again this form.~~',
|
||||
'Portal:Form:Caselog:Entry:Close:Tooltip' => 'Fechar esta solicitação',
|
||||
'Portal:Form:Close:Warning' => 'Você deseja abandonar esta página? Os dados digitados podem ser perdidos',
|
||||
'Portal:Error:ObjectCannotBeCreated' => 'Erro: objeto não pode ser criado. Verifique os objetos e anexos associados antes de enviar novamente este formulário',
|
||||
'Portal:Error:ObjectCannotBeUpdated' => 'Erro: objeto não pode ser atualizado. Verifique os objetos e anexos associados antes de enviar novamente este formulário',
|
||||
));
|
||||
|
||||
// UserProfile brick
|
||||
Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
|
||||
'Brick:Portal:UserProfile:Name' => 'Perfil Usuário',
|
||||
'Brick:Portal:UserProfile:Name' => 'Perfil de Usuário',
|
||||
'Brick:Portal:UserProfile:Navigation:Dropdown:MyProfil' => 'Meu Perfil',
|
||||
'Brick:Portal:UserProfile:Navigation:Dropdown:Logout' => 'Sair',
|
||||
'Brick:Portal:UserProfile:Password:Title' => 'Senha',
|
||||
'Brick:Portal:UserProfile:Password:ChoosePassword' => 'Escolha a senha',
|
||||
'Brick:Portal:UserProfile:Password:ConfirmPassword' => 'Confirme a senha',
|
||||
'Brick:Portal:UserProfile:Password:ChoosePassword' => 'Nova senha',
|
||||
'Brick:Portal:UserProfile:Password:ConfirmPassword' => 'Repetir nova senha',
|
||||
'Brick:Portal:UserProfile:Password:CantChangeContactAdministrator' => 'Para alterar sua senha, entre em contato com a T.I.',
|
||||
'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'Não é possível alterar a senha, entre em contato com a T.I.',
|
||||
'Brick:Portal:UserProfile:Password:CantChangeForUnknownReason' => 'Não foi possível alterar sua senha, entre em contato com a T.I.',
|
||||
'Brick:Portal:UserProfile:PersonalInformations:Title' => 'Informações pessoais',
|
||||
'Brick:Portal:UserProfile:Photo:Title' => 'Foto',
|
||||
'Brick:Portal:UserProfile:Photo:Title' => 'Imagem',
|
||||
));
|
||||
|
||||
// AggregatePageBrick
|
||||
Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
|
||||
'Brick:Portal:AggregatePage:DefaultTitle' => 'Painel de controle',
|
||||
'Brick:Portal:AggregatePage:DefaultTitle' => 'Painel do '.ITOP_APPLICATION_SHORT,
|
||||
));
|
||||
|
||||
// BrowseBrick brick
|
||||
@@ -109,19 +109,19 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
|
||||
// ManageBrick brick
|
||||
Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
|
||||
'Brick:Portal:Manage:Name' => 'Gerenciar itens',
|
||||
'Brick:Portal:Manage:Table:NoData' => 'Sem dados.',
|
||||
'Brick:Portal:Manage:Table:NoData' => 'Sem dados',
|
||||
'Brick:Portal:Manage:Table:ItemActions' => 'Ações',
|
||||
'Brick:Portal:Manage:DisplayMode:list' => 'List',
|
||||
'Brick:Portal:Manage:DisplayMode:pie-chart' => 'Gráfico de pizza',
|
||||
'Brick:Portal:Manage:DisplayMode:bar-chart' => 'Bar Chart',
|
||||
'Brick:Portal:Manage:DisplayMode:pie-chart' => 'Gráfico de Pizza',
|
||||
'Brick:Portal:Manage:DisplayMode:bar-chart' => 'Gráfico de Barras',
|
||||
'Brick:Portal:Manage:Others' => 'Outros',
|
||||
'Brick:Portal:Manage:All' => 'Todos',
|
||||
'Brick:Portal:Manage:Group' => 'Group',
|
||||
'Brick:Portal:Manage:Group' => 'Grupo',
|
||||
'Brick:Portal:Manage:fct:count' => 'Total',
|
||||
'Brick:Portal:Manage:fct:sum' => 'Soma',
|
||||
'Brick:Portal:Manage:fct:avg' => 'Média',
|
||||
'Brick:Portal:Manage:fct:min' => 'Min',
|
||||
'Brick:Portal:Manage:fct:max' => 'Max',
|
||||
'Brick:Portal:Manage:fct:min' => 'Min.',
|
||||
'Brick:Portal:Manage:fct:max' => 'Máx.',
|
||||
));
|
||||
|
||||
// ObjectBrick brick
|
||||
@@ -149,6 +149,6 @@ Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
|
||||
// Filter brick
|
||||
Dict::Add('PT BR', 'Brazilian', 'Brazilian', array(
|
||||
'Brick:Portal:Filter:Name' => 'Filtro ativado',
|
||||
'Brick:Portal:Filter:SearchInput:Placeholder' => 'eg. connect wifi',
|
||||
'Brick:Portal:Filter:SearchInput:Placeholder' => 'ex. conectar ao WiFi',
|
||||
'Brick:Portal:Filter:SearchInput:Submit' => 'Pesquisa',
|
||||
));
|
||||
|
||||
@@ -56,7 +56,7 @@ if (file_exists(dirname(__DIR__).'/.env.local.php')) {
|
||||
|
||||
// load all the .env files
|
||||
if (method_exists($oDotenv, 'loadEnv')) {
|
||||
$oDotenv->loadEnv($sPath);
|
||||
$oDotenv->loadEnv($sPath, null, 'prod');
|
||||
} else {
|
||||
// fallback code in case your Dotenv component is not 4.2 or higher (when loadEnv() was added)
|
||||
|
||||
@@ -85,12 +85,6 @@ if (file_exists(dirname(__DIR__).'/.env.local.php')) {
|
||||
}
|
||||
}
|
||||
|
||||
// Set debug mode only when necessary
|
||||
if (utils::ReadParam('debug', 'false') === 'true')
|
||||
{
|
||||
$_SERVER['APP_DEBUG'] = true;
|
||||
}
|
||||
|
||||
$_SERVER += $_ENV;
|
||||
$_SERVER['APP_ENV'] = $_ENV['APP_ENV'] = (isset($_SERVER['APP_ENV']) ? $_SERVER['APP_ENV'] : (isset($_ENV['APP_ENV']) ? $_ENV['APP_ENV'] : null)) ?: 'prod';
|
||||
$_SERVER['APP_DEBUG'] = isset($_SERVER['APP_DEBUG']) ? $_SERVER['APP_DEBUG'] : (isset($_ENV['APP_DEBUG']) ? $_ENV['APP_DEBUG'] : ('prod' !== $_SERVER['APP_ENV']));
|
||||
|
||||
48
datamodels/2.x/itop-portal-base/portal/config/services.php
Normal file
48
datamodels/2.x/itop-portal-base/portal/config/services.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright (C) 2013-2022 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 Symfony\Component\DependencyInjection\Loader\Configurator;
|
||||
|
||||
use Combodo\iTop\Portal\Routing\ItopExtensionsExtraRoutes;
|
||||
|
||||
/**
|
||||
* Extensions controllers registration.
|
||||
*
|
||||
* @author Benjamin Dalsass
|
||||
* @since 3.1.0
|
||||
* @package Symfony\Component\DependencyInjection\Loader\Configurator
|
||||
*/
|
||||
return static function (ContainerConfigurator $oContainer) {
|
||||
|
||||
// retrieve extension controller classes
|
||||
$aControllersClasses = ItopExtensionsExtraRoutes::GetControllersClasses();
|
||||
|
||||
// iterate throw extensions controller classes...
|
||||
foreach ($aControllersClasses as $sController) {
|
||||
|
||||
// register as service
|
||||
$oContainer->services()->set($sController, $sController)
|
||||
->public()
|
||||
->tag('controller.service_arguments')
|
||||
->tag('container.service_suscriber')
|
||||
->autowire()
|
||||
->autoconfigure();
|
||||
}
|
||||
|
||||
};
|
||||
@@ -612,7 +612,7 @@ $popover-arrow-color: $popover-bg !default;
|
||||
//** Popover outer arrow width
|
||||
$popover-arrow-outer-width: ($popover-arrow-width + 1) !default;
|
||||
//** Popover outer arrow color
|
||||
$popover-arrow-outer-color: fadein($popover-border-color, 5%) !default;
|
||||
$popover-arrow-outer-color: fade-in($popover-border-color, 0.05) !default;
|
||||
//** Popover outer arrow fallback color
|
||||
$popover-arrow-outer-fallback-color: darken($popover-fallback-border-color, 20%) !default;
|
||||
|
||||
|
||||
@@ -22,9 +22,11 @@ namespace Combodo\iTop\Portal\Controller;
|
||||
|
||||
use Combodo\iTop\Portal\Brick\BrickNotFoundException;
|
||||
use IssueLog;
|
||||
use LogChannels;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use UserRights;
|
||||
|
||||
|
||||
/**
|
||||
@@ -91,10 +93,10 @@ class AggregatePageBrickController extends BrickController
|
||||
}
|
||||
catch (BrickNotFoundException $oException)
|
||||
{
|
||||
if ($this->get('kernel')->isDebug())
|
||||
{
|
||||
IssueLog::Warning('AggregatePageBrick: Could not display "'.$sBrickId.'", either wrong id or user profile not allowed');
|
||||
}
|
||||
IssueLog::Debug('AggregatePageBrick: Could not display brick, either wrong id or user profile not allowed', LogChannels::PORTAL, [
|
||||
'brick_id' => $sBrickId,
|
||||
'user_profiles' => UserRights::ListProfiles(),
|
||||
]);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -591,6 +591,8 @@ class ObjectController extends BrickController
|
||||
$oSecurityHelper = $this->get('security_helper');
|
||||
/** @var \Combodo\iTop\Portal\Helper\ScopeValidatorHelper $oScopeValidator */
|
||||
$oScopeValidator = $this->get('scope_validator');
|
||||
/** @var \Combodo\iTop\Portal\Helper\ObjectFormHandlerHelper $oFormHandlerHelper */
|
||||
$oFormHandlerHelper = $this->get('object_form_handler');
|
||||
|
||||
$aData = array(
|
||||
'results' => array(
|
||||
@@ -642,16 +644,14 @@ class ObjectController extends BrickController
|
||||
// Updating host object with form data / values
|
||||
$sFormManagerClass = $aRequestContent['formmanager_class'];
|
||||
$sFormManagerData = $aRequestContent['formmanager_data'];
|
||||
if (!empty($sFormManagerClass) && !empty($sFormManagerData))
|
||||
{
|
||||
if (!empty($sFormManagerClass) && !empty($sFormManagerData)) {
|
||||
/** @var \Combodo\iTop\Portal\Form\ObjectFormManager $oFormManager */
|
||||
$oFormManager = $sFormManagerClass::FromJSON($sFormManagerData);
|
||||
$oFormManager->SetContainer($this->container);
|
||||
$oFormManager->SetObjectFormHandlerHelper($oFormHandlerHelper);
|
||||
$oFormManager->SetObject($oHostObject);
|
||||
|
||||
// Applying action rules if present
|
||||
if (($oFormManager->GetActionRulesToken() !== null) && ($oFormManager->GetActionRulesToken() !== ''))
|
||||
{
|
||||
if (($oFormManager->GetActionRulesToken() !== null) && ($oFormManager->GetActionRulesToken() !== '')) {
|
||||
$aActionRules = ContextManipulatorHelper::DecodeRulesToken($oFormManager->GetActionRulesToken());
|
||||
$oObj = $oFormManager->GetObject();
|
||||
$oContextManipulator->PrepareObject($aActionRules, $oObj);
|
||||
@@ -771,13 +771,14 @@ class ObjectController extends BrickController
|
||||
$oSecurityHelper = $this->get('security_helper');
|
||||
/** @var \Combodo\iTop\Portal\Helper\ScopeValidatorHelper $oScopeValidator */
|
||||
$oScopeValidator = $this->get('scope_validator');
|
||||
|
||||
/** @var \Combodo\iTop\Portal\Helper\ObjectFormHandlerHelper $oFormHandlerHelper */
|
||||
$oFormHandlerHelper = $this->get('object_form_handler');
|
||||
|
||||
$aData = array(
|
||||
'sMode' => 'search_regular',
|
||||
'sTargetAttCode' => $sTargetAttCode,
|
||||
'sHostObjectClass' => $sHostObjectClass,
|
||||
'sHostObjectId' => $sHostObjectId,
|
||||
'sMode' => 'search_regular',
|
||||
'sTargetAttCode' => $sTargetAttCode,
|
||||
'sHostObjectClass' => $sHostObjectClass,
|
||||
'sHostObjectId' => $sHostObjectId,
|
||||
'sActionRulesToken' => $oRequestManipulator->ReadParam('ar_token', ''),
|
||||
);
|
||||
|
||||
@@ -809,16 +810,14 @@ class ObjectController extends BrickController
|
||||
// Updating host object with form data / values
|
||||
$sFormManagerClass = $oRequestManipulator->ReadParam('formmanager_class', '', FILTER_UNSAFE_RAW);
|
||||
$sFormManagerData = $oRequestManipulator->ReadParam('formmanager_data', '', FILTER_UNSAFE_RAW);
|
||||
if (!empty($sFormManagerClass) && !empty($sFormManagerData))
|
||||
{
|
||||
if (!empty($sFormManagerClass) && !empty($sFormManagerData)) {
|
||||
/** @var \Combodo\iTop\Portal\Form\ObjectFormManager $oFormManager */
|
||||
$oFormManager = $sFormManagerClass::FromJSON($sFormManagerData);
|
||||
$oFormManager->SetContainer($this->container);
|
||||
$oFormManager->SetObjectFormHandlerHelper($oFormHandlerHelper);
|
||||
$oFormManager->SetObject($oHostObject);
|
||||
|
||||
// Applying action rules if present
|
||||
if (($oFormManager->GetActionRulesToken() !== null) && ($oFormManager->GetActionRulesToken() !== ''))
|
||||
{
|
||||
if (($oFormManager->GetActionRulesToken() !== null) && ($oFormManager->GetActionRulesToken() !== '')) {
|
||||
$aActionRules = ContextManipulatorHelper::DecodeRulesToken($oFormManager->GetActionRulesToken());
|
||||
$oObj = $oFormManager->GetObject();
|
||||
$oContextManipulator->PrepareObject($aActionRules, $oObj);
|
||||
@@ -1237,12 +1236,12 @@ class ObjectController extends BrickController
|
||||
$oAttachment->Set('contents', $oDocument);
|
||||
$iAttId = $oAttachment->DBInsert();
|
||||
|
||||
$aData['msg'] = htmlentities($oDocument->GetFileName(), ENT_QUOTES, 'UTF-8');
|
||||
$aData['msg'] = utils::EscapeHtml($oDocument->GetFileName());
|
||||
$aData['icon'] = utils::GetAbsoluteUrlAppRoot().'env-'.utils::GetCurrentEnvironment().'/itop-attachments/icons/icons8-image-file.svg';
|
||||
|
||||
// Checking if the instance has attachments
|
||||
if (class_exists('AttachmentPlugIn')) {
|
||||
$aData['icon'] = utils::GetAbsoluteUrlAppRoot() . AttachmentPlugIn::GetFileIcon($oDocument->GetFileName());
|
||||
$aData['icon'] = utils::GetAbsoluteUrlAppRoot().AttachmentPlugIn::GetFileIcon($oDocument->GetFileName());
|
||||
}
|
||||
|
||||
$aData['att_id'] = $iAttId;
|
||||
|
||||
@@ -117,11 +117,15 @@ class ExceptionListener implements ContainerAwareInterface
|
||||
$oResponse->setStatusCode($iStatusCode);
|
||||
|
||||
// HttpExceptionInterface is a special type of exception that holds status code and header details
|
||||
if ($oException instanceof HttpExceptionInterface)
|
||||
{
|
||||
if ($oException instanceof HttpExceptionInterface) {
|
||||
$oResponse->headers->replace($oException->getHeaders());
|
||||
}
|
||||
|
||||
// display original error page when app debug is on
|
||||
if (($_SERVER['APP_DEBUG'] == 1)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Send the modified response object to the event
|
||||
$oEvent->setResponse($oResponse);
|
||||
}
|
||||
|
||||
@@ -31,6 +31,7 @@ use Combodo\iTop\Form\Field\LabelField;
|
||||
use Combodo\iTop\Form\Form;
|
||||
use Combodo\iTop\Form\FormManager;
|
||||
use Combodo\iTop\Portal\Helper\ApplicationHelper;
|
||||
use Combodo\iTop\Portal\Helper\ObjectFormHandlerHelper;
|
||||
use DBObject;
|
||||
use DBObjectSearch;
|
||||
use DBObjectSet;
|
||||
@@ -42,7 +43,6 @@ use Exception;
|
||||
use InlineImage;
|
||||
use IssueLog;
|
||||
use MetaModel;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
use UserRights;
|
||||
@@ -65,8 +65,6 @@ class ObjectFormManager extends FormManager
|
||||
/** @var string ENUM_MODE_APPLY_STIMULUS */
|
||||
const ENUM_MODE_APPLY_STIMULUS = 'apply_stimulus';
|
||||
|
||||
/** @var \Symfony\Component\DependencyInjection\ContainerInterface $oContainer */
|
||||
protected $oContainer;
|
||||
/** @var \cmdbAbstractObject $oObject */
|
||||
protected $oObject;
|
||||
/** @var string $sMode */
|
||||
@@ -85,6 +83,13 @@ class ObjectFormManager extends FormManager
|
||||
*/
|
||||
protected $aHiddenFieldsId = array();
|
||||
|
||||
/**
|
||||
* @var ObjectFormHandlerHelper $oFormHandlerHelper
|
||||
* @since 3.1.0 Replace container. Allow access to others applications services.
|
||||
*/
|
||||
private $oFormHandlerHelper;
|
||||
|
||||
|
||||
/**
|
||||
* @param string|array $formManagerData value of the formmanager_data portal parameter, either JSON or object
|
||||
*
|
||||
@@ -93,7 +98,7 @@ class ObjectFormManager extends FormManager
|
||||
* @since 2.7.6 3.0.0 N°4384 method creation : factorize as this is used twice now
|
||||
* @since 2.7.7 3.0.1 N°4867 now only used once, but we decided to keep this method anyway
|
||||
*/
|
||||
protected static function DecodeFormManagerData($formManagerData)
|
||||
public static function DecodeFormManagerData($formManagerData)
|
||||
{
|
||||
if (is_array($formManagerData)) {
|
||||
return $formManagerData;
|
||||
@@ -172,23 +177,15 @@ class ObjectFormManager extends FormManager
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return \Symfony\Component\DependencyInjection\ContainerInterface
|
||||
*/
|
||||
public function GetContainer()
|
||||
{
|
||||
return $this->oContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerInterface $oContainer
|
||||
* @param \Combodo\iTop\Portal\Helper\ObjectFormHandlerHelper $oFormHandlerHelper
|
||||
*
|
||||
* @return $this
|
||||
* @since 3.1.0
|
||||
*
|
||||
*/
|
||||
public function SetContainer(ContainerInterface $oContainer)
|
||||
public function SetObjectFormHandlerHelper(ObjectFormHandlerHelper $oFormHandlerHelper)
|
||||
{
|
||||
$this->oContainer = $oContainer;
|
||||
$this->oFormHandlerHelper = $oFormHandlerHelper;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@@ -429,28 +426,21 @@ class ObjectFormManager extends FormManager
|
||||
break;
|
||||
}
|
||||
// - The layout
|
||||
if ($this->aFormProperties['layout'] !== null)
|
||||
{
|
||||
if ($this->aFormProperties['layout'] !== null) {
|
||||
// Checking if we need to render the template from twig to html in order to parse the fields
|
||||
if ($this->aFormProperties['layout']['type'] === 'twig')
|
||||
{
|
||||
if ($this->oContainer !== null)
|
||||
{
|
||||
if ($this->aFormProperties['layout']['type'] === 'twig') {
|
||||
|
||||
if ($this->oFormHandlerHelper !== null) {
|
||||
/** @var \Combodo\iTop\Portal\Helper\ObjectFormHandlerHelper $oObjectFormHandler */
|
||||
$oObjectFormHandler = $this->oContainer->get('object_form_handler');
|
||||
$sRendered = $oObjectFormHandler->RenderFormFromTwig(
|
||||
$sRendered = $this->oFormHandlerHelper->RenderFormFromTwig(
|
||||
$oForm->GetId(),
|
||||
$this->aFormProperties['layout']['content'],
|
||||
array('oRenderer' => $this->oRenderer, 'oObject' => $this->oObject)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sRendered = 'Form not rendered because of missing container';
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$sRendered = $this->aFormProperties['layout']['content'];
|
||||
}
|
||||
|
||||
@@ -742,42 +732,36 @@ class ObjectFormManager extends FormManager
|
||||
}
|
||||
// - Field that require a search endpoint
|
||||
if (in_array(get_class($oField),
|
||||
array('Combodo\\iTop\\Form\\Field\\SelectObjectField', 'Combodo\\iTop\\Form\\Field\\LinkedSetField')))
|
||||
{
|
||||
array('Combodo\\iTop\\Form\\Field\\SelectObjectField', 'Combodo\\iTop\\Form\\Field\\LinkedSetField'))) {
|
||||
/** @var \Combodo\iTop\Form\Field\SelectObjectField|\Combodo\iTop\Form\Field\LinkedSetField $oField */
|
||||
if ($this->oContainer !== null)
|
||||
{
|
||||
$sSearchEndpoint = $this->oContainer->get('url_generator')->generate('p_object_search_generic', array(
|
||||
'sTargetAttCode' => $oAttDef->GetCode(),
|
||||
if ($this->oFormHandlerHelper !== null) {
|
||||
$sSearchEndpoint = $this->oFormHandlerHelper->GetUrlGenerator()->generate('p_object_search_generic', array(
|
||||
'sTargetAttCode' => $oAttDef->GetCode(),
|
||||
'sHostObjectClass' => get_class($this->oObject),
|
||||
'sHostObjectId' => ($this->oObject->IsNew()) ? null : $this->oObject->GetKey(),
|
||||
'ar_token' => $this->GetActionRulesToken(),
|
||||
'sHostObjectId' => ($this->oObject->IsNew()) ? null : $this->oObject->GetKey(),
|
||||
'ar_token' => $this->GetActionRulesToken(),
|
||||
));
|
||||
$oField->SetSearchEndpoint($sSearchEndpoint);
|
||||
}
|
||||
}
|
||||
// - Field that require an information endpoint
|
||||
if (in_array(get_class($oField), array('Combodo\\iTop\\Form\\Field\\LinkedSetField')))
|
||||
{
|
||||
if (in_array(get_class($oField), array('Combodo\\iTop\\Form\\Field\\LinkedSetField'))) {
|
||||
/** @var \Combodo\iTop\Form\Field\LinkedSetField $oField */
|
||||
if ($this->oContainer !== null)
|
||||
{
|
||||
$oField->SetInformationEndpoint($this->oContainer->get('url_generator')->generate('p_object_get_information_json'));
|
||||
if ($this->oFormHandlerHelper !== null) {
|
||||
$oField->SetInformationEndpoint($this->oFormHandlerHelper->GetUrlGenerator()->generate('p_object_get_information_json'));
|
||||
}
|
||||
}
|
||||
// - Field that require to apply scope on its DM OQL
|
||||
if (in_array(get_class($oField), array('Combodo\\iTop\\Form\\Field\\SelectObjectField')))
|
||||
{
|
||||
/** @var \Combodo\iTop\Form\Field\SelectObjectField $oField */
|
||||
if ($this->oContainer !== null)
|
||||
{
|
||||
if ($this->oFormHandlerHelper !== null) {
|
||||
$oScopeOriginal = ($oField->GetSearch() !== null) ? $oField->GetSearch() : DBSearch::FromOQL($oAttDef->GetValuesDef()->GetFilterExpression());
|
||||
|
||||
/** @var \DBSearch $oScopeSearch */
|
||||
$oScopeSearch = $this->oContainer->get('scope_validator')->GetScopeFilterForProfiles(UserRights::ListProfiles(),
|
||||
$oScopeSearch = $this->oFormHandlerHelper->GetScopeValidator()->GetScopeFilterForProfiles(UserRights::ListProfiles(),
|
||||
$oScopeOriginal->GetClass(), UR_ACTION_READ);
|
||||
if ($oScopeSearch === null)
|
||||
{
|
||||
if ($oScopeSearch === null) {
|
||||
IssueLog::Info(__METHOD__.' at line '.__LINE__.' : User #'.UserRights::GetUserId().' has no scope query for '.$oScopeOriginal->GetClass().' class.');
|
||||
throw new HttpException(Response::HTTP_NOT_FOUND, Dict::S('UI:ObjectDoesNotExist'));
|
||||
}
|
||||
@@ -817,15 +801,14 @@ class ObjectFormManager extends FormManager
|
||||
if (in_array(get_class($oCustomField), array('Combodo\\iTop\\Form\\Field\\SelectObjectField')))
|
||||
{
|
||||
/** @var \Combodo\iTop\Form\Field\SelectObjectField $oCustomField */
|
||||
if ($this->oContainer !== null)
|
||||
{
|
||||
if ($this->oFormHandlerHelper->getUrlGenerator() !== null) {
|
||||
|
||||
$sSearchEndpoint = $this->oContainer->get('url_generator')->generate('p_object_search_generic',
|
||||
$sSearchEndpoint = $this->oFormHandlerHelper->GetUrlGenerator()->generate('p_object_search_generic',
|
||||
array(
|
||||
'sTargetAttCode' => $oAttDef->GetCode(),
|
||||
'sTargetAttCode' => $oAttDef->GetCode(),
|
||||
'sHostObjectClass' => get_class($this->oObject),
|
||||
'sHostObjectId' => ($this->oObject->IsNew()) ? null : $this->oObject->GetKey(),
|
||||
'ar_token' => $this->GetActionRulesToken(),
|
||||
'sHostObjectId' => ($this->oObject->IsNew()) ? null : $this->oObject->GetKey(),
|
||||
'ar_token' => $this->GetActionRulesToken(),
|
||||
));
|
||||
$oCustomField->SetSearchEndpoint($sSearchEndpoint);
|
||||
}
|
||||
@@ -860,15 +843,13 @@ class ObjectFormManager extends FormManager
|
||||
/** @var \Combodo\iTop\Form\Field\LinkedSetField $oField */
|
||||
/** @var \AttributeLinkedSetIndirect $oAttDef */
|
||||
// - Overriding attributes to display
|
||||
if ($this->oContainer !== null)
|
||||
{
|
||||
if ($this->oFormHandlerHelper !== null) {
|
||||
// Note : This snippet is inspired from AttributeLinkedSet::MakeFormField()
|
||||
$aAttCodesToDisplay = ApplicationHelper::GetLoadedListFromClass($this->oContainer->getParameter('combodo.portal.instance.conf')['lists'],
|
||||
$aAttCodesToDisplay = ApplicationHelper::GetLoadedListFromClass($this->oFormHandlerHelper->getCombodoPortalConf()['lists'],
|
||||
$oField->GetTargetClass(), 'list');
|
||||
// - Adding friendlyname attribute to the list is not already in it
|
||||
$sTitleAttCode = 'friendlyname';
|
||||
if (($sTitleAttCode !== null) && !in_array($sTitleAttCode, $aAttCodesToDisplay))
|
||||
{
|
||||
if (($sTitleAttCode !== null) && !in_array($sTitleAttCode, $aAttCodesToDisplay)) {
|
||||
$aAttCodesToDisplay = array_merge(array($sTitleAttCode), $aAttCodesToDisplay);
|
||||
}
|
||||
// - Adding attribute labels
|
||||
@@ -881,25 +862,19 @@ class ObjectFormManager extends FormManager
|
||||
$oField->SetAttributesToDisplay($aAttributesToDisplay);
|
||||
}
|
||||
// - Filtering links regarding scopes
|
||||
if ($this->oContainer !== null)
|
||||
{
|
||||
if ($this->oFormHandlerHelper !== null) {
|
||||
$aLimitedAccessItemIDs = array();
|
||||
|
||||
/** @var \ormLinkSet $oFieldOriginalSet */
|
||||
$oFieldOriginalSet = $oField->GetCurrentValue();
|
||||
while ($oLink = $oFieldOriginalSet->Fetch())
|
||||
{
|
||||
if ($oField->IsIndirect())
|
||||
{
|
||||
while ($oLink = $oFieldOriginalSet->Fetch()) {
|
||||
if ($oField->IsIndirect()) {
|
||||
$iRemoteKey = $oLink->Get($oAttDef->GetExtKeyToRemote());
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$iRemoteKey = $oLink->GetKey();
|
||||
}
|
||||
|
||||
if (!$this->oContainer->get('security_helper')->IsActionAllowed(UR_ACTION_READ, $oField->GetTargetClass(), $iRemoteKey))
|
||||
{
|
||||
if (!$this->oFormHandlerHelper->getSecurityHelper()->IsActionAllowed(UR_ACTION_READ, $oField->GetTargetClass(), $iRemoteKey)) {
|
||||
$aLimitedAccessItemIDs[] = $iRemoteKey;
|
||||
}
|
||||
}
|
||||
@@ -921,23 +896,22 @@ class ObjectFormManager extends FormManager
|
||||
if (in_array(get_class($oField), array('Combodo\\iTop\\Form\\Field\\BlobField', 'Combodo\\iTop\\Form\\Field\\ImageField')))
|
||||
{
|
||||
// - Overriding attributes to display
|
||||
if ($this->oContainer !== null)
|
||||
{
|
||||
if ($this->oFormHandlerHelper !== null) {
|
||||
// Override hardcoded URLs in ormDocument pointing to back office console
|
||||
$oOrmDoc = $this->oObject->Get($sAttCode);
|
||||
$sDisplayUrl = $this->oContainer->get('url_generator')->generate('p_object_document_display', [
|
||||
$sDisplayUrl = $this->oFormHandlerHelper->getUrlGenerator()->generate('p_object_document_display', [
|
||||
'sObjectClass' => get_class($this->oObject),
|
||||
'sObjectId' => $this->oObject->GetKey(),
|
||||
'sObjectId' => $this->oObject->GetKey(),
|
||||
'sObjectField' => $sAttCode,
|
||||
'cache' => 86400,
|
||||
's' => $oOrmDoc->GetSignature(),
|
||||
]);
|
||||
$sDownloadUrl = $this->oContainer->get('url_generator')->generate('p_object_document_download', [
|
||||
'cache' => 86400,
|
||||
's' => $oOrmDoc->GetSignature(),
|
||||
]);
|
||||
$sDownloadUrl = $this->oFormHandlerHelper->getUrlGenerator()->generate('p_object_document_download', [
|
||||
'sObjectClass' => get_class($this->oObject),
|
||||
'sObjectId' => $this->oObject->GetKey(),
|
||||
'sObjectId' => $this->oObject->GetKey(),
|
||||
'sObjectField' => $sAttCode,
|
||||
'cache' => 86400,
|
||||
's' => $oOrmDoc->GetSignature(),
|
||||
'cache' => 86400,
|
||||
's' => $oOrmDoc->GetSignature(),
|
||||
]);
|
||||
/** @var \Combodo\iTop\Form\Field\BlobField $oField */
|
||||
$oField->SetDisplayUrl($sDisplayUrl)
|
||||
@@ -1024,11 +998,11 @@ class ObjectFormManager extends FormManager
|
||||
// set id to a unique key - avoid collisions with another attribute that could exist with the name 'attachments'
|
||||
$oField = new FileUploadField('attachments_plugin');
|
||||
$oField->SetLabel(Dict::S('Portal:Attachments'))
|
||||
->SetUploadEndpoint($this->oContainer->get('url_generator')->generate('p_object_attachment_add'))
|
||||
->SetDownloadEndpoint($this->oContainer->get('url_generator')->generate('p_object_attachment_download',
|
||||
->SetUploadEndpoint($this->oFormHandlerHelper->getUrlGenerator()->generate('p_object_attachment_add'))
|
||||
->SetDownloadEndpoint($this->oFormHandlerHelper->getUrlGenerator()->generate('p_object_attachment_download',
|
||||
array('sAttachmentId' => '-sAttachmentId-')))
|
||||
->SetTransactionId($oForm->GetTransactionId())
|
||||
->SetAllowDelete($this->oContainer->getParameter('combodo.portal.instance.conf')['properties']['attachments']['allow_delete'])
|
||||
->SetAllowDelete($this->oFormHandlerHelper->getCombodoPortalConf()['properties']['attachments']['allow_delete'])
|
||||
->SetObject($this->oObject);
|
||||
|
||||
// Checking if we can edit attachments in the current state
|
||||
@@ -1148,7 +1122,7 @@ class ObjectFormManager extends FormManager
|
||||
$bActivateTriggers = (!$bIsNew && $bWasModified);
|
||||
|
||||
// Forcing allowed writing on the object if necessary. This is used in some particular cases.
|
||||
$bAllowWrite = $this->oContainer->get('security_helper')->IsActionAllowed($bIsNew ? UR_ACTION_CREATE : UR_ACTION_MODIFY, $sObjectClass, $this->oObject->GetKey());
|
||||
$bAllowWrite = $this->oFormHandlerHelper->getSecurityHelper()->IsActionAllowed($bIsNew ? UR_ACTION_CREATE : UR_ACTION_MODIFY, $sObjectClass, $this->oObject->GetKey());
|
||||
if ($bAllowWrite) {
|
||||
$this->oObject->AllowWrite(true);
|
||||
}
|
||||
@@ -1181,7 +1155,7 @@ class ObjectFormManager extends FormManager
|
||||
// Activating triggers only on update
|
||||
if ($bActivateTriggers)
|
||||
{
|
||||
$sTriggersQuery = $this->oContainer->getParameter('combodo.portal.instance.conf')['properties']['triggers_query'];
|
||||
$sTriggersQuery = $this->oFormHandlerHelper->getCombodoPortalConf()['properties']['triggers_query'];
|
||||
if ($sTriggersQuery !== null)
|
||||
{
|
||||
$aParentClasses = MetaModel::EnumParentClasses($sObjectClass, ENUM_PARENT_CLASSES_ALL);
|
||||
|
||||
@@ -324,10 +324,9 @@ class ApplicationHelper
|
||||
if (substr($sFieldsetName, 0, 1) !== '_')
|
||||
{
|
||||
$sFieldsetHTML = "\t\t<fieldset>\n";
|
||||
$sFieldsetHTML .= "\t\t\t<legend>".htmlentities(Dict::S($sFieldsetName), ENT_QUOTES, 'UTF-8')."</legend>\n";
|
||||
$sFieldsetHTML .= "\t\t\t<legend>".utils::EscapeHtml(Dict::S($sFieldsetName))."</legend>\n";
|
||||
|
||||
foreach ($aAttCodes as $sAttCode)
|
||||
{
|
||||
foreach ($aAttCodes as $sAttCode) {
|
||||
$sFieldsetHTML .= "\t\t\t<div class=\"form_field\" data-field-id=\"".$sAttCode."\"></div>\n";
|
||||
}
|
||||
|
||||
|
||||
@@ -81,8 +81,6 @@ class ObjectFormHandlerHelper
|
||||
private $sPortalId;
|
||||
/** @var \Combodo\iTop\Portal\Twig\AppExtension $oAppExtension */
|
||||
private $oAppExtension;
|
||||
/** @var \Symfony\Component\DependencyInjection\ContainerInterface $oContainer */
|
||||
private $oContainer;
|
||||
|
||||
/**
|
||||
* ObjectFormHandlerHelper constructor.
|
||||
@@ -96,9 +94,11 @@ class ObjectFormHandlerHelper
|
||||
* @param array $aCombodoPortalInstanceConf
|
||||
* @param string $sPortalId
|
||||
* @param \Combodo\iTop\Portal\Twig\AppExtension $oAppExtension
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerInterface $oContainer
|
||||
*/
|
||||
public function __construct(RequestManipulatorHelper $oRequestManipulator, ContextManipulatorHelper $oContextManipulator, NavigationRuleHelper $oNavigationRuleHelper, ScopeValidatorHelper $oScopeValidator, SecurityHelper $oSecurityHelper, UrlGeneratorInterface $oUrlGenerator, $aCombodoPortalInstanceConf, $sPortalId, AppExtension $oAppExtension, ContainerInterface $oContainer)
|
||||
public function __construct(
|
||||
RequestManipulatorHelper $oRequestManipulator, ContextManipulatorHelper $oContextManipulator, NavigationRuleHelper $oNavigationRuleHelper, ScopeValidatorHelper $oScopeValidator, SecurityHelper $oSecurityHelper, UrlGeneratorInterface $oUrlGenerator, $aCombodoPortalInstanceConf, $sPortalId,
|
||||
AppExtension $oAppExtension
|
||||
)
|
||||
{
|
||||
$this->oRequestManipulator = $oRequestManipulator;
|
||||
$this->oContextManipulator = $oContextManipulator;
|
||||
@@ -109,7 +109,6 @@ class ObjectFormHandlerHelper
|
||||
$this->aCombodoPortalInstanceConf = $aCombodoPortalInstanceConf;
|
||||
$this->sPortalId = $sPortalId;
|
||||
$this->oAppExtension = $oAppExtension;
|
||||
$this->oContainer = $oContainer;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -271,13 +270,13 @@ class ObjectFormHandlerHelper
|
||||
}
|
||||
|
||||
$oFormRenderer = new BsFormRenderer();
|
||||
if($sFormEndpoint !== null)
|
||||
{
|
||||
if ($sFormEndpoint !== null) {
|
||||
$oFormRenderer->SetEndpoint($sFormEndpoint);
|
||||
}
|
||||
|
||||
$oFormManager = new ObjectFormManager();
|
||||
$oFormManager->SetContainer($this->oContainer)
|
||||
$oFormManager
|
||||
->SetObjectFormHandlerHelper($this)
|
||||
->SetObject($oObject)
|
||||
->SetMode($sMode)
|
||||
->SetActionRulesToken($sActionRulesToken)
|
||||
@@ -301,7 +300,7 @@ class ObjectFormHandlerHelper
|
||||
|
||||
$this->CheckReadFormDataAllowed($sFormManagerData);
|
||||
$oFormManager = $sFormManagerClass::FromJSON($sFormManagerData);
|
||||
$oFormManager->SetContainer($this->oContainer);
|
||||
$oFormManager->SetObjectFormHandlerHelper($this);
|
||||
|
||||
// Applying action rules if present
|
||||
if (($oFormManager->GetActionRulesToken() !== null) && ($oFormManager->GetActionRulesToken() !== '')) {
|
||||
@@ -441,9 +440,9 @@ class ObjectFormHandlerHelper
|
||||
/**
|
||||
* Check if read object include in form data is allowed, throw an exception otherwise.
|
||||
*
|
||||
* @since 2.7.7
|
||||
* @since 2.7.7 3.0.2 3.1.0
|
||||
*
|
||||
* @param $sFormManagerData form data to check
|
||||
* @param string $sFormManagerData form data to check
|
||||
*
|
||||
* @return void
|
||||
* @throws \CoreException
|
||||
@@ -452,8 +451,9 @@ class ObjectFormHandlerHelper
|
||||
* @throws \MySQLHasGoneAwayException
|
||||
* @throws \OQLException
|
||||
*/
|
||||
public function CheckReadFormDataAllowed($sFormManagerData){
|
||||
$aJsonFromData = json_decode($sFormManagerData, true);
|
||||
public function CheckReadFormDataAllowed($sFormManagerData)
|
||||
{
|
||||
$aJsonFromData = ObjectFormManager::DecodeFormManagerData($sFormManagerData);
|
||||
if(isset($aJsonFromData['formobject_class'])
|
||||
&& isset($aJsonFromData['formobject_id'])
|
||||
&& !$this->oSecurityHelper->IsActionAllowed(UR_ACTION_READ, $aJsonFromData['formobject_class'], $aJsonFromData['formobject_id'])){
|
||||
@@ -475,4 +475,44 @@ class ObjectFormHandlerHelper
|
||||
static::ENUM_MODE_CREATE,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Combodo\iTop\Portal\Routing\UrlGenerator|\Symfony\Component\Routing\Generator\UrlGeneratorInterface
|
||||
* @since 3.1
|
||||
*
|
||||
*/
|
||||
public function getUrlGenerator()
|
||||
{
|
||||
return $this->oUrlGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Combodo\iTop\Portal\Helper\SecurityHelper
|
||||
* @since 3.1
|
||||
*
|
||||
*/
|
||||
public function getSecurityHelper(): SecurityHelper
|
||||
{
|
||||
return $this->oSecurityHelper;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \Combodo\iTop\Portal\Helper\ScopeValidatorHelper
|
||||
* @since 3.1.0
|
||||
*
|
||||
*/
|
||||
public function GetScopeValidator(): ScopeValidatorHelper
|
||||
{
|
||||
return $this->oScopeValidator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @since 3.1.0
|
||||
*
|
||||
*/
|
||||
public function GetCombodoPortalConf(): array
|
||||
{
|
||||
return $this->aCombodoPortalInstanceConf;
|
||||
}
|
||||
}
|
||||
@@ -89,13 +89,13 @@ class RequestManipulatorHelper
|
||||
*
|
||||
* @param string $sKey
|
||||
* @param mixed $default
|
||||
* @param int $iFilter Default is FILTER_SANITIZE_STRING
|
||||
* @param int $iFilter Default is FILTER_SANITIZE_SPECIAL_CHARS
|
||||
*
|
||||
* @return mixed|null
|
||||
*
|
||||
* @since 2.5.1
|
||||
*/
|
||||
public function ReadParam($sKey, $default = null, $iFilter = FILTER_SANITIZE_STRING)
|
||||
public function ReadParam($sKey, $default = null, $iFilter = FILTER_SANITIZE_SPECIAL_CHARS)
|
||||
{
|
||||
if ($this->GetCurrentRequest()->query->has($sKey))
|
||||
{
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
namespace Combodo\iTop\Portal\Helper;
|
||||
|
||||
use LogChannels;
|
||||
use UserRights;
|
||||
use IssueLog;
|
||||
use MetaModel;
|
||||
@@ -95,11 +96,7 @@ class SecurityHelper
|
||||
// Checking action type
|
||||
if (!in_array($sAction, array(UR_ACTION_READ, UR_ACTION_MODIFY, UR_ACTION_CREATE)))
|
||||
{
|
||||
if ($this->bDebug)
|
||||
{
|
||||
IssueLog::Info($sDebugTracePrefix.' as the action value could not be understood ('.UR_ACTION_READ.'/'.UR_ACTION_MODIFY.'/'.UR_ACTION_CREATE.' expected');
|
||||
}
|
||||
|
||||
IssueLog::Debug($sDebugTracePrefix.' as the action value could not be understood ('.UR_ACTION_READ.'/'.UR_ACTION_MODIFY.'/'.UR_ACTION_CREATE.' expected', LogChannels::PORTAL);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -116,11 +113,7 @@ class SecurityHelper
|
||||
$oScopeQuery = $this->oScopeValidator->GetScopeFilterForProfiles(UserRights::ListProfiles(), $sObjectClass, $sScopeAction);
|
||||
if ($oScopeQuery === null)
|
||||
{
|
||||
if ($this->bDebug)
|
||||
{
|
||||
IssueLog::Info($sDebugTracePrefix.' as there was no scope defined for action '.$sScopeAction.' and profiles '.implode('/', UserRights::ListProfiles()));
|
||||
}
|
||||
|
||||
IssueLog::Debug($sDebugTracePrefix.' as there was no scope defined for action '.$sScopeAction.' and profiles '.implode('/', UserRights::ListProfiles()), LogChannels::PORTAL);
|
||||
return false;
|
||||
}
|
||||
// - If action != create we do some additionnal checks
|
||||
@@ -134,11 +127,7 @@ class SecurityHelper
|
||||
{
|
||||
if (static::$aAllowedScopeObjectsCache[$sScopeAction][$sObjectClass][$sObjectId] === false)
|
||||
{
|
||||
if ($this->bDebug)
|
||||
{
|
||||
IssueLog::Info($sDebugTracePrefix.' as it was denied in the scope objects cache');
|
||||
}
|
||||
|
||||
IssueLog::Debug($sDebugTracePrefix.' as it was denied in the scope objects cache', LogChannels::PORTAL);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -163,11 +152,7 @@ class SecurityHelper
|
||||
// Updating cache
|
||||
static::$aAllowedScopeObjectsCache[$sScopeAction][$sObjectClass][$sObjectId] = false;
|
||||
|
||||
if ($this->bDebug)
|
||||
{
|
||||
IssueLog::Info($sDebugTracePrefix.' as there was no result for the following scope query : '.$oScopeQuery->ToOQL(true));
|
||||
}
|
||||
|
||||
IssueLog::Debug($sDebugTracePrefix.' as there was no result for the following scope query : '.$oScopeQuery->ToOQL(true), LogChannels::PORTAL);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -180,13 +165,9 @@ class SecurityHelper
|
||||
// Checking reading security layer. The object could be listed, check if it is actually allowed to view it
|
||||
if (UserRights::IsActionAllowed($sObjectClass, $sAction) == UR_ALLOWED_NO)
|
||||
{
|
||||
// For security reasons, we don't want to give the user too many informations on why he cannot access the object.
|
||||
// For security reasons, we don't want to give the user too many information on why he cannot access the object.
|
||||
//throw new SecurityException('User not allowed to view this object', array('class' => $sObjectClass, 'id' => $sObjectId));
|
||||
if ($this->bDebug)
|
||||
{
|
||||
IssueLog::Info($sDebugTracePrefix.' as the user is not allowed to access this object according to the datamodel security (cf. Console settings)');
|
||||
}
|
||||
|
||||
IssueLog::Debug($sDebugTracePrefix.' as the user is not allowed to access this object according to the datamodel security (cf. Console settings)', LogChannels::PORTAL);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ use ArrayIterator;
|
||||
use Combodo\iTop\Application\Helper\Session;
|
||||
use IteratorAggregate;
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
use Traversable;
|
||||
use utils;
|
||||
|
||||
/**
|
||||
@@ -98,9 +99,9 @@ class SessionMessageHelper implements IteratorAggregate
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \ArrayIterator|\Traversable
|
||||
* @return \ArrayIterator|\Traversable (\Traversable is the return type from the interface, \ArrayIterator is what we actually return)
|
||||
*/
|
||||
public function getIterator()
|
||||
public function getIterator(): Traversable
|
||||
{
|
||||
$this->FetchMessages();
|
||||
|
||||
@@ -161,9 +162,11 @@ class SessionMessageHelper implements IteratorAggregate
|
||||
}
|
||||
|
||||
$sMsgMetadata = '';
|
||||
foreach ($aMessageData['metadata'] as $sMetadatumName => $sMetadatumValue)
|
||||
{
|
||||
$sMsgMetadata .= 'data-'.str_replace('_', '-', $sMetadatumName).'="'.utils::HtmlEntities($sMetadatumValue).'" ';
|
||||
// Protection for missing metadata entry when session messages are not created from the portal
|
||||
if (isset($aMessageData['metadata'])) {
|
||||
foreach ($aMessageData['metadata'] as $sMetadatumName => $sMetadatumValue) {
|
||||
$sMsgMetadata .= 'data-'.str_replace('_', '-', $sMetadatumName).'="'.utils::HtmlEntities($sMetadatumValue).'" ';
|
||||
}
|
||||
}
|
||||
$aObjectMessages[] = array('css_classes' => $sMsgClass, 'message' => $aMessageData['message'], 'metadata' => $sMsgMetadata);
|
||||
$aRanks[] = $aMessageData['rank'];
|
||||
|
||||
@@ -21,11 +21,10 @@ namespace Combodo\iTop\Portal;
|
||||
|
||||
use DeprecatedCallsLog;
|
||||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||
use Symfony\Component\Config\Resource\FileResource;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
|
||||
use Symfony\Component\HttpKernel\Kernel as BaseKernel;
|
||||
use Symfony\Component\Routing\RouteCollectionBuilder;
|
||||
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
|
||||
use utils;
|
||||
|
||||
/**
|
||||
@@ -36,7 +35,7 @@ use utils;
|
||||
*/
|
||||
class Kernel extends BaseKernel
|
||||
{
|
||||
use MicroKernelTrait;
|
||||
use MicroKernelTrait;
|
||||
|
||||
/** @var string CONFIG_EXTS */
|
||||
const CONFIG_EXTS = '.{php,xml,yaml,yml}';
|
||||
@@ -45,11 +44,11 @@ class Kernel extends BaseKernel
|
||||
* @return string
|
||||
*/
|
||||
public function getCacheDir()
|
||||
{
|
||||
$cacheDir = $_ENV['PORTAL_ID'] . '-' . $this->environment;
|
||||
{
|
||||
$cacheDir = $_ENV['PORTAL_ID'].'-'.$this->environment;
|
||||
|
||||
return utils::GetCachePath() . "/portals/$cacheDir";
|
||||
}
|
||||
return utils::GetCachePath()."/portals/$cacheDir";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
@@ -69,42 +68,43 @@ class Kernel extends BaseKernel
|
||||
$contents = require $this->getProjectDir().'/config/bundles.php';
|
||||
foreach ($contents as $class => $envs) {
|
||||
if (isset($envs[$this->environment]) || isset($envs['all'])) {
|
||||
yield new $class();
|
||||
yield new $class();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Symfony\Component\DependencyInjection\ContainerBuilder $container
|
||||
* @param \Symfony\Component\Config\Loader\LoaderInterface $loader
|
||||
* @param \Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator $container
|
||||
*
|
||||
* @throws \Exception
|
||||
* @return void
|
||||
*/
|
||||
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
|
||||
{
|
||||
$container->addResource(new FileResource($this->getProjectDir().'/config/bundles.php'));
|
||||
$container->setParameter('container.dumper.inline_class_loader', true);
|
||||
$confDir = $this->getProjectDir().'/config';
|
||||
protected function configureContainer(ContainerConfigurator $container)
|
||||
{
|
||||
$confDir = '../config';
|
||||
|
||||
$loader->load($confDir.'/{packages}/*'.self::CONFIG_EXTS, 'glob');
|
||||
$loader->load($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, 'glob');
|
||||
$loader->load($confDir.'/{services}'.self::CONFIG_EXTS, 'glob');
|
||||
$loader->load($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS, 'glob');
|
||||
}
|
||||
$container->import(new FileResource($this->getProjectDir().'/config/bundles.php'));
|
||||
$container->parameters()->set('container.dumper.inline_class_loader', true);
|
||||
|
||||
$container->import($confDir.'/{packages}/*'.self::CONFIG_EXTS);
|
||||
$container->import($confDir.'/{packages}/'.$this->environment.'/**/*'.self::CONFIG_EXTS);
|
||||
$container->import($confDir.'/{services}'.self::CONFIG_EXTS);
|
||||
$container->import($confDir.'/{services}_'.$this->environment.self::CONFIG_EXTS);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param \Symfony\Component\Routing\RouteCollectionBuilder $routes
|
||||
* @param \Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator $routes
|
||||
*
|
||||
* @throws \Symfony\Component\Config\Exception\FileLoaderLoadException
|
||||
* @return void
|
||||
*/
|
||||
protected function configureRoutes(RouteCollectionBuilder $routes)
|
||||
{
|
||||
$confDir = $this->getProjectDir().'/config';
|
||||
protected function configureRoutes(RoutingConfigurator $routes)
|
||||
{
|
||||
$confDir = '../config';
|
||||
|
||||
$routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS);
|
||||
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS);
|
||||
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS);
|
||||
}
|
||||
|
||||
$routes->import($confDir.'/{routes}/'.$this->environment.'/**/*'.self::CONFIG_EXTS, '/', 'glob');
|
||||
$routes->import($confDir.'/{routes}/*'.self::CONFIG_EXTS, '/', 'glob');
|
||||
$routes->import($confDir.'/{routes}'.self::CONFIG_EXTS, '/', 'glob');
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a given class name belongs to an active bundle.
|
||||
|
||||
@@ -34,6 +34,12 @@ class ItopExtensionsExtraRoutes
|
||||
/** @var array $aRoutes */
|
||||
static private $aRoutes = array();
|
||||
|
||||
/**
|
||||
* @var array $aControllersClasses
|
||||
* @since 3.1.0
|
||||
*/
|
||||
static private $aControllersClasses = array();
|
||||
|
||||
/**
|
||||
* @param array $extraRoutes
|
||||
*
|
||||
@@ -41,8 +47,7 @@ class ItopExtensionsExtraRoutes
|
||||
*/
|
||||
public static function AddRoutes($extraRoutes)
|
||||
{
|
||||
if (!is_array($extraRoutes))
|
||||
{
|
||||
if (!is_array($extraRoutes)) {
|
||||
throw new Exception('Only array are allowed as parameter to '.__METHOD__);
|
||||
}
|
||||
|
||||
@@ -56,4 +61,28 @@ class ItopExtensionsExtraRoutes
|
||||
{
|
||||
return self::$aRoutes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $extraControllersClasses
|
||||
*
|
||||
* @throws Exception
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public static function AddControllersClasses($extraControllersClasses)
|
||||
{
|
||||
if (!is_array($extraControllersClasses)) {
|
||||
throw new Exception('Only array are allowed as parameter to '.__METHOD__);
|
||||
}
|
||||
|
||||
self::$aControllersClasses = array_merge(self::$aControllersClasses, $extraControllersClasses);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
* @since 3.1.0
|
||||
*/
|
||||
public static function GetControllersClasses()
|
||||
{
|
||||
return self::$aControllersClasses;
|
||||
}
|
||||
}
|
||||
@@ -56,20 +56,9 @@ class AppVariable implements ArrayAccess
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a offset exists
|
||||
* @link https://php.net/manual/en/arrayaccess.offsetexists.php
|
||||
*
|
||||
* @param mixed $offset <p>
|
||||
* An offset to check for.
|
||||
* </p>
|
||||
*
|
||||
* @return boolean true on success or false on failure.
|
||||
* </p>
|
||||
* <p>
|
||||
* The return value will be casted to boolean if non-boolean was returned.
|
||||
* @since 5.0.0
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function offsetExists($offset)
|
||||
public function offsetExists($offset): bool
|
||||
{
|
||||
if ($this->container->hasParameter($offset)) {
|
||||
return true;
|
||||
@@ -82,43 +71,25 @@ class AppVariable implements ArrayAccess
|
||||
}
|
||||
|
||||
/**
|
||||
* Offset to retrieve
|
||||
* @link https://php.net/manual/en/arrayaccess.offsetget.php
|
||||
*
|
||||
* @param mixed $offset <p>
|
||||
* The offset to retrieve.
|
||||
* </p>
|
||||
*
|
||||
* @return mixed Can return all value types.
|
||||
* @since 5.0.0
|
||||
* @inheritDoc
|
||||
*/
|
||||
#[\ReturnTypeWillChange]
|
||||
public function offsetGet($offset)
|
||||
{
|
||||
if ($this->container->hasParameter($offset)) {
|
||||
return $this->container->getParameter($offset);
|
||||
}
|
||||
if ($this->container->has($offset)) {
|
||||
return $this->container->get($offset);
|
||||
}
|
||||
if ($this->container->hasParameter($offset)) {
|
||||
return $this->container->getParameter($offset);
|
||||
}
|
||||
if ($this->container->has($offset)) {
|
||||
return $this->container->get($offset);
|
||||
}
|
||||
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Offset to set
|
||||
* @link https://php.net/manual/en/arrayaccess.offsetset.php
|
||||
*
|
||||
* @param mixed $offset <p>
|
||||
* The offset to assign the value to.
|
||||
* </p>
|
||||
* @param mixed $value <p>
|
||||
* The value to set.
|
||||
* </p>
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.0
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function offsetSet($offset, $value)
|
||||
public function offsetSet($offset, $value): void
|
||||
{
|
||||
|
||||
if ($this->container->hasParameter($offset)) {
|
||||
@@ -137,29 +108,17 @@ class AppVariable implements ArrayAccess
|
||||
}
|
||||
|
||||
$this->container->setParameter($offset, $value);
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Offset to unset
|
||||
* @link https://php.net/manual/en/arrayaccess.offsetunset.php
|
||||
*
|
||||
* @param mixed $offset <p>
|
||||
* The offset to unset.
|
||||
* </p>
|
||||
*
|
||||
* @return void
|
||||
* @since 5.0.0
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function offsetUnset($offset){
|
||||
public function offsetUnset($offset): void
|
||||
{
|
||||
if ($this->container->hasParameter($offset)) {
|
||||
$this->container->setParameter($offset, null);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->container->has($offset)) {
|
||||
$this->container->set($offset, null);
|
||||
return;
|
||||
} else if ($this->container->has($offset)) {
|
||||
$this->container->set($offset, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -312,7 +312,7 @@
|
||||
{% block pNavigationSideMenuLogo %}
|
||||
{# This is a debug helper to know in which screen size we are #}
|
||||
{% if app['kernel'].debug == true %}
|
||||
<div style="position: fixed; bottom: 0px; left: 0px; z-index: 9999;">Debug : Taille <span class="hidden-sm hidden-md hidden-lg">XS</span><span class="hidden-xs hidden-md hidden-lg">SM</span><span class="hidden-xs hidden-sm hidden-lg">MD</span><span class="hidden-xs hidden-sm hidden-md">LG</span></div>
|
||||
<div style="position: fixed; bottom: 0px; left: 0px; z-index: 9999;">Debug: Screen size <span class="hidden-sm hidden-md hidden-lg">XS</span><span class="hidden-xs hidden-md hidden-lg">SM</span><span class="hidden-xs hidden-sm hidden-lg">MD</span><span class="hidden-xs hidden-sm hidden-md">LG</span></div>
|
||||
{% endif %}
|
||||
<a href="{{ get_config_parameter('app_icon_url') }}" title="{{ app['combodo.portal.instance.conf'].properties.name|dict_s }}">
|
||||
<img src="{{ app['combodo.portal.instance.conf'].properties.logo }}" alt="{{ app['combodo.portal.instance.conf'].properties.name|dict_s }}" />
|
||||
|
||||
Reference in New Issue
Block a user