This commit is contained in:
afornerot 2022-12-05 16:10:39 +01:00
parent b19b9a50c4
commit e04e359feb
11 changed files with 175 additions and 101 deletions

View File

@ -11,6 +11,14 @@ imports:
parameters: parameters:
locale: fr locale: fr
monolog:
handlers:
main:
type: rotating_file
path: '%kernel.logs_dir%/%kernel.environment%.log'
level: debug
max_files: 10
framework: framework:
#esi: ~ #esi: ~
#translator: { fallbacks: ['%locale%'] } #translator: { fallbacks: ['%locale%'] }

View File

@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
export HTTP_PROXY="192.168.57.160:8080"
export HTTPS_PROXY="192.168.57.160:8080"
cd /var/www/html/ninestat cd /var/www/html/ninestat

View File

@ -1,8 +1,5 @@
#!/bin/bash #!/bin/bash
# Suppression des logs trop ancien
find var/logs -mindepth 1 -mtime +7 -delete
# Installation des dépendances composer # Installation des dépendances composer
composer install composer install

View File

@ -48,7 +48,7 @@ class PurgeServerCommand extends Command
$this->writelnred('=========================================================================================================='); $this->writelnred('==========================================================================================================');
$now=new \DateTime('now'); $now=new \DateTime('now');
$now->sub(new \DateInterval('P3M')); $now->sub(new \DateInterval('P6M'));
$servers=$this->em->getRepository("CadolesCoreBundle:Server")->findAll(); $servers=$this->em->getRepository("CadolesCoreBundle:Server")->findAll();
foreach($servers as $server) { foreach($servers as $server) {

View File

@ -4,7 +4,7 @@ SET foreign_key_checks = 0;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
INSERT IGNORE INTO `user` (`id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`) VALUES INSERT IGNORE INTO `user` (`id`, `username`, `firstname`, `lastname`, `password`, `email`, `avatar`, `role`) VALUES
(-100, 'admin', 'Administrateur', 'STAT', '{SSHA}euZCgZjWhBu0xUZI9lPK2ncV9oaB+Jqo', 'admin@ldapbundle.ac-arno.fr', 'admin.jpg', 'ROLE_ADMIN'); (-100, 'admin', 'Administrateur', 'STAT', '{SSHA}euZCgZjWhBu0xUZI9lPK2ncV9oaB+Jqo', 'tina-boot@ac-dijon.fr', 'admin.jpg', 'ROLE_ADMIN');
@ -31,7 +31,7 @@ INSERT IGNORE INTO `config` (`order`, `visible`, `changeable`, `required`, `type
('060', 1, 1, 1, 'font', 'fontfacetitle', 'Anton-Regular', '', 'Police des titres de votre site'), ('060', 1, 1, 1, 'font', 'fontfacetitle', 'Anton-Regular', '', 'Police des titres de votre site'),
('061', 1, 1, 1, 'font', 'fontfacebody', 'Helvetica', '', 'Police des titres de votre site'), ('061', 1, 1, 1, 'font', 'fontfacebody', 'Helvetica', '', 'Police des titres de votre site'),
('200', 1, 0, 1, 'boolean', 'PROXYactivate', '1', '', 'Définit un Proxy'), ('200', 1, 0, 1, 'boolean', 'PROXYactivate', '0', '', 'Définit un Proxy'),
('201', 1, 0, 1, 'string', 'PROXYserver', '192.168.57.160', 'PROXYactivate','Adresse du Proxy'), ('201', 1, 0, 1, 'string', 'PROXYserver', '', 'PROXYactivate','Adresse du Proxy'),
('202', 1, 0, 1, 'string', 'PROXYport', '8080', 'PROXYactivate','Port du Proxy'); ('202', 1, 0, 1, 'string', 'PROXYport', '', 'PROXYactivate','Port du Proxy');

View File

@ -44,10 +44,10 @@ class CoreController extends Controller
$response = \Unirest\Request::get($url.'/rest/user/'.$masterapikey.'/'.$user->getUsername(),$headers,$query); $response = \Unirest\Request::get($url.'/rest/user/'.$masterapikey.'/'.$user->getUsername(),$headers,$query);
// Mise à jour du user // Mise à jour du user
if($response->code!=500) {
$user->setAvatar($response->body->user->avatar); $user->setAvatar($response->body->user->avatar);
$user->setRole($response->body->user->role); $user->setRole($response->body->user->role);
$em->persist($user); $em->persist($user);
$em->flush();
// Mise à jour des groupes // Mise à jour des groupes
$groups=$response->body->groups; $groups=$response->body->groups;
@ -66,6 +66,8 @@ class CoreController extends Controller
// Sauvegarde en session des groupes de l'utilisateur // Sauvegarde en session des groupes de l'utilisateur
$this->get('session')->set("groups",$groups); $this->get('session')->set("groups",$groups);
$em->flush();
}
} }
@ -150,7 +152,7 @@ class CoreController extends Controller
]); ]);
} }
public function acadAction($acad, Request $request) public function acadAction($acad, $application="all", Request $request)
{ {
$em = $this->getDoctrine()->getManager(); $em = $this->getDoctrine()->getManager();
$user=$this->getUser(); $user=$this->getUser();
@ -164,6 +166,15 @@ class CoreController extends Controller
->where('s.etab=e') ->where('s.etab=e')
->andWhere('e.libelle_academie=:acad') ->andWhere('e.libelle_academie=:acad')
->setParameter('acad',$acad); ->setParameter('acad',$acad);
if($application!="all") {
$servers->from('CadolesCoreBundle:ServerApplication','sa')
->from('CadolesCoreBundle:Application','a')
->andWhere('sa.server=s')
->andWhere('sa.application=a')
->andWhere('a.name=:application')
->setParameter('application',$application);
}
// Total by module // Total by module
$totalmodules = $em->createQueryBuilder() $totalmodules = $em->createQueryBuilder()
@ -176,6 +187,14 @@ class CoreController extends Controller
->groupBy('s.module') ->groupBy('s.module')
->orderBy('total','DESC') ->orderBy('total','DESC')
->addOrderBy('label','ASC'); ->addOrderBy('label','ASC');
if($application!="all") {
$totalmodules->from('CadolesCoreBundle:ServerApplication','sa')
->from('CadolesCoreBundle:Application','a')
->andWhere('sa.server=s')
->andWhere('sa.application=a')
->andWhere('a.name=:application')
->setParameter('application',$application);
}
// Total by version // Total by version
$totalversions = $em->createQueryBuilder() $totalversions = $em->createQueryBuilder()
@ -188,6 +207,14 @@ class CoreController extends Controller
->groupBy('s.version') ->groupBy('s.version')
->orderBy('total','DESC') ->orderBy('total','DESC')
->addOrderBy('label','ASC'); ->addOrderBy('label','ASC');
if($application!="all") {
$totalversions->from('CadolesCoreBundle:ServerApplication','sa')
->from('CadolesCoreBundle:Application','a')
->andWhere('sa.server=s')
->andWhere('sa.application=a')
->andWhere('a.name=:application')
->setParameter('application',$application);
}
// Total by Secteur // Total by Secteur
$totalbysecteurs = $em->createQueryBuilder() $totalbysecteurs = $em->createQueryBuilder()
@ -200,6 +227,14 @@ class CoreController extends Controller
->groupBy('e.secteur_public_prive_libe') ->groupBy('e.secteur_public_prive_libe')
->orderBy('total','DESC') ->orderBy('total','DESC')
->addOrderBy('label','ASC'); ->addOrderBy('label','ASC');
if($application!="all") {
$totalbysecteurs->from('CadolesCoreBundle:ServerApplication','sa')
->from('CadolesCoreBundle:Application','a')
->andWhere('sa.server=s')
->andWhere('sa.application=a')
->andWhere('a.name=:application')
->setParameter('application',$application);
}
// Total by Nature // Total by Nature
$totalbynatures = $em->createQueryBuilder() $totalbynatures = $em->createQueryBuilder()
@ -212,6 +247,14 @@ class CoreController extends Controller
->groupBy('e.nature_uai_libe') ->groupBy('e.nature_uai_libe')
->orderBy('total','DESC') ->orderBy('total','DESC')
->addOrderBy('label','ASC'); ->addOrderBy('label','ASC');
if($application!="all") {
$totalbynatures->from('CadolesCoreBundle:ServerApplication','sa')
->from('CadolesCoreBundle:Application','a')
->andWhere('sa.server=s')
->andWhere('sa.application=a')
->andWhere('a.name=:application')
->setParameter('application',$application);
}
// Total applications // Total applications
$applications = $em->createQueryBuilder() $applications = $em->createQueryBuilder()
@ -225,6 +268,10 @@ class CoreController extends Controller
->andWhere('sa.server=s') ->andWhere('sa.server=s')
->andWhere(('sa.application=a')) ->andWhere(('sa.application=a'))
->setParameter('acad',$acad); ->setParameter('acad',$acad);
if($application!="all") {
$applications->andWhere('a.name=:application')
->setParameter('application',$application);
}
// Total by apps // Total by apps
$totalapplications = $em->createQueryBuilder() $totalapplications = $em->createQueryBuilder()
@ -241,6 +288,10 @@ class CoreController extends Controller
->groupBy('a.package') ->groupBy('a.package')
->orderBy('total','DESC') ->orderBy('total','DESC')
->addOrderBy('label','ASC'); ->addOrderBy('label','ASC');
if($application!="all") {
$totalapplications->andWhere('a.name=:application')
->setParameter('application',$application);
}
// Servers // Servers
$etabs = $em->createQueryBuilder() $etabs = $em->createQueryBuilder()
@ -264,6 +315,7 @@ class CoreController extends Controller
'totalbysecteurs' => $totalbysecteurs->getQuery()->getResult(), 'totalbysecteurs' => $totalbysecteurs->getQuery()->getResult(),
'totalbynatures' => $totalbynatures->getQuery()->getResult(), 'totalbynatures' => $totalbynatures->getQuery()->getResult(),
'by' => "acad", 'by' => "acad",
'ssby' => $application,
'servers' => $servers->getQuery()->getResult(), 'servers' => $servers->getQuery()->getResult(),
'byname' => $acad, 'byname' => $acad,
]); ]);

View File

@ -8,8 +8,8 @@ cadoles_core_server:
defaults: { _controller: CadolesCoreBundle:Core:server } defaults: { _controller: CadolesCoreBundle:Core:server }
cadoles_core_acad: cadoles_core_acad:
path: /acad/{acad} path: /acad/{acad}/{application}
defaults: { _controller: CadolesCoreBundle:Core:acad } defaults: { _controller: CadolesCoreBundle:Core:acad, application:"all" }
cadoles_core_application: cadoles_core_application:
path: /application/{application} path: /application/{application}
@ -152,7 +152,7 @@ cadoles_core_user_group_ajax_list:
cadoles_core_api: cadoles_core_api:
path: /api path: /api
defaults: { _controller: CadolesCoreBundle:Api:api} defaults: { _controller: CadolesCoreBundle:Api:api}
methods: ["post"] #methods: ["post"]
#== Application ============================================================================================================ #== Application ============================================================================================================
cadoles_core_config_application: cadoles_core_config_application:

View File

@ -6,7 +6,18 @@
{% block pagewrapper %} {% block pagewrapper %}
{%if by is defined %} {%if by is defined %}
<h1 style="text-align:center">{{byname}}</h1> <h1 style="text-align:center">
{% if by=="acad" %}
<a href="{{ path("cadoles_core_acad",{"acad":byname}) }}">
{% else %}
<a href "{{ path("cadoles_core_application",{"application":byname}) }}">
{% endif %}
{{byname}}</a>
{%if ssby is defined and ssby!="all" %}
<br>{{ssby}}
{% endif %}
</h1>
{% endif %} {% endif %}
@ -85,10 +96,10 @@
</thead> </thead>
{% for server in servers %} {% for server in servers %}
{% for serverapplication in server.serverapplications %} {% for serverapplication in server.serverapplications %}
{% if by=="acad" or (by=="application" and serverapplication.application.name==byname) %} {% if server.etab and ((by=="acad" and (ssby=="all" or ssby==serverapplication.application.name)) or (by=="application" and serverapplication.application.name==byname)) %}
<tr> <tr>
<td>{{server.etab.numerouai}}</td> <td>{{server.etab.numerouai}}</td>
<td>{{server.etab.denominationprincipale}}</td> <td>{{server.etab.appellationofficielle}}</td>
<td>{{server.etab.adresseuai}}</td> <td>{{server.etab.adresseuai}}</td>
<td>{{server.etab.libellecommune}}</td> <td>{{server.etab.libellecommune}}</td>
<td>{{server.etab.secteurpublicprivelibe}}</td> <td>{{server.etab.secteurpublicprivelibe}}</td>
@ -138,7 +149,7 @@
html ="<h3>Etablissement</h3>"; html ="<h3>Etablissement</h3>";
{% if(etab.id!=-100) %} {% if(etab.id!=-100) %}
html+="<b>UAI</b> = {{etab.numerouai}}<br>"; html+="<b>UAI</b> = {{etab.numerouai}}<br>";
html+="<b>Nom</b> = {{etab.denominationprincipale}}<br>"; html+="<b>Nom</b> = {{etab.appellationofficielle}}<br>";
html+="<b>Adresse</b> = {{etab.adresseuai}} {{etab.codecommune}} {{etab.libellecommune}}<br>"; html+="<b>Adresse</b> = {{etab.adresseuai}} {{etab.codecommune}} {{etab.libellecommune}}<br>";
html+="<b>Académie</b> = {{etab.libelleacademie}}<br>"; html+="<b>Académie</b> = {{etab.libelleacademie}}<br>";
html+="<b>Secteur</b> = {{etab.secteurpublicprivelibe}}<br>"; html+="<b>Secteur</b> = {{etab.secteurpublicprivelibe}}<br>";
@ -168,7 +179,11 @@
}); });
byacademie.options.data.forEach(function(label, i) { byacademie.options.data.forEach(function(label, i) {
{% if byname is defined %}
var url = "{{ path("cadoles_core_acad",{"acad":"xx","application":byname}) }}";
{% else %}
var url = "{{ path("cadoles_core_acad",{"acad":"xx"}) }}"; var url = "{{ path("cadoles_core_acad",{"acad":"xx"}) }}";
{% endif %}
var url = url.replace("xx",label['label']); var url = url.replace("xx",label['label']);
var legendItem = $('<span style="margin:auto; display: block;text-align: left;"></span>').html( "<a href='"+url+"'>"+label['label'] + "</a> ( " +label['value'] + " )" ).prepend('<span>&nbsp;</span>'); var legendItem = $('<span style="margin:auto; display: block;text-align: left;"></span>').html( "<a href='"+url+"'>"+label['label'] + "</a> ( " +label['value'] + " )" ).prepend('<span>&nbsp;</span>');
@ -281,7 +296,11 @@
}); });
byapplication.options.data.forEach(function(label, i) { byapplication.options.data.forEach(function(label, i) {
{% if byname is defined %}
var url = "{{ path("cadoles_core_acad",{"acad":byname,"application":"xx"}) }}";
{% else %}
var url = "{{ path("cadoles_core_application",{"application":"xx"}) }}"; var url = "{{ path("cadoles_core_application",{"application":"xx"}) }}";
{% endif %}
var url = url.replace("xx",label['label']); var url = url.replace("xx",label['label']);
var legendItem = $('<span style="margin:auto; display: block;text-align: left;"></span>').html( "<a href='"+url+"'>"+label['label'] + "</a> ( " +label['value'] + " )" ).prepend('<span>&nbsp;</span>'); var legendItem = $('<span style="margin:auto; display: block;text-align: left;"></span>').html( "<a href='"+url+"'>"+label['label'] + "</a> ( " +label['value'] + " )" ).prepend('<span>&nbsp;</span>');

View File

@ -30,7 +30,7 @@
<b>Etablissement</b><br> <b>Etablissement</b><br>
{% if(server.etab.id!=-100) %} {% if(server.etab.id!=-100) %}
<b>UAI</b> = {{server.etab.numerouai}}<br> <b>UAI</b> = {{server.etab.numerouai}}<br>
<b>Nom</b> = {{server.etab.denominationprincipale}}<br> <b>Nom</b> = {{server.etab.appellationofficielle}}<br>
<b>Adresse</b> = {{server.etab.adresseuai}} {{server.etab.codecommune}} {{server.etab.libellecommune}}<br> <b>Adresse</b> = {{server.etab.adresseuai}} {{server.etab.codecommune}} {{server.etab.libellecommune}}<br>
<b>Académie</b> = {{server.etab.libelleacademie}}<br> <b>Académie</b> = {{server.etab.libelleacademie}}<br>
<b>Secteur</b> = {{server.etab.secteurpublicprivelibe}}<br> <b>Secteur</b> = {{server.etab.secteurpublicprivelibe}}<br>