fix(morelevel): ajout de niveau03 et niveau04
All checks were successful
Cadoles/nineskeletor/pipeline/head This commit looks good
All checks were successful
Cadoles/nineskeletor/pipeline/head This commit looks good
This commit is contained in:
@ -200,7 +200,9 @@ class GroupController extends AbstractController
|
||||
}
|
||||
|
||||
// Controler les permissions
|
||||
$this->cansubmit($access, $em);
|
||||
if (!$this->cansubmit($access, $request)) {
|
||||
throw $this->createAccessDeniedException('Permission denied');
|
||||
}
|
||||
|
||||
// Création du formulaire
|
||||
$form = $this->createForm(Form::class, $data, [
|
||||
@ -363,6 +365,8 @@ class GroupController extends AbstractController
|
||||
$usermodo = null;
|
||||
$niveau01 = null;
|
||||
$niveau02 = null;
|
||||
$niveau03 = null;
|
||||
$niveau04 = null;
|
||||
|
||||
// Nombre total d'enregistrement
|
||||
$qb = $em->getManager()->createQueryBuilder();
|
||||
@ -389,6 +393,8 @@ class GroupController extends AbstractController
|
||||
case 'user':
|
||||
$niveau01 = $this->getUser()->getNiveau01();
|
||||
$niveau02 = $this->getUser()->getNiveau02();
|
||||
$niveau03 = $this->getUser()->getNiveau03();
|
||||
$niveau04 = $this->getUser()->getNiveau04();
|
||||
|
||||
$qb->select('COUNT(user)')
|
||||
->from('App:User', 'user')
|
||||
@ -396,13 +402,21 @@ class GroupController extends AbstractController
|
||||
->setParameter('groupid', $id);
|
||||
|
||||
switch ($request->getSession()->get('scopeannu')) {
|
||||
case 'SAME_NIVEAU01':
|
||||
case 1:
|
||||
$qb->andWhere('user.niveau01 = :niveau01')->setParameter('niveau01', $niveau01);
|
||||
break;
|
||||
|
||||
case 'SAME_NIVEAU02':
|
||||
case 2:
|
||||
$qb->andWhere('user.niveau02 = :niveau02')->setParameter('niveau02', $niveau02);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$qb->andWhere('user.niveau03 = :niveau03')->setParameter('niveau02', $niveau03);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$qb->andWhere('user.niveau04 = :niveau04')->setParameter('niveau04', $niveau04);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -452,13 +466,21 @@ class GroupController extends AbstractController
|
||||
->setParameter('groupid', $id);
|
||||
|
||||
switch ($request->getSession()->get('scopeannu')) {
|
||||
case 'SAME_NIVEAU01':
|
||||
case 1:
|
||||
$qb->andWhere('user.niveau01 = :niveau01')->setParameter('niveau01', $niveau01);
|
||||
break;
|
||||
|
||||
case 'SAME_NIVEAU02':
|
||||
case 2:
|
||||
$qb->andWhere('user.niveau02 = :niveau02')->setParameter('niveau02', $niveau02);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$qb->andWhere('user.niveau03 = :niveau03')->setParameter('niveau02', $niveau03);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$qb->andWhere('user.niveau04 = :niveau04')->setParameter('niveau04', $niveau04);
|
||||
break;
|
||||
}
|
||||
|
||||
$totalf = $qb->getQuery()->getSingleScalarResult();
|
||||
@ -494,13 +516,21 @@ class GroupController extends AbstractController
|
||||
case 'user':
|
||||
$qb->where($qb->expr()->not($qb->expr()->exists($sub->getDQL())));
|
||||
switch ($request->getSession()->get('scopeannu')) {
|
||||
case 'SAME_NIVEAU01':
|
||||
case 1:
|
||||
$qb->andWhere('user.niveau01 = :niveau01')->setParameter('niveau01', $niveau01);
|
||||
break;
|
||||
|
||||
case 'SAME_NIVEAU02':
|
||||
case 2:
|
||||
$qb->andWhere('user.niveau02 = :niveau02')->setParameter('niveau02', $niveau02);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
$qb->andWhere('user.niveau03 = :niveau03')->setParameter('niveau02', $niveau03);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
$qb->andWhere('user.niveau04 = :niveau04')->setParameter('niveau04', $niveau04);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -805,12 +835,14 @@ class GroupController extends AbstractController
|
||||
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route));
|
||||
}
|
||||
|
||||
private function cansubmit($access, $em)
|
||||
private function cansubmit($access, $request)
|
||||
{
|
||||
switch ($access) {
|
||||
case 'admin': return true;
|
||||
break;
|
||||
case 'user': return true;
|
||||
case 'modo': return false;
|
||||
break;
|
||||
case 'user': return $request->getSession()->get('submitgroup');
|
||||
break;
|
||||
}
|
||||
throw $this->createAccessDeniedException('Permission denied');
|
||||
|
Reference in New Issue
Block a user