first commit symfony 6

This commit is contained in:
Arnaud Fornerot 2022-07-26 16:03:53 +02:00
parent 8181ca1c39
commit df9e7a3e69
35 changed files with 737 additions and 34 deletions

3
.env
View File

@ -104,6 +104,9 @@ PROXY_USE=0
PROXY_HOST=
PROXY_PORT=
# Audit
AUDIT_USE=0
# Sonde statistic
SONDE_USE=0
SONDE_URL=

View File

@ -15,6 +15,7 @@ twig:
appNiveau02label: '%appNiveau02label%'
sondeUse: '%sondeUse%'
sondeUrl: '%sondeUrl%'
auditUse: '%auditUse%'
when@test:
twig:

View File

@ -99,7 +99,7 @@ app_admin_config_logo:
controller: App\Controller\ConfigController::logo
defaults: { access: admin }
#== Theme ================================================================================================================
#== Theme =======================================================================================================
#-- Access admin
app_admin_theme:
@ -112,13 +112,13 @@ app_admin_theme_select:
controller: App\Controller\ThemeController::select
defaults: { name: "", access: admin }
#== API ==================================================================================================================
#== API =========================================================================================================
#-- Access visiteur
app_rest:
path: /docrest
controller: App\Controller\HomeController::docrest
#== Cron =================================================================================================================
#== Cron ========================================================================================================
#-- Access admin
app_admin_cron:
path: /admin/cron
@ -160,6 +160,25 @@ app_user_crop02:
path: /user/crop02/{type}/{reportinput}
controller: App\Controller\CropController::crop02
#== Audit =======================================================================================================
#--Access admin
app_admin_audit_renderid:
path: /admin/audit/{entityname}/{entityid}
controller: App\Controller\AuditController::auditrender
defaults: { access: admin }
#--Access admin
app_admin_audit_render:
path: /admin/audit/{entityname}
controller: App\Controller\AuditController::list
defaults: { access: admin }
#--Access modo
app_modo_audit_renderid:
path: /modo/audit/{entityname}/{entityid}
controller: App\Controller\AuditController::auditrender
defaults: { access: modo }
#== Niveau01 ====================================================================================================
#-- Access admin
@ -408,7 +427,7 @@ app_user_group_userout:
controller: App\Controller\GroupController::userout
defaults: { access: user }
#== Whitelist ============================================================================================================
#== Whitelist ===================================================================================================
#-- Access admin
app_admin_whitelist:
path: /admin/whitelist

View File

@ -95,6 +95,8 @@ parameters:
sondeUse: '%env(resolve:SONDE_USE)%'
sondeUrl: '%env(resolve:SONDE_URL)%'
auditUse: '%env(resolve:AUDIT_USE)%'
services:
_defaults:
autowire: true # Automatically injects dependencies in your services.

View File

@ -0,0 +1,34 @@
<?php
declare(strict_types=1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20220726082214 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE audit (id INT NOT NULL, entityname VARCHAR(250) NOT NULL, entityid VARCHAR(250) NOT NULL, datesubmit TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, username VARCHAR(250) NOT NULL, description TEXT DEFAULT NULL, detail TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX search_idx ON audit (entityname, entityid, datesubmit)');
$this->addSql('COMMENT ON COLUMN audit.detail IS \'(DC2Type:array)\'');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE SCHEMA public');
$this->addSql('DROP TABLE audit');
}
}

View File

@ -72,7 +72,6 @@ class CronCommand extends Command
$now=new \DateTime();
$cron->setStartexecdate($now);
//$cron->setStatut(1);
$this->em->persist($cron);
$this->em->flush();
// Récupération de la commande
@ -109,7 +108,6 @@ class CronCommand extends Command
// Statut OK/KO
$cron->setStatut(($returnCode==Command::FAILURE?0:1));
$this->em->persist($cron);
$this->em->flush();
}

View File

