fix(activeuser): user isactive & adress niveau & route all
This commit is contained in:
@ -24,7 +24,7 @@ class GroupController extends AbstractController
|
||||
return $this->render($this->twig.'list.html.twig', [
|
||||
'useheader' => true,
|
||||
'usemenu' => false,
|
||||
'usesidebar' => ('user' != $access),
|
||||
'usesidebar' => ('all' != $access),
|
||||
'access' => $access,
|
||||
]);
|
||||
}
|
||||
@ -43,7 +43,7 @@ class GroupController extends AbstractController
|
||||
// Nombre total d'enregistrement
|
||||
$qb = $em->getManager()->createQueryBuilder();
|
||||
$qb->select('COUNT(entity)')->from($this->entity, 'entity')->getQuery()->getSingleScalarResult();
|
||||
if ('user' == $access) {
|
||||
if ('all' == $access) {
|
||||
$qb->from('App:UserGroup', 'usergroup')
|
||||
->andWhere('entity.isworkgroup=:flag')
|
||||
->andWhere('entity.id=usergroup.group')
|
||||
@ -66,7 +66,7 @@ class GroupController extends AbstractController
|
||||
->setParameter('value', '%'.$search['value'].'%')
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
if ('user' == $access) {
|
||||
if ('all' == $access) {
|
||||
$qb->from('App:UserGroup', 'usergroup')
|
||||
->andWhere('entity.isworkgroup=:flag')
|
||||
->andWhere('entity.id=usergroup.group')
|
||||
@ -89,7 +89,7 @@ class GroupController extends AbstractController
|
||||
$qb = $em->getManager()->createQueryBuilder();
|
||||
$qb->select('entity')
|
||||
->from($this->entity, 'entity');
|
||||
if ('user' == $access) {
|
||||
if ('all' == $access) {
|
||||
$qb->from('App:UserGroup', 'usergroup')
|
||||
->andWhere('entity.isworkgroup=:flag')
|
||||
->andWhere('entity.id=usergroup.group')
|
||||
@ -146,7 +146,7 @@ class GroupController extends AbstractController
|
||||
}
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
case 'all':
|
||||
if ($this->canupdate($access, $data, $em, false)) {
|
||||
$action .= "<a href='".$this->generateUrl(str_replace('_admin_', '_'.$access.'_', $this->route).'_update', ['id' => $data->getId()])."'><i class='fa fa-file fa-fw fa-2x'></i></a>";
|
||||
}
|
||||
@ -164,8 +164,10 @@ class GroupController extends AbstractController
|
||||
|
||||
$userinfo = '';
|
||||
if ($data->getOwner()) {
|
||||
$userinfo .= "<img src='".$this->generateUrl('app_minio_image', ['file' => 'avatar/'.$data->getOwner()->getAvatar()])."' class='avatar'>";
|
||||
$userinfo .= '<br>'.$data->getOwner()->getUsername();
|
||||
$userinfo .= '<div class="d-flex align-items-center">';
|
||||
$userinfo .= "<img src='".$this->generateUrl('app_minio_image', ['file' => 'avatar/'.$data->getOwner()->getAvatar()])."' class='avatar me-2'>";
|
||||
$userinfo .= '<div>'.$data->getOwner()->getFullname().'</div>';
|
||||
$userinfo .= '</div>';
|
||||
}
|
||||
|
||||
$visitecpt = 0;
|
||||
@ -194,7 +196,7 @@ class GroupController extends AbstractController
|
||||
// Initialisation de l'enregistrement
|
||||
$data = new Entity();
|
||||
$data->setApikey(Uuid::uuid4());
|
||||
if ('user' == $access) {
|
||||
if ('all' == $access) {
|
||||
$data->setOwner($this->getUser());
|
||||
$data->setIsworkgroup(true);
|
||||
}
|
||||
@ -235,12 +237,12 @@ class GroupController extends AbstractController
|
||||
return $this->render($this->twig.'edit.html.twig', [
|
||||
'useheader' => true,
|
||||
'usemenu' => false,
|
||||
'usesidebar' => ('user' != $access),
|
||||
'usesidebar' => ('all' != $access),
|
||||
'mode' => 'submit',
|
||||
'access' => $access,
|
||||
'form' => $form->createView(),
|
||||
$this->data => $data,
|
||||
'maxsize' => ('user' == $access ? 1200 : null),
|
||||
'maxsize' => ('all' == $access ? 1200 : null),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -284,12 +286,12 @@ class GroupController extends AbstractController
|
||||
return $this->render($this->twig.'edit.html.twig', [
|
||||
'useheader' => true,
|
||||
'usemenu' => false,
|
||||
'usesidebar' => ('user' != $access),
|
||||
'usesidebar' => ('all' != $access),
|
||||
$this->data => $data,
|
||||
'mode' => 'update',
|
||||
'access' => $access,
|
||||
'form' => $form->createView(),
|
||||
'maxsize' => ('user' == $access ? 1200 : null),
|
||||
'maxsize' => ('all' == $access ? 1200 : null),
|
||||
]);
|
||||
}
|
||||
|
||||
@ -332,7 +334,7 @@ class GroupController extends AbstractController
|
||||
return $this->render($this->twig.'users.html.twig', [
|
||||
'useheader' => true,
|
||||
'usemenu' => false,
|
||||
'usesidebar' => ('user' != $access),
|
||||
'usesidebar' => ('all' != $access),
|
||||
'access' => $access,
|
||||
$this->data => $data,
|
||||
]);
|
||||
@ -375,7 +377,9 @@ class GroupController extends AbstractController
|
||||
$qb->select('COUNT(user)')
|
||||
->from('App:User', 'user')
|
||||
->where($qb->expr()->not($qb->expr()->exists($sub->getDQL())))
|
||||
->setParameter('groupid', $id);
|
||||
->andWhere('user.isactive=:isactive')
|
||||
->setParameter('groupid', $id)
|
||||
->setParameter('isactive', true);
|
||||
break;
|
||||
|
||||
case 'modo':
|
||||
@ -386,11 +390,13 @@ class GroupController extends AbstractController
|
||||
->where($qb->expr()->not($qb->expr()->exists($sub->getDQL())))
|
||||
->andWhere('usermodo.niveau01 = user.niveau01')
|
||||
->andWhere('usermodo.user = :userid')
|
||||
->andWhere('user.isactive=:isactive')
|
||||
->setParameter('userid', $usermodo)
|
||||
->setParameter('groupid', $id);
|
||||
->setParameter('groupid', $id)
|
||||
->setParameter('isactive', true);
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
case 'all':
|
||||
$niveau01 = $this->getUser()->getNiveau01();
|
||||
$niveau02 = $this->getUser()->getNiveau02();
|
||||
$niveau03 = $this->getUser()->getNiveau03();
|
||||
@ -399,7 +405,9 @@ class GroupController extends AbstractController
|
||||
$qb->select('COUNT(user)')
|
||||
->from('App:User', 'user')
|
||||
->where($qb->expr()->not($qb->expr()->exists($sub->getDQL())))
|
||||
->setParameter('groupid', $id);
|
||||
->andWhere('user.isactive=:isactive')
|
||||
->setParameter('groupid', $id)
|
||||
->setParameter('isactive', true);
|
||||
|
||||
switch ($request->getSession()->get('scopeannu')) {
|
||||
case 1:
|
||||
@ -434,8 +442,10 @@ class GroupController extends AbstractController
|
||||
->from('App:User', 'user')
|
||||
->where('user.username LIKE :value OR user.email LIKE :value')
|
||||
->andWhere($qb->expr()->not($qb->expr()->exists($sub->getDQL())))
|
||||
->andWhere('user.isactive=:isactive')
|
||||
->setParameter('value', '%'.$search['value'].'%')
|
||||
->setParameter('groupid', $id)
|
||||
->setParameter('isactive', true)
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
break;
|
||||
@ -449,21 +459,25 @@ class GroupController extends AbstractController
|
||||
->andWhere($qb->expr()->not($qb->expr()->exists($sub->getDQL())))
|
||||
->andWhere('usermodo.niveau01 = user.niveau01')
|
||||
->andWhere('usermodo.user = :userid')
|
||||
->andWhere('user.isactive=:isactive')
|
||||
->setParameter('userid', $usermodo)
|
||||
->setParameter('value', '%'.$search['value'].'%')
|
||||
->setParameter('groupid', $id)
|
||||
->setParameter('isactive', true)
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
case 'all':
|
||||
$qb = $em->getManager()->createQueryBuilder()
|
||||
->select('COUNT(user)')
|
||||
->from('App:User', 'user')
|
||||
->where('user.username LIKE :value OR user.email LIKE :value')
|
||||
->andWhere($qb->expr()->not($qb->expr()->exists($sub->getDQL())))
|
||||
->andWhere('user.isactive=:isactive')
|
||||
->setParameter('value', '%'.$search['value'].'%')
|
||||
->setParameter('groupid', $id);
|
||||
->setParameter('groupid', $id)
|
||||
->setParameter('isactive', true);
|
||||
|
||||
switch ($request->getSession()->get('scopeannu')) {
|
||||
case 1:
|
||||
@ -498,23 +512,23 @@ class GroupController extends AbstractController
|
||||
|
||||
// Parcours des Enregistrement
|
||||
$qb = $em->getManager()->createQueryBuilder();
|
||||
$qb->select('user')->from('App:User', 'user');
|
||||
$qb->select('user')->from('App:User', 'user')->Where('user.isactive=:isactive')->setParameter('isactive', true);
|
||||
|
||||
switch ($access) {
|
||||
case 'admin':
|
||||
$qb->where($qb->expr()->not($qb->expr()->exists($sub->getDQL())));
|
||||
$qb->andWhere($qb->expr()->not($qb->expr()->exists($sub->getDQL())));
|
||||
break;
|
||||
|
||||
case 'modo':
|
||||
$qb->from('App:UserModo', 'usermodo')
|
||||
->where($qb->expr()->not($qb->expr()->exists($sub->getDQL())))
|
||||
->andWhere($qb->expr()->not($qb->expr()->exists($sub->getDQL())))
|
||||
->andWhere('usermodo.niveau01 = user.niveau01')
|
||||
->andWhere('usermodo.user = :userid')
|
||||
->setParameter('userid', $usermodo);
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
$qb->where($qb->expr()->not($qb->expr()->exists($sub->getDQL())));
|
||||
case 'all':
|
||||
$qb->andWhere($qb->expr()->not($qb->expr()->exists($sub->getDQL())));
|
||||
switch ($request->getSession()->get('scopeannu')) {
|
||||
case 1:
|
||||
$qb->andWhere('user.niveau01 = :niveau01')->setParameter('niveau01', $niveau01);
|
||||
@ -598,7 +612,7 @@ class GroupController extends AbstractController
|
||||
|
||||
// Nombre total d'enregistrement
|
||||
$qb = $em->getManager()->createQueryBuilder();
|
||||
if ('admin' == $access || 'user' == $access) {
|
||||
if ('admin' == $access || 'all' == $access) {
|
||||
$qb->select('COUNT(user)')
|
||||
->from('App:User', 'user')
|
||||
->where($qb->expr()->exists($sub->getDQL()))
|
||||
@ -620,7 +634,7 @@ class GroupController extends AbstractController
|
||||
if ('' == $search['value']) {
|
||||
$totalf = $total;
|
||||
} else {
|
||||
if ('admin' == $access || 'user' == $access) {
|
||||
if ('admin' == $access || 'all' == $access) {
|
||||
$totalf = $em->getManager()->createQueryBuilder()
|
||||
->select('COUNT(user)')
|
||||
->from('App:User', 'user')
|
||||
@ -659,7 +673,7 @@ class GroupController extends AbstractController
|
||||
$qb = $em->getManager()->createQueryBuilder();
|
||||
$qb->select('user')->from('App:User', 'user');
|
||||
|
||||
if ('admin' == $access || 'user' == $access) {
|
||||
if ('admin' == $access || 'all' == $access) {
|
||||
$qb->where($qb->expr()->exists($sub->getDQL()));
|
||||
} else {
|
||||
$qb->from('App:UserModo', 'usermodo')
|
||||
@ -715,7 +729,7 @@ class GroupController extends AbstractController
|
||||
$rolegroup = (0 == $usergroup->getRolegroup() ? 'Utilisateur' : (50 == $usergroup->getRolegroup() ? 'Collaborateur' : 'Gestionnaire'));
|
||||
}
|
||||
|
||||
$tmp = ['DT_RowId' => 'user'.$data->getId(), $action, $avatar, $data->getUsername(), $data->getEmail(), $rolegroup];
|
||||
$tmp = ['DT_RowId' => 'user'.$data->getId(), $action, $avatar, $data->getUsername().(!$data->isIsactive() ? '<br><small><i>Inactif</i></small>' : ''), $data->getEmail(), $rolegroup];
|
||||
array_push($output['data'], $tmp);
|
||||
}
|
||||
|
||||
@ -842,7 +856,7 @@ class GroupController extends AbstractController
|
||||
break;
|
||||
case 'modo': return false;
|
||||
break;
|
||||
case 'user': return $request->getSession()->get('submitgroup');
|
||||
case 'all': return $request->getSession()->get('submitgroup');
|
||||
break;
|
||||
}
|
||||
throw $this->createAccessDeniedException('Permission denied');
|
||||
@ -854,7 +868,7 @@ class GroupController extends AbstractController
|
||||
switch ($access) {
|
||||
case 'admin': $toreturn = ($entity->getId() > 0);
|
||||
break;
|
||||
case 'user':
|
||||
case 'all':
|
||||
if (!$entity->isIsworkgroup() || $entity->getOwner() != $this->getUser()) {
|
||||
$toreturn = false;
|
||||
} else {
|
||||
@ -877,7 +891,7 @@ class GroupController extends AbstractController
|
||||
break;
|
||||
case 'modo': $toreturn = ($entity->getId() > 0);
|
||||
break;
|
||||
case 'user':
|
||||
case 'all':
|
||||
$usergroup = $em->getRepository("App\Entity\UserGroup")->findOneBy(['user' => $this->getUser(), 'group' => $entity]);
|
||||
if (!$usergroup || !$entity->isIsworkgroup() || $entity->getId() < 0) {
|
||||
$toreturn = false;
|
||||
@ -901,7 +915,7 @@ class GroupController extends AbstractController
|
||||
break;
|
||||
case 'modo': $toreturn = ($entity->getId() > 0);
|
||||
break;
|
||||
case 'user':
|
||||
case 'all':
|
||||
$usergroup = $em->getRepository("App\Entity\UserGroup")->findOneBy(['user' => $this->getUser(), 'group' => $entity]);
|
||||
if (!$usergroup || !$entity->isIsworkgroup() || $entity->getId() < 0) {
|
||||
$toreturn = false;
|
||||
|
Reference in New Issue
Block a user