pouvoir forcer l'utilisation d'un theme (fixes #31090)

This commit is contained in:
afornerot 2021-03-03 16:34:28 +01:00
parent 563cc48200
commit 97cf0a727b
3 changed files with 42 additions and 0 deletions

View File

@ -127,6 +127,9 @@
<variable type='string' name='ninegate_keyterm' description="Durée de validité du jeton d'inscription" mandatory='True'><value>8</value></variable>
<variable type='string' name='ninegate_minpassword' description="Taille minimun du password" mandatory='True'><value>8</value></variable>
<variable type='oui/non' name='ninegate_forcetheme' description="Forcer l'utilisation d'un thème"><value>non</value></variable>
<variable type='string' name='ninegate_forcethemename' description="Nom du thème"><value></value></variable>
<!-- MODULE PORTAL -->
<variable type="oui/non" name='ninegate_activate_portal' description='Activer le module portail' mandatory='True'>
@ -494,6 +497,8 @@
<target type='variable'>ninegate_moderegistration</target>
<target type='variable'>ninegate_keyterm</target>
<target type='variable'>ninegate_minpassword</target>
<target type='variable'>ninegate_forcetheme</target>
<target type='variable'>ninegate_forcethemename</target>
<target type='variable'>ninegate_activate_portal</target>
<target type='variable'>ninegate_activate_page</target>
@ -699,6 +704,13 @@
<target type='variable'>ninegate_addomaineprofil</target>
</condition>
<!-- AFFICHAGE EN FONCTION DU FORCE THEME -->
<condition name='hidden_if_in' source='ninegate_forcetheme'>
<param>non</param>
<target type='variable'>ninegate_forcethemename</target>
</condition>
<!-- AFFICHAGE EN FONCTION DU MODULE PORTAL -->
<condition name='hidden_if_in' source='ninegate_activate_portal'>
<param>non</param>

View File

@ -237,6 +237,27 @@ class InitDataCommand extends ContainerAwareCommand
$this->addModeration($profil,'cadoles_cron_config_log',0);
}
// Forcer le theme
$force_theme=$this->getContainer()->getParameter('force_theme');
if($force_theme) {
// On force la configuration du theme
$force_themename=$this->getContainer()->getParameter('force_themename');
$config = $em->getRepository('CadolesCoreBundle:Config')->find("theme");
if($config) {
$config->setValue($force_themename);
$em->persist($config);
$em->flush();
}
// On enlève l'accès de la sidebar
$sidebar = $em->getRepository('CadolesCoreBundle:Sidebar')->findOneBy(["path"=>"cadoles_core_config_theme"]);
if($sidebar) {
$em->remove($sidebar);
$em->flush();
}
}
$output->writeln('');
}

View File

@ -30,6 +30,15 @@ parameters:
%end if
initpwdadmin: %%getVar("ninegate_pwdadmin", '')
# Force theme
%if %%getVar("ninegate_forcetheme", 'non') == "oui"
force_theme: true
force_themename: %%ninegate_forcethemename
%else
force_theme: false
force_themename:
%end if
# Activation module
%if %%getVar("ninegate_activate_cron", 'non') == "oui"
cron_activate: true