@ -496,6 +496,11 @@ class SynchroCommand extends Command
$filter="gidnumber=".$group->getId();
$ldapentrys=$this->ldap->search($filter,$attributes,$this->basegroup);
if(empty($ldapentrys)) {
$filter=str_replace("*",$group->getLabel(),$this->filtergroup);
$ldapentrys=$this->ldap->search($filter,$attributes,$this->baseniveau01);
}
if(empty($ldapentrys)) {
$this->writeln($group->getLabel()." = SUBMIT");
$this->ldap->addGroup($group);
}
@ -522,6 +527,11 @@ class SynchroCommand extends Command
foreach($niveau02s as $niveau02) {
$filter="gidnumber=".$niveau02->getId();
$ldapentrys=$this->ldap->search($filter,$attributes,$this->baseniveau02);
if(empty($ldapentrys)) {
$filter=str_replace("*",$niveau02->getLabel(),$this->filtergroup);
$ldapentrys=$this->ldap->search($filter,$attributes,$this->baseniveau01);
}
if(empty($ldapentrys)) {
$this->writeln($niveau02->getLabel()." = SUBMIT");
$this->ldap->addNiveau02($niveau02);
@ -554,6 +564,11 @@ class SynchroCommand extends Command
$filter="gidnumber=".$niveau01->getId();
$ldapentrys=$this->ldap->search($filter,$attributes,$this->baseniveau01);
if(empty($ldapentrys)) {
$filter=str_replace("*",$niveau01->getLabel(),$this->filtergroup);
$ldapentrys=$this->ldap->search($filter,$attributes,$this->baseniveau01);
}
if(empty($ldapentrys)) {
$this->writeln($niveau01->getLabel()." = SUBMIT");
$this->ldap->addNiveau01($niveau01);

View File

@ -0,0 +1,59 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Doctrine\Persistence\ManagerRegistry;
use App\Entity\Audit as Entity;
use App\Form\AuditType as Form;
class AuditController extends AbstractController
{
private $data="audit";
private $entity="App\Entity\Audit";
private $twig="Audit/";
private $route="app_admin_audit";
public function list($entityname,$access,ManagerRegistry $em): Response
{
$datas = $em->getRepository($this->entity)->findBy(["entityname"=>$entityname]);
return $this->render($this->twig.'list.html.twig',[
$this->data."s" => $datas,
"entityname" => $entityname,
"useheader"=>true,
"usemenu"=>false,
"usesidebar"=>true,
]);
}
public function auditrender($entityname,$entityid,$access,ManagerRegistry $em): Response
{
$datas = $em->getRepository($this->entity)->findBy(["entityname"=>$entityname,"entityid"=>$entityid]);
/*
if($entityname=="User") {
$user=$em->getRepository("App\Entity\User")->find($entityid);
if($user) {
foreach($user->getModos() as $usermodo) {
$auditusermods=$em->getRepository($this->entity)->findBy(["entityname"=>"UserModo","entityid"=>$usermodo->getId()]);
foreach($auditusermods as $auditusermod) {
$usermodo=$em->getRepository("App\Entity\UserModo")->find($auditusermod->getEntityid());
$niveau01=$em->getRepository("App\Entity\Niveau01")->find($usermodo->getNiveau01()->getId());
$auditusermod->setDescription($auditusermod->getDescription()." UserModo");
$auditusermod->setDetail([$niveau01->getId()." = ".$niveau01->getLabel()]);
}
$datas=array_merge($datas,$auditusermods);
}
}
}
*/
return $this->render($this->twig.'render.html.twig',[
$this->data."s" => $datas,
]);
}
}

View File

@ -22,6 +22,7 @@ class ConfigController extends AbstractController
"useheader"=>true,
"usemenu"=>false,
"usesidebar"=>true,
"access"=>$access,
]);
}

View File

@ -20,12 +20,13 @@ class CronController extends AbstractController
private $twig="Cron/";
private $route="app_admin_cron";
public function list(): Response
public function list($access): Response
{
return $this->render($this->twig.'list.html.twig',[
"useheader"=>true,
"usemenu"=>false,
"usesidebar"=>true,
"access"=>$access,
]);
}
@ -104,7 +105,7 @@ class CronController extends AbstractController
return new JsonResponse($output);
}
public function update($id,Request $request,ManagerRegistry $em): Response
public function update($id,$access,Request $request,ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data=$em->getRepository($this->entity)->find($id);
@ -134,7 +135,8 @@ class CronController extends AbstractController
'usesidebar' => true,
$this->data => $data,
'mode' => 'update',
'form' => $form->createView()
'form' => $form->createView(),
'access' => $access,
]);
}

View File

@ -19,12 +19,13 @@ class Niveau01Controller extends AbstractController
private $twig="Niveau01/";
private $route="app_admin_niveau01";
public function list(): Response
public function list($access): Response
{
return $this->render($this->twig.'list.html.twig',[
"useheader"=>true,
"usemenu"=>false,
"usesidebar"=>true,
"access"=>$access,
]);
}
@ -100,7 +101,7 @@ class Niveau01Controller extends AbstractController
}
public function submit(Request $request,ManagerRegistry $em): Response
public function submit($access,Request $request,ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data = new Entity();
@ -137,10 +138,11 @@ class Niveau01Controller extends AbstractController
"mode"=>"submit",
"form"=>$form->createView(),
$this->data=>$data,
"access"=>$access,
]);
}
public function update($id,Request $request,ManagerRegistry $em): Response
public function update($id,$access,Request $request,ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data=$em->getRepository($this->entity)->find($id);
@ -173,11 +175,12 @@ class Niveau01Controller extends AbstractController
'usesidebar' => true,
$this->data => $data,
'mode' => 'update',
'form' => $form->createView()
'form' => $form->createView(),
"access" => $access
]);
}
public function delete($id,Request $request,ManagerRegistry $em): Response
public function delete($id,$access,Request $request,ManagerRegistry $em): Response
{
// Récupération de l'enregistrement courant
$data=$em->getRepository($this->entity)->find($id);

View File

@ -219,7 +219,7 @@ class RegistrationController extends AbstractController
$data->setStatut($idstatut);
// Sur erreur
$this->getErrorForm(null,$form,$request,$data,"submit",$idstatut);
$this->getErrorForm(null,$form,$request,$data,"submit",$idstatut,$em);
// Sur validation
if ($form->get('submit')->isClicked() && $form->isValid()) {
@ -710,7 +710,7 @@ class RegistrationController extends AbstractController
throw $this->createAccessDeniedException('Permission denied');
}
protected function getErrorForm($id,$form,$request,$data,$mode,$idstatut) {
protected function getErrorForm($id,$form,$request,$data,$mode,$idstatut,$em) {
if ($form->get('submit')->isClicked() && $mode=="submit") {
// Si validation par administrateur demander une motivation
$appmoderegistration = $this->getParameter('appModeregistration');
@ -718,7 +718,7 @@ class RegistrationController extends AbstractController
// On recherche le domaine du mail dans la liste blanche
$email=explode("@",$data->getEmail());
$domaine=end($email);
$whitelist = $this->getDoctrine()->getManager()->getRepository("App\Entity\Whitelist")->findBy(["label"=>$domaine]);
$whitelist = $em->getManager()->getRepository("App\Entity\Whitelist")->findBy(["label"=>$domaine]);
if(!$whitelist)
$form->addError(new FormError("Attention, le suffixe de votre adresse mail nest pas dans la liste des administrations autorisées, merci de bien vouloir privilégier votre adresse professionnelle si vous en avez une.<br>Si ce nest pas le cas, il faut que vous renseigniez la case motivation de votre demande"));
}

View File

@ -18,12 +18,13 @@ class WhitelistController extends AbstractController
private $twig="Whitelist/";
private $route="app_admin_whitelist";
public function list(): Response
public function list($access): Response
{
return $this->render($this->twig.'list.html.twig',[
"useheader"=>true,
"usemenu"=>false,
"usesidebar"=>true,
"access"=>$access,
]);
}
@ -98,7 +99,7 @@ class WhitelistController extends AbstractController
return new JsonResponse($output);
}
public function submit(Request $request,ManagerRegistry $em): Response
public function submit($access,Request $request,ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data = new Entity();
@ -129,10 +130,11 @@ class WhitelistController extends AbstractController
"mode"=>"submit",
"form"=>$form->createView(),
$this->data=>$data,
"access"=>$access,
]);
}
public function update($id,Request $request,ManagerRegistry $em): Response
public function update($id,$access,Request $request,ManagerRegistry $em): Response
{
// Initialisation de l'enregistrement
$data=$em->getRepository($this->entity)->find($id);
@ -160,11 +162,12 @@ class WhitelistController extends AbstractController
'usesidebar' => true,
$this->data => $data,
'mode' => 'update',
'form' => $form->createView()
'form' => $form->createView(),
"access"=>$access,
]);
}
public function delete($id,Request $request,ManagerRegistry $em): Response
public function delete($id,$access,Request $request,ManagerRegistry $em): Response
{
// Récupération de l'enregistrement courant
$data=$em->getRepository($this->entity)->find($id);

132
src/Entity/Audit.php Normal file
View File

@ -0,0 +1,132 @@
<?php
namespace App\Entity;
use App\Repository\AuditRepository;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
/**
* Cron
*
* @ORM\Table(name="audit",indexes={@ORM\Index(name="search_idx", columns={"entityname", "entityid", "datesubmit"})})
* @ORM\Entity(repositoryClass="App\Repository\AuditRepository")
*/
class Audit
{ /**
* @ORM\Column(name="id", type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
private $id;
/**
* @ORM\Column(type="string", length=250, nullable=false)
*/
private $entityname;
/**
* @ORM\Column(type="string", length=250, nullable=false)
*/
private $entityid;
/**
* @ORM\Column(type="datetime")
*/
private $datesubmit;
/**
* @ORM\Column(type="string", length=250, nullable=false)
*/
private $username;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $description;
/**
* @ORM\Column(type="array", nullable=true)
*/
private $detail = array();
public function getId(): ?int
{
return $this->id;
}
public function getEntityname(): ?string
{
return $this->entityname;
}
public function setEntityname(string $entityname): self
{
$this->entityname = $entityname;
return $this;
}
public function getEntityid(): ?string
{
return $this->entityid;
}
public function setEntityid(string $entityid): self
{
$this->entityid = $entityid;
return $this;
}
public function getDatesubmit(): ?\DateTimeInterface
{
return $this->datesubmit;
}
public function setDatesubmit(\DateTimeInterface $datesubmit): self
{
$this->datesubmit = $datesubmit;
return $this;
}
public function getUsername(): ?string
{
return $this->username;
}
public function setUsername(string $username): self
{
$this->username = $username;
return $this;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
public function getDetail(): array
{
return $this->detail;
}
public function setDetail(?array $detail): self
{
$this->detail = $detail;
return $this;
}
}

View File

@ -5,15 +5,32 @@ namespace App\EventListener;
use Doctrine\Bundle\DoctrineBundle\EventSubscriber\EventSubscriberInterface;
use Doctrine\ORM\Events;
use Doctrine\Persistence\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\OnFlushEventArgs;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
use Doctrine\ORM\Proxy\Proxy;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface;
use App\Entity\Audit as Audit;
class AllSubscriber implements EventSubscriberInterface
{
private $entity;
private $token;
private $params;
public function __construct(EntityManagerInterface $em, TokenStorageInterface $token,ParameterBagInterface $params)
{
$this->em = $em;
$this->token = $token;
$this->params = $params;
}
public function getSubscribedEvents(): array
{
return [
Events::preRemove,
Events::onFlush,
];
}
@ -25,4 +42,156 @@ class AllSubscriber implements EventSubscriberInterface
if($this->entity->getId()<0)
throw new \Exception("Impossible de supprimer cet enregistrement. C'est un enregistrement système");
}
public function onFlush(OnFlushEventArgs $eventArgs): void
{
$this->entity = $eventArgs->getEntityManager();
if ($this->entity instanceof Audit||!$this->params->get("auditUse")) return;
$this->audit();
}
private function audit() {
$token = $this->token->getToken();
if(!$token)$user="job";
else {
$user=$token->getUser();
if($user!="anon.") $user = $user->getUsername();
else $user="job";
}
$uow = $this->em->getUnitOfWork();
$uow->computeChangeSets();
foreach ($uow->getScheduledEntityInsertions() as $entity) {
$metaCar = $this->em->getClassMetadata(get_class($entity));
$className=str_replace("App\\Entity\\","",$metaCar->getName());
$nameold="";
if($metaCar->hasField("name"))
$nameold=" = ".$entity>getName();
elseif($metaCar->hasField("label"))
$nameold=" = ".$entity->getLabel();
elseif($metaCar->hasField("username"))
$nameold=" = ".$entity->getUsername();
$audit=new Audit();
$audit->setDatesubmit(new \DateTime("now"));
$audit->setEntityname($className);
$audit->setEntityid($entity->getId());
$audit->setUsername($user);
$audit->setDescription("SUBMIT");
$audit->setDetail(["id"=>$entity->getId().$nameold]);
$this->em->persist($audit);
$uow->computeChangeSet($this->em->getClassMetadata(get_class($audit)), $audit);
}
foreach ($uow->getScheduledEntityDeletions() as $entity) {
$metaCar = $this->em->getClassMetadata(get_class($entity));
$className=str_replace("App\\Entity\\","",$metaCar->getName());
$nameold="";
if($metaCar->hasField("name"))
$nameold=" = ".$entity>getName();
elseif($metaCar->hasField("label"))
$nameold=" = ".$entity->getLabel();
elseif($metaCar->hasField("username"))
$nameold=" = ".$entity->getUsername();
$audit=new Audit();
$audit->setDatesubmit(new \DateTime("now"));
$audit->setEntityname($className);
$audit->setEntityid($entity->getId());
$audit->setUsername($user);
$audit->setDescription("DELETE");
$audit->setDetail(["id"=>$entity->getId().$nameold]);
$this->em->persist($audit);
$uow->computeChangeSet($this->em->getClassMetadata(get_class($audit)), $audit);
}
foreach ($uow->getScheduledEntityUpdates() as $entity) {
$changeSet = $uow->getEntityChangeSet($entity);
// Unaudit field
$className = str_replace("App\\Entity\\","",$this->em->getClassMetadata(get_class($entity))->getName());
switch($className) {
case "Audit":
$changeSet=null;
break;
case "User":
unset($changeSet["visitecpt"]);
unset($changeSet["visitedate"]);
unset($changeSet["preference"]);
unset($changeSet["keyvalue"]);
unset($changeSet["keyexpire"]);
unset($changeSet["apikey"]);
unset($changeSet["password"]);
unset($changeSet["passwordplain"]);
unset($changeSet["salt"]);
break;
default:
unset($changeSet["apikey"]);
break;
}
if ($changeSet) {
$mychange=[];
foreach($changeSet as $key => $value) {
// Le champs modifié est-il une entité
$isentity0=($value[0]&&is_object($value[0])&&get_class($value[0])&&get_class($value[0])!="DateTime");
$isentity1=($value[1]&&is_object($value[1])&&get_class($value[1])&&get_class($value[1])!="DateTime");
if($isentity0||$isentity1) {
$nameold="";
if($isentity0) {
$metaCar = $this->em->getClassMetadata(get_class($value[0]));
if($metaCar->hasField("name"))
$nameold=" = ".$value[0]->getName();
elseif($metaCar->hasField("label"))
$nameold=" = ".$value[0]->getLabel();
elseif($metaCar->hasField("username"))
$nameold=" = ".$value[0]->getUsername();
$nameold= $value[0]->getId().$nameold;
}
$namenew="";
if($isentity1) {
$metaCar = $this->em->getClassMetadata(get_class($value[1]));
if($metaCar->hasField("name"))
$namenew=" = ".$value[1]->getName();
elseif($metaCar->hasField("label"))
$namenew=" = ".$value[1]->getLabel();
elseif($metaCar->hasField("username"))
$namenew=" = ".$value[1]->getUsername();
$namenew= $value[1]->getId().$namenew;
}
$mychange[$key]=[$nameold,$namenew];
}
else $mychange[$key]=$value;
}
$audit=new Audit();
$audit->setDatesubmit(new \DateTime("now"));
$audit->setEntityname($className);
$audit->setEntityid($entity->getId());
$audit->setUsername($user);
$audit->setDescription("UPDATE");
$audit->setDetail($mychange);
$this->em->persist($audit);
$uow->computeChangeSet($this->em->getClassMetadata(get_class($audit)), $audit);
}
}
}
}

View File

@ -117,8 +117,10 @@ class GroupSubscriber implements EventSubscriberInterface
// Le propriétaire passe manager
$usergroups=$this->em->getRepository("App\Entity\UserGroup")->findBy(["group"=>$group,"rolegroup"=>"100"]);
foreach($usergroups as $usergroup) {
$usergroup->setRolegroup(90);
$this->em->flush();
if($usergroup->getUser()!=$group->getOwner()) {
$usergroup->setRolegroup(90);
$this->em->flush();
}
}
// Le propriétaire prend son role dans le groupe
@ -129,10 +131,14 @@ class GroupSubscriber implements EventSubscriberInterface
$usergroup->setUser($group->getOwner());
$usergroup->setGroup($group);
$usergroup->setApikey(Uuid::uuid4());
$usergroup->setRolegroup(100);
$this->em->persist($usergroup);
$this->em->flush();
}
elseif($usergroup->getRolegroup()!=100) {
$usergroup->setRolegroup(100);
$this->em->flush();
}
$usergroup->setRolegroup(100);
$this->em->persist($usergroup);
$this->em->flush();
}
}
}

View File

@ -0,0 +1,33 @@
<?php
namespace App\Repository;
use App\Entity\Audit;
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Doctrine\Persistence\ManagerRegistry;
class AuditRepository extends ServiceEntityRepository
{
public function __construct(ManagerRegistry $registry)
{
parent::__construct($registry, Audit::class);
}
public function add(Audit $entity, bool $flush = false): void
{
$this->getEntityManager()->persist($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
public function remove(Audit $entity, bool $flush = false): void
{
$this->getEntityManager()->remove($entity);
if ($flush) {
$this->getEntityManager()->flush();
}
}
}

View File

@ -49,6 +49,7 @@
// Préférence par défaut
$session->set("fgheader", true);
$session->set("fgaudit", false);
// Préférence
if($curentuser!="anon.") {
@ -59,6 +60,12 @@
$fgheader=($preference["fgheader"][0]=="true");
$session->set("fgheader", $fgheader);
}
// Préférence audit
if(array_key_exists("fgaudit",$preference)) {
$fgaudit=($preference["fgaudit"][0]=="true");
$session->set("fgaudit", $fgaudit);
}
}
}

View File

@ -0,0 +1,66 @@
{% extends "base.html.twig" %}
{% block body %}
<h1 class="page-header">
AUDIT {{ entityname }}
</h1>
<div class="card mt-3" >
<div class="card-header">
<i class="fas fa-eye fa-fw"></i> Audit
</div>
<div id="bodyaudit" class="card-body">
<table class="table table-striped table-bordered table-hover dataTable" style="width:100%; zoom:80%">
<thead>
<tr>
<th>Date</th>
<th>Par</th>
<th>Action</th>
<th>Id</th>
<th>Détail</th>
</tr>
</thead>
<tbody>
{% for audit in audits|reverse %}
<tr>
<td>{{audit.datesubmit|date("d/m/Y H:i")}}</td>
<td>{{audit.username}}</td>
<td>{{audit.description}}</td>
<td>{{audit.entityid}}</td>
<td>
<small>
{% for key, detail in audit.detail %}
{% if audit.description=="UPDATE" %}
<strong>{{key}}</strong> =
de {%if detail[0] is empty%}null {%else%}{{detail[0]|join(', ')}}{%endif%}
à {%if detail[1] is empty%}null {%else%} {{detail[1]|join(', ')}}{%endif%}
</br>
{% else %}
<strong>id</strong> {{detail}}
{% endif %}
{% endfor %}
</small>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}
{% block localscript %}
<script>
$(document).ready(function() {
$('.table').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false } ],
responsive: true,
iDisplayLength: 100,
order: [[ 0, "desc" ]],
});
});
</script>
{% endblock %}

View File

@ -0,0 +1,68 @@
<div class="card mt-3" >
<div class="card-header" onClick="switchAudit()">
<i class="fas fa-eye fa-fw"></i> Audit
<div id="btnaudit" class="btn btn-secondary float-end btn-sm" style="font-family:var(--fontbody)">
{%if not app.session.get("fgaudit")%}Afficher{%else%}Masquer{%endif%}</div>
</div>
<div id="bodyaudit" class="card-body" style="{%if not app.session.get("fgaudit")%}display:none;{%endif%}">
<table class="table table-striped table-bordered table-hover dataTable" style="width:100%; zoom:80%">
<thead>
<tr>
<th>Date</th>
<th>Par</th>
<th>Action</th>
<th>Détail</th>
</tr>
</thead>
<tbody>
{% for audit in audits|reverse %}
<tr>
<td>{{audit.datesubmit|date("d/m/Y H:i")}}</td>
<td>{{audit.username}}</td>
<td>{{audit.description}}</td>
<td>
<small>
{% for key, detail in audit.detail %}
{% if audit.description=="UPDATE" %}
<strong>{{key}}</strong> =
de {%if detail[0] is empty%}null {%else%}{{detail[0]|join(', ')}}{%endif%}
à {%if detail[1] is empty%}null {%else%} {{detail[1]|join(', ')}}{%endif%}
</br>
{% else %}
<strong>id</strong> {{detail}}
{% endif %}
{% endfor %}
</small>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<script>
function switchAudit() {
{% if app.user %}
$.ajax({
method: "POST",
url: "{{ path('app_user_preference') }}",
data: {
id:0,
key:'fgaudit',
value: !($("#bodyaudit").is(":visible"))
},
success: function() {
}
});
$("#bodyaudit").toggle();
if($("#bodyaudit").is(":visible"))
$("#btnaudit").html("Masquer");
else
$("#btnaudit").html("Afficher");
{% endif %}
}
</script>

View File

@ -5,6 +5,10 @@
CONFIGURATIONS
</h1>
{% if auditUse and (access=="admin" or access=="audit") %}
<a class="btn btn-secondary float-end" href="{{ path("app_"~access~"_audit_render",{entityname:"Config"}) }}"><i class="fas fa-eye fa-fw"></i> Audit</a>
<br><br>
{% endif %}
<div class="row">
<div class="col-md-12 mt-4">

View File

@ -45,6 +45,13 @@
{{ form_row(form.nextexecdate) }}
</div>
</div>
{% if auditUse and mode=="update" and (access=="admin" or access=="modo" or access=="audit") %}
<div class="float-end" style="width:700px;max-width:100%">
{{ render(path("app_"~access~"_audit_renderid",{entityname:"Cron",entityid:cron.id})) }}
</div>
{% endif %}
{{ form_end(form) }}
{% endblock %}

View File

@ -4,6 +4,10 @@
<h1 class="page-header">
CRON JOBS
</h1>
{% if auditUse and (access=="admin" or access=="audit") %}
<a class="btn btn-secondary float-end" href="{{ path("app_"~access~"_audit_render",{entityname:"Cron"}) }}"><i class="fas fa-eye fa-fw"></i> Audit</a>
</br><br>
{% endif %}
<div class="card">
<div class="card-header">

View File

@ -75,6 +75,12 @@
</div>
</div>
{% if auditUse and mode=="update" and (access=="admin" or access=="modo" or access=="audit") %}
<div class="float-end" style="width:700px;max-width:100%">
{{ render(path("app_"~access~"_audit_renderid",{entityname:"Group",entityid:group.id})) }}
</div>
{% endif %}
{{ form_end(form) }}
{% endblock %}

View File

@ -3,12 +3,18 @@
{% block body %}
<h1 class="page-header">Gestion des Groupes </h1>
<p>
{%if access=="admin" %}
<p><a class="btn btn-success" href={{ path('app_'~access~'_group_submit') }}>Ajouter</a></p>
<a class="btn btn-success" href={{ path('app_'~access~'_group_submit') }}>Ajouter</a>
{%elseif access=="user" and app.session.get("submitgroup") %}
<p><a class="btn btn-success" href={{ path('app_'~access~'_group_submit') }}>Ajouter</a></p>
<a class="btn btn-success" href={{ path('app_'~access~'_group_submit') }}>Ajouter</a>
{% endif %}
{% if auditUse and (access=="admin" or access=="audit") %}
<a class="btn btn-secondary float-end" href="{{ path("app_"~access~"_audit_render",{entityname:"Group"}) }}"><i class="fas fa-eye fa-fw"></i> Audit</a>
{% endif %}
</p>
<div class="card mt-4">
<div class="card-header">
<i class="fa fa-table fa-fw"></i> Liste des Groupes

View File

@ -74,6 +74,12 @@
{% endif %}
</div>
</div>
{% if auditUse and mode=="update" and (access=="admin" or access=="modo" or access=="audit") %}
<div class="float-end" style="width:700px;max-width:100%">
{{ render(path("app_"~access~"_audit_renderid",{entityname:"Niveau01",entityid:niveau01.id})) }}
</div>
{% endif %}
{{ form_end(form) }}
{% endblock %}

View File

@ -3,7 +3,12 @@
{% block body %}
<h1 class="page-header">Gestion des {{ appNiveau01label }}s </h1>
<p><a class="btn btn-success" href={{ path('app_admin_niveau01_submit') }}>Ajouter</a></p>
<p>
<a class="btn btn-success" href={{ path('app_admin_niveau01_submit') }}>Ajouter</a>
{% if auditUse and (access=="admin" or access=="audit") %}
<a class="btn btn-secondary float-end" href="{{ path("app_"~access~"_audit_render",{entityname:"Niveau01"}) }}"><i class="fas fa-eye fa-fw"></i> Audit</a>
{% endif %}
</p>
<div class="card mt-4">
<div class="card-header">

View File

@ -56,5 +56,12 @@
{% endif %}
</div>
</div>
{% if auditUse and mode=="update" and (access=="admin" or access=="modo" or access=="audit") %}
<div class="float-end" style="width:700px;max-width:100%">
{{ render(path("app_"~access~"_audit_renderid",{entityname:"Niveau02",entityid:niveau02.id})) }}
</div>
{% endif %}
{{ form_end(form) }}
{% endblock %}

View File

@ -3,7 +3,12 @@
{% block body %}
<h1 class="page-header">Gestion des {{ appNiveau02label }}s </h1>
<p><a class="btn btn-success" href={{ path('app_'~access~'_niveau02_submit') }}>Ajouter</a></p>
<p>
<a class="btn btn-success" href={{ path('app_'~access~'_niveau02_submit') }}>Ajouter</a>
{% if auditUse and (access=="admin" or access=="audit") %}
<a class="btn btn-secondary float-end" href="{{ path("app_"~access~"_audit_render",{entityname:"Niveau02"}) }}"><i class="fas fa-eye fa-fw"></i> Audit</a>
{% endif %}
</p>
<div class="card mt-4">
<div class="card-header">

View File

@ -144,6 +144,10 @@
{{ form_row(form.telephonenumber) }}
</div>
</div>
{% if auditUse and mode=="update" and (access=="admin" or access=="modo" or access=="audit") %}
{{ render(path("app_"~access~"_audit_renderid",{entityname:"Registration",entityid:registration.id})) }}
{% endif %}
</div>
</div>
{% endif %}

View File

@ -3,6 +3,13 @@
{% block body %}
<h1 class="page-header">Gestion des Inscriptions</h1>
{% if auditUse and (access=="admin" or access=="audit") %}
<a class="btn btn-secondary float-end" href="{{ path("app_"~access~"_audit_render",{entityname:"Registration"}) }}"><i class="fas fa-eye fa-fw"></i> Audit</a>
<br>
<br>
{% endif %}
<div class="card">
<div class="card-header">
<i class="fa fa-table fa-fw"></i> Liste des Inscription

View File

@ -247,10 +247,14 @@
</div>
</div>
{% if auditUse and mode=="update" and (access=="admin" or access=="modo" or access=="audit") %}
{{ render(path("app_"~access~"_audit_renderid",{entityname:"User",entityid:user.id})) }}
{% endif %}
</div>
</div>
<div id="groupmodal" class="modal fade bs-item-modal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
@ -394,6 +398,7 @@
$('#tbllistgroup').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false },{ "targets": 'no-visible', "visible": false } ],
responsive: true,
scrollX: false,
iDisplayLength: 100,
processing: true,
order: [[ 1, "asc" ]],
@ -402,6 +407,7 @@
$('#tbllistmodo').DataTable({
columnDefs: [ { "targets": 'no-sort', "orderable": false },{ "targets": 'no-visible', "visible": false } ],
responsive: true,
scrollX: false,
iDisplayLength: 100,
processing: true,
order: [[ 1, "asc" ]],

View File

@ -8,6 +8,10 @@
{% endif %}
{% endif %}
{% if auditUse and (access=="admin" or access=="audit") %}
<a class="btn btn-secondary float-end" href="{{ path("app_"~access~"_audit_render",{entityname:"User"}) }}"><i class="fas fa-eye fa-fw"></i> Audit</a>
{% endif %}
<div class="card mt-4">
<div class="card-header">
<i class="fa fa-table fa-fw"></i> Liste des Utilisateurs

View File

@ -47,6 +47,12 @@
{{ form_widget(form.label) }}
</div>
</div>
{% if auditUse and mode=="update" and (access=="admin" or access=="modo" or access=="audit") %}
<div class="float-end" style="width:700px;max-width:100%">
{{ render(path("app_"~access~"_audit_renderid",{entityname:"Whitelist",entityid:whitelist.id})) }}
</div>
{% endif %}
{{ form_end(form) }}
{% endblock %}

View File

@ -3,7 +3,12 @@
{% block body %}
<h1 class="page-header">Gestion des Listes Blanche</h1>
<p><a class="btn btn-success" href={{ path('app_admin_whitelist_submit') }}>Ajouter</a></p>
<p>
<a class="btn btn-success" href={{ path('app_admin_whitelist_submit') }}>Ajouter</a>
{% if auditUse and (access=="admin" or access=="audit") %}
<a class="btn btn-secondary float-end" href="{{ path("app_"~access~"_audit_render",{entityname:"Whitelist"}) }}"><i class="fas fa-eye fa-fw"></i> Audit</a>
{% endif %}
</p>
<div class="card">
<div class="card-header">