diff --git a/.env b/.env
index 85ca998..e7c8bc2 100644
--- a/.env
+++ b/.env
@@ -27,6 +27,8 @@ APP_MODEREGISTRATION= # null | BYADMIN | BYUSER
APP_ADMINS='["admin"]'
# Structure Organisationnelle
+APP_NIVEAUUPDATABLE=0 # Quel degres de niveau est modifiable par les utilisateurs seule les admin et modo via console peuvent outre passer ce param
+
APP_NIVEAU01LABEL="Niveau 01"
APP_NIVEAU01LABELS="Niveaux 01"
@@ -45,8 +47,6 @@ APP_NIVEAU04LABEL="Niveau 04"
APP_NIVEAU04LABELS="Niveaux 04"
APP_NIVEAU04MANDATORY='[""]'
-APP_NIVEAUUPDATABLE=0 # Quel degres de niveau est modifiable par les utilisateurs seule les admin et modo via console peuvent outre passer ce param
-
APP_GROUPUSE=1
APP_GROUPSUBMITER='["ALL"]'
diff --git a/config/packages/security.yaml b/config/packages/security.yaml
index a0efbec..27854b6 100644
--- a/config/packages/security.yaml
+++ b/config/packages/security.yaml
@@ -33,8 +33,11 @@ security:
target: app_home
access_control:
- - { path: ^/user, roles: [ROLE_ADMIN, ROLE_MODO, ROLE_ANIM, ROLE_USER] }
- - { path: ^/modo, roles: [ROLE_ADMIN, ROLE_MODO] }
+ - { path: ^/all, roles: [ROLE_ADMIN, ROLE_MODO, ROLE_MASTER, ROLE_MANAGER, ROLE_USER] }
+ - { path: ^/user, roles: [ROLE_USER] }
+ - { path: ^/manager, roles: [ROLE_MANAGER] }
+ - { path: ^/master, roles: [ROLE_MASTER] }
+ - { path: ^/modo, roles: [ROLE_MODO] }
- { path: ^/admin, roles: [ROLE_ADMIN] }
when@test:
diff --git a/config/routes.yaml b/config/routes.yaml
index 57a6c98..3229ea2 100644
--- a/config/routes.yaml
+++ b/config/routes.yaml
@@ -6,23 +6,34 @@ app_home:
app_user_home:
path: /user
controller: App\Controller\HomeController::homeuser
- defaults: { access: admin }
+ defaults: { access: user }
-app_admin_home:
- path: /admin
- controller: App\Controller\HomeController::homeadmin
- defaults: { access: admin }
+app_manager_home:
+ path: /manager
+ controller: App\Controller\HomeController::homemanager
+ defaults: { access: manager }
+
+app_master_home:
+ path: /master
+ controller: App\Controller\HomeController::homemaster
+ defaults: { access: master }
app_modo_home:
path: /modo
controller: App\Controller\HomeController::homemodo
defaults: { access: modo }
+app_admin_home:
+ path: /admin
+ controller: App\Controller\HomeController::homeadmin
+ defaults: { access: admin }
+
oneup_uploader:
resource: .
type: uploader
#== Security ====================================================================================================
+#-- Access public
app_login:
path: /login
controller: App\Controller\SecurityController::login
@@ -39,28 +50,21 @@ app_logout:
path: /logout
controller: App\Controller\SecurityController::logout
-app_redirect:
- path: /user/redirect/{route}/{id}
- controller: App\Controller\SecurityController::redirecturl
- defaults: { access: user }
-
app_noperm:
path: /noperm
controller: App\Controller\SecurityController::noperm
#== Websocket====================================================================================================
-#-- Access user
+#-- Access all
app_publish_sample:
- path: /user/publish/sample/{id}
+ path: /all/publish/sample/{id}
controller: App\Controller\PublishController::sample
- defaults: { access: user }
+ defaults: { access: all }
app_publish:
- path: /user/publish/{channel}/{id}
+ path: /all/publish/{channel}/{id}
controller: App\Controller\PublishController::publish
- defaults: { access: user }
-
-
+ defaults: { access: all }
#== Config ======================================================================================================
#-- Access admin
@@ -95,7 +99,6 @@ app_admin_config_logo:
defaults: { access: admin }
#== Theme =======================================================================================================
-
#-- Access admin
app_admin_theme:
path: /admin/theme
@@ -108,7 +111,7 @@ app_admin_theme_select:
defaults: { name: "", access: admin }
#== API =========================================================================================================
-#-- Access visiteur
+#-- Access public
app_rest:
path: /docrest
controller: App\Controller\HomeController::docrest
@@ -146,44 +149,16 @@ app_admin_log_get:
defaults: { access: admin }
#== Crop ========================================================================================================
-#-- Access user
-app_user_crop01:
- path: /user/crop01/{type}/{reportinput}
+#-- Access all
+app_all_crop01:
+ path: /all/crop01/{type}/{reportinput}
controller: App\Controller\CropController::crop01
-app_user_crop02:
- path: /user/crop02/{type}/{reportinput}
+app_all_crop02:
+ path: /all/crop02/{type}/{reportinput}
controller: App\Controller\CropController::crop02
#== Minio =======================================================================================================
-
-#-- Access admin
-app_admin_minio_image:
- path: /admin/minio/image
- controller: App\Controller\MinioController::image
-
-app_admin_minio_document:
- path: /admin/minio/document
- controller: App\Controller\MinioController::document
-
-#-- Access modo
-app_modo_minio_image:
- path: /modo/minio/image
- controller: App\Controller\MinioController::image
-
-app_modo_minio_document:
- path: /modo/minio/document
- controller: App\Controller\MinioController::document
-
-#-- Access user
-app_user_minio_image:
- path: /user/minio/image
- controller: App\Controller\MinioController::image
-
-app_user_minio_document:
- path: /user/minio/document
- controller: App\Controller\MinioController::document
-
#-- Access public
app_minio_logo:
path: /minio/logo
@@ -198,7 +173,7 @@ app_minio_document:
controller: App\Controller\MinioController::document
#== Hydra =======================================================================================================
-
+#-- Access public
app_hydra_loginsql:
path: /hydra/loginsql
controller: App\Controller\HydraController::loginsql
@@ -220,13 +195,13 @@ app_hydra_consent:
controller: App\Controller\HydraController::consent
#== Ckeditor ====================================================================================================
+#-- Access all
app_ckeditor_upload:
- path: /user/upload
+ path: /all/upload
controller: App\Controller\MinioController::ckupload
- defaults: { access: user }
+ defaults: { access: all }
#== Audit =======================================================================================================
-
#--Access admin
app_admin_audit_renderid:
path: /admin/audit/{entityname}/{entityid}
@@ -324,8 +299,7 @@ app_modo_niveau02_delete:
controller: App\Controller\Niveau02Controller::delete
defaults: { access: modo }
-
-#-- Access visiteur
+#-- Access public
app_niveau02_selectlist:
path: /niveau02/selectlist
controller: App\Controller\Niveau02Controller::selectlist
@@ -383,8 +357,7 @@ app_modo_niveau03_delete:
controller: App\Controller\Niveau03Controller::delete
defaults: { access: modo }
-
-#-- Access visiteur
+#-- Access public
app_niveau03_selectlist:
path: /niveau03/selectlist
controller: App\Controller\Niveau03Controller::selectlist
@@ -442,7 +415,7 @@ app_modo_niveau04_delete:
controller: App\Controller\Niveau04Controller::delete
defaults: { access: modo }
-#-- Access visiteur
+#-- Access public
app_niveau04_selectlist:
path: /niveau04/selectlist
controller: App\Controller\Niveau04Controller::selectlist
@@ -545,67 +518,66 @@ app_modo_group_usergroup_changerole:
controller: App\Controller\GroupController::userchangerole
defaults: { access: modo }
-
-#-- Access user
-app_user_group:
- path: /user/group
+#-- Access all
+app_all_group:
+ path: /all/group
controller: App\Controller\GroupController::list
- defaults: { access: user }
+ defaults: { access: all }
-app_user_group_tablelist:
- path: /user/group/tablelist
+app_all_group_tablelist:
+ path: /all/group/tablelist
controller: App\Controller\GroupController::tablelist
- defaults: { access: user }
+ defaults: { access: all }
-app_user_group_submit:
- path: /user/group/submit
+app_all_group_submit:
+ path: /all/group/submit
controller: App\Controller\GroupController::submit
- defaults: { access: user }
+ defaults: { access: all }
-app_user_group_update:
- path: /user/group/update/{id}
+app_all_group_update:
+ path: /all/group/update/{id}
controller: App\Controller\GroupController::update
- defaults: { access: user }
+ defaults: { access: all }
-app_user_group_delete:
- path: /user/group/delete/{id}
+app_all_group_delete:
+ path: /all/group/delete/{id}
controller: App\Controller\GroupController::delete
- defaults: { access: user }
+ defaults: { access: all }
-app_user_group_users:
- path: /user/group/users/{id}
+app_all_group_users:
+ path: /all/group/users/{id}
controller: App\Controller\GroupController::users
- defaults: { access: user }
+ defaults: { access: all }
-app_user_group_usersnotin:
- path: /user/group/usersnotin/{id}
+app_all_group_usersnotin:
+ path: /all/group/usersnotin/{id}
controller: App\Controller\GroupController::usersnotin
- defaults: { access: user }
+ defaults: { access: all }
-app_user_group_usersin:
- path: /user/group/usersin/{id}
+app_all_group_usersin:
+ path: /all/group/usersin/{id}
controller: App\Controller\GroupController::usersin
- defaults: { access: user }
+ defaults: { access: all }
-app_user_group_usergroup_add:
- path: /user/group/usergroup/add/{groupid}/{userid}
+app_all_group_usergroup_add:
+ path: /all/group/usergroup/add/{groupid}/{userid}
controller: App\Controller\GroupController::useradd
- defaults: { access: user }
+ defaults: { access: all }
-app_user_group_usergroup_del:
- path: /user/group/usergroup/del/{groupid}/{userid}
+app_all_group_usergroup_del:
+ path: /all/group/usergroup/del/{groupid}/{userid}
controller: App\Controller\GroupController::userdel
- defaults: { access: user }
+ defaults: { access: all }
-app_user_group_usergroup_changerole:
- path: /user/group/usergroup/changerole/{groupid}/{userid}/{roleid}
+app_all_group_usergroup_changerole:
+ path: /all/group/usergroup/changerole/{groupid}/{userid}/{roleid}
controller: App\Controller\GroupController::userchangerole
- defaults: { access: user }
+ defaults: { access: all }
-app_user_group_userout:
- path: /user/group/userout/{id}
+app_all_group_userout:
+ path: /all/group/userout/{id}
controller: App\Controller\GroupController::userout
- defaults: { access: user }
+ defaults: { access: all }
#== Whitelist ===================================================================================================
#-- Access admin
@@ -634,7 +606,7 @@ app_admin_whitelist_delete:
controller: App\Controller\WhitelistController::delete
defaults: { access: admin }
-#-- Acces visiteur
+#-- Access public
app_whitelist_is:
path: /whitelist/is
controller: App\Controller\WhitelistController::is
@@ -682,7 +654,7 @@ app_modo_registration_delete:
controller: App\Controller\RegistrationController::delete
defaults: { access: modo }
-#-- Access visiteur
+#-- Access public
app_registration:
path: /registration
controller: App\Controller\RegistrationController::submit
@@ -766,33 +738,34 @@ app_modo_user_delete:
controller: App\Controller\UserController::delete
defaults: { access: modo }
-#-- Access user
-app_user_user:
- path: /user/update
+#-- Access all
+app_all_user:
+ path: /all/update
controller: App\Controller\UserController::profil
- defaults: { access: user }
+ defaults: { access: all }
-app_user_users:
- path: /user/users
+app_all_users:
+ path: /all/users
controller: App\Controller\UserController::list
- defaults: { access: user }
+ defaults: { access: all }
-app_user_user_tablelist:
- path: /user/user/tablelist
+app_all_user_tablelist:
+ path: /all/user/tablelist
controller: App\Controller\UserController::tablelist
- defaults: { access: user }
+ defaults: { access: all }
-app_user_user_selectlist:
- path: /user/user/selectlist
+app_all_user_selectlist:
+ path: /all/user/selectlist
controller: App\Controller\UserController::selectlist
- defaults: { access: user }
+ defaults: { access: all }
-app_user_view:
- path: /user/view/{id}
+app_all_view:
+ path: /all/view/{id}
controller: App\Controller\UserController::view
- defaults: { access: user }
+ defaults: { access: all }
-app_user_preference:
- path: /user/preference
+app_all_preference:
+ path: /all/preference
controller: App\Controller\UserController::preference
- defaults: { access: user }
\ No newline at end of file
+ defaults: { access: all }
+
diff --git a/migrations/Version20220929145036.php b/migrations/Version20221002124137.php
similarity index 93%
rename from migrations/Version20220929145036.php
rename to migrations/Version20221002124137.php
index 7c016e2..96fa01e 100644
--- a/migrations/Version20220929145036.php
+++ b/migrations/Version20221002124137.php
@@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
-final class Version20220929145036 extends AbstractMigration
+final class Version20221002124137 extends AbstractMigration
{
public function getDescription(): string
{
@@ -40,15 +40,15 @@ final class Version20220929145036 extends AbstractMigration
$this->addSql('CREATE TABLE groupe (id INT NOT NULL, owner_id INT DEFAULT NULL, label VARCHAR(250) NOT NULL, description TEXT DEFAULT NULL, email VARCHAR(250) DEFAULT NULL, isopen BOOLEAN DEFAULT false NOT NULL, isworkgroup BOOLEAN DEFAULT false NOT NULL, apikey VARCHAR(255) NOT NULL, ldapfilter TEXT DEFAULT NULL, attributes TEXT DEFAULT NULL, idexternal TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_4B98C21EA750E8 ON groupe (label)');
$this->addSql('CREATE INDEX IDX_4B98C217E3C61F9 ON groupe (owner_id)');
- $this->addSql('CREATE TABLE niveau01 (id INT NOT NULL, label VARCHAR(250) NOT NULL, apikey VARCHAR(255) NOT NULL, ldapfilter TEXT DEFAULT NULL, attributes TEXT DEFAULT NULL, idexternal TEXT DEFAULT NULL, PRIMARY KEY(id))');
+ $this->addSql('CREATE TABLE niveau01 (id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, ldapfilter TEXT DEFAULT NULL, attributes TEXT DEFAULT NULL, idexternal TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_6DFC7E23EA750E8 ON niveau01 (label)');
- $this->addSql('CREATE TABLE niveau02 (id INT NOT NULL, niveau01_id INT NOT NULL, label VARCHAR(250) NOT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
+ $this->addSql('CREATE TABLE niveau02 (id INT NOT NULL, niveau01_id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_F4F52F99EA750E8 ON niveau02 (label)');
$this->addSql('CREATE INDEX IDX_F4F52F9959FDD7AB ON niveau02 (niveau01_id)');
- $this->addSql('CREATE TABLE niveau03 (id INT NOT NULL, niveau02_id INT NOT NULL, label VARCHAR(250) NOT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
+ $this->addSql('CREATE TABLE niveau03 (id INT NOT NULL, niveau02_id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_83F21F0FEA750E8 ON niveau03 (label)');
$this->addSql('CREATE INDEX IDX_83F21F0F4B487845 ON niveau03 (niveau02_id)');
- $this->addSql('CREATE TABLE niveau04 (id INT NOT NULL, niveau03_id INT NOT NULL, label VARCHAR(250) NOT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
+ $this->addSql('CREATE TABLE niveau04 (id INT NOT NULL, niveau03_id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D968AACEA750E8 ON niveau04 (label)');
$this->addSql('CREATE INDEX IDX_1D968AACF3F41F20 ON niveau04 (niveau03_id)');
$this->addSql('CREATE TABLE registration (id INT NOT NULL, niveau01_id INT NOT NULL, niveau02_id INT DEFAULT NULL, niveau03_id INT DEFAULT NULL, niveau04_id INT DEFAULT NULL, username VARCHAR(128) NOT NULL, firstname VARCHAR(250) DEFAULT NULL, lastname VARCHAR(250) DEFAULT NULL, password VARCHAR(250) NOT NULL, salt VARCHAR(250) NOT NULL, email VARCHAR(128) NOT NULL, isvisible BOOLEAN NOT NULL, postaladress VARCHAR(250) DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, job VARCHAR(250) DEFAULT NULL, position VARCHAR(250) DEFAULT NULL, motivation TEXT DEFAULT NULL, note TEXT DEFAULT NULL, keyexpire TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, keyvalue VARCHAR(60) DEFAULT NULL, statut INT NOT NULL, PRIMARY KEY(id))');
diff --git a/src/Command/SynchroCommand.php b/src/Command/SynchroCommand.php
index d9f2986..7b35acd 100644
--- a/src/Command/SynchroCommand.php
+++ b/src/Command/SynchroCommand.php
@@ -424,8 +424,13 @@ class SynchroCommand extends Command
if (!in_array($user->getUsername(), $tbusers)) {
if ($user->getId() > 0) {
$this->writeln(' > '.$user->getUSername());
- $this->em->remove($user);
- $this->em->flush();
+ try {
+ $this->em->remove($user);
+ $this->em->flush();
+ } catch (\Exception $e) {
+ $user->setIsactive(false);
+ $this->em->flush();
+ }
}
}
}
@@ -518,7 +523,7 @@ class SynchroCommand extends Command
$this->writeln('');
$this->writeln('== USER =============================================');
- $users = $this->em->getRepository("App\Entity\User")->findAll();
+ $users = $this->em->getRepository("App\Entity\User")->findBy(['isactive' => true]);
$attributes = $this->ldap->listAttributesUser();
foreach ($users as $user) {
$filter = str_replace('*', $user->getUsername(), $this->filteruser);
@@ -534,7 +539,7 @@ class SynchroCommand extends Command
$ldapentrys = $this->ldap->search($this->filteruser, $attributes, $this->baseuser);
foreach ($ldapentrys as $ldapentry) {
- $user = $this->em->getRepository("App\Entity\User")->findOneBy(['username' => $ldapentry['uid']]);
+ $user = $this->em->getRepository("App\Entity\User")->findOneBy(['username' => $ldapentry['uid'], 'isactive' => true]);
if (!$user) {
$this->writeln($ldapentry['uid'].' = DELETE');
$dn = $this->ldap->getUserDN($ldapentry['uid']);
@@ -959,8 +964,13 @@ class SynchroCommand extends Command
if (!in_array($user->getUsername(), $tbusers)) {
if ($user->getId() > 0) {
$this->writeln(' > '.$user->getUsername());
- $this->em->remove($user);
- $this->em->flush();
+ try {
+ $this->em->remove($user);
+ $this->em->flush();
+ } catch (\Exception $e) {
+ $user->setIsactive(false);
+ $this->em->flush();
+ }
}
}
}
diff --git a/src/Controller/GroupController.php b/src/Controller/GroupController.php
index 1d67023..25c335a 100644
--- a/src/Controller/GroupController.php
+++ b/src/Controller/GroupController.php
@@ -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 .= "route).'_update', ['id' => $data->getId()])."'>";
}
@@ -164,8 +164,10 @@ class GroupController extends AbstractController
$userinfo = '';
if ($data->getOwner()) {
- $userinfo .= " 'avatar/'.$data->getOwner()->getAvatar()])."' class='avatar'>";
- $userinfo .= '
'.$data->getOwner()->getUsername();
+ $userinfo .= '
';
+ $userinfo .= "
'avatar/'.$data->getOwner()->getAvatar()])."' class='avatar me-2'>";
+ $userinfo .= '
'.$data->getOwner()->getFullname().'
';
+ $userinfo .= '
';
}
$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() ? '
Inactif' : ''), $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;
diff --git a/src/Controller/RegistrationController.php b/src/Controller/RegistrationController.php
index 0e243a1..c602728 100755
--- a/src/Controller/RegistrationController.php
+++ b/src/Controller/RegistrationController.php
@@ -194,11 +194,11 @@ class RegistrationController extends AbstractController
$data = new Registration();
$data->setIsvisible(true);
-
+
// Création du formulaire
$form = $this->createForm(Form::class, $data, [
'mode' => 'submit',
- 'access' => 'user',
+ 'access' => 'all',
'userid' => null,
'appMasteridentity' => $this->GetParameter('appMasteridentity'),
'appNiveau01label' => $this->GetParameter('appNiveau01label'),
diff --git a/src/Controller/SecurityController.php b/src/Controller/SecurityController.php
index 9bd435a..d288bd8 100755
--- a/src/Controller/SecurityController.php
+++ b/src/Controller/SecurityController.php
@@ -135,7 +135,9 @@ class SecurityController extends AbstractController
$user = $this->submituser($username, $firstname, $lastname, $email, $avatar, $niveau01, $em);
$user = $em->getRepository('App\Entity\Group')->calculateSSOGroup($user, $attributes);
} elseif ($this->getParameter('casAutoupdate')) {
- if(!$user->Isactive()) return $this->redirect($this->generateUrl('app_noperm'));
+ if (!$user->Isactive()) {
+ return $this->redirect($this->generateUrl('app_noperm'));
+ }
$this->submitSSONiveau01($attributes, $em);
$this->submitSSOGroup($attributes, $em);
$this->updateuser($user, $firstname, $lastname, $email, $avatar, $em);
@@ -556,7 +558,9 @@ class SecurityController extends AbstractController
private function autoconnexion($user, $redirect, Request $request)
{
- if(!$user->isIsactive()) return $this->redirect($this->generateUrl('app_noperm'));
+ if (!$user->isIsactive()) {
+ return $this->redirect($this->generateUrl('app_noperm'));
+ }
// Récupérer le token de l'utilisateur
$token = new UsernamePasswordToken($user, 'main', $user->getRoles());
diff --git a/src/Controller/UserController.php b/src/Controller/UserController.php
index 62fc7c3..cb975af 100644
--- a/src/Controller/UserController.php
+++ b/src/Controller/UserController.php
@@ -20,17 +20,20 @@ class UserController extends AbstractController
private $twig = 'User/';
private $route = 'app_admin_user';
- public function list($access, Request $request): Response
+ public function list($access, Request $request, ManagerRegistry $em): Response
{
- if ('user' == $access && !$request->getSession()->get('showannuaire')) {
+ if ('all' == $access && !$request->getSession()->get('showannuaire')) {
throw $this->createAccessDeniedException('Permission denied');
}
+ dump($em->getRepository($this->entity)->getPreference($this->getUser(), 'userisactive', true));
+
return $this->render($this->twig.'list.html.twig', [
'useheader' => true,
'usemenu' => false,
- 'usesidebar' => ('user' != $access),
+ 'usesidebar' => ('all' != $access),
'access' => $access,
+ 'isactive' => ('true' == $em->getRepository($this->entity)->getPreference($this->getUser(), 'userisactive', true)),
]);
}
@@ -47,31 +50,48 @@ class UserController extends AbstractController
$niveau02 = null;
$niveau03 = null;
$niveau04 = null;
+ $isactive = true;
// Nombre total d'enregistrement
switch ($access) {
case 'admin':
- $total = $em->getManager()->createQueryBuilder()->select('COUNT(entity)')->from($this->entity, 'entity')->getQuery()->getSingleScalarResult();
+ $isactive = $em->getRepository($this->entity)->getPreference($this->getUser(), 'userisactive', true);
+ $total = $em->getManager()->createQueryBuilder()
+ ->select('COUNT(entity)')
+ ->from($this->entity, 'entity')
+ ->where('entity.isactive = :isactive')
+ ->setParameter('isactive', $isactive)
+ ->getQuery()->getSingleScalarResult();
break;
case 'modo':
+ $isactive = $em->getRepository($this->entity)->getPreference($this->getUser(), 'userisactive', true);
$total = $em->getManager()->createQueryBuilder()
->select('COUNT(entity)')
->from($this->entity, 'entity')
->from("App\Entity\UserModo", 'usermodo')
->where('usermodo.niveau01 = entity.niveau01')
->andWhere('usermodo.user = :user')
+ ->where('entity.isactive = :isactive')
+ ->setParameter('isactive', $isactive)
->setParameter('user', $this->getUser())
->getQuery()->getSingleScalarResult();
break;
default:
+ $isactive = true;
$niveau01 = $this->getUser()->getNiveau01();
$niveau02 = $this->getUser()->getNiveau02();
$niveau03 = $this->getUser()->getNiveau03();
$niveau04 = $this->getUser()->getNiveau04();
- $qb = $em->getManager()->createQueryBuilder()->select('COUNT(entity)')->from($this->entity, 'entity')->where('entity.isvisible=true');
+ $qb = $em->getManager()->createQueryBuilder()
+ ->select('COUNT(entity)')
+ ->from($this->entity, 'entity')
+ ->where('entity.isvisible=true')
+ ->where('entity.isactive = :isactive')
+ ->setParameter('isactive', $isactive);
+
switch ($request->getSession()->get('scopeannu')) {
case 1:
$qb->andWhere('entity.niveau01 = :niveau01')->setParameter('niveau01', $niveau01);
@@ -105,7 +125,9 @@ class UserController extends AbstractController
->from($this->entity, 'entity')
->from('App:Niveau01', 'niveau01')
->where('entity.niveau01=niveau01.id')
+ ->andwhere('entity.isactive = :isactive')
->andWhere('entity.username LIKE :value OR entity.firstname LIKE :value OR entity.lastname LIKE :value OR entity.email LIKE :value OR entity.roles LIKE :value OR niveau01.label LIKE :value')
+ ->setParameter('isactive', $isactive)
->setParameter('value', '%'.$search['value'].'%')
->getQuery()
->getSingleScalarResult();
@@ -118,10 +140,12 @@ class UserController extends AbstractController
->from('App:Niveau01', 'niveau01')
->from('App:UserModo', 'usermodo')
->where('entity.niveau01=niveau01.id')
+ ->andwhere('entity.isactive = :isactive')
->andWhere('entity.username LIKE :value OR entity.firstname LIKE :value OR entity.lastname LIKE :value OR entity.email LIKE :value OR entity.roles LIKE :value OR niveau01.label LIKE :value')
->andWhere('usermodo.niveau01 = entity.niveau01')
->andWhere('usermodo.user = :userid')
->setParameter('value', '%'.$search['value'].'%')
+ ->setParameter('isactive', $isactive)
->setParameter('userid', $this->getUser()->getId())
->getQuery()
->getSingleScalarResult();
@@ -133,9 +157,11 @@ class UserController extends AbstractController
->from($this->entity, 'entity')
->from('App:Niveau01', 'niveau01')
->where('entity.niveau01=niveau01.id')
+ ->andwhere('entity.isactive = :isactive')
->andWhere('entity.isvisible=true')
->andWhere('entity.username LIKE :value OR entity.firstname LIKE :value OR entity.lastname LIKE :value OR entity.email LIKE :value OR entity.roles LIKE :value OR niveau01.label LIKE :value')
- ->setParameter('value', '%'.$search['value'].'%');
+ ->setParameter('value', '%'.$search['value'].'%')
+ ->setParameter('isactive', $isactive);
switch ($request->getSession()->get('scopeannu')) {
case 1:
@@ -174,6 +200,8 @@ class UserController extends AbstractController
case 'admin':
$qb->select('entity')->from($this->entity, 'entity')->from('App:Niveau01', 'niveau01');
$qb->where('entity.niveau01=niveau01.id');
+ $qb->andwhere('entity.isactive = :isactive');
+ $qb->setParameter('isactive', $isactive);
break;
case 'modo':
@@ -181,6 +209,8 @@ class UserController extends AbstractController
$qb->where('entity.niveau01=niveau01.id');
$qb->andWhere('usermodo.niveau01 = entity.niveau01');
$qb->andWhere('usermodo.user = :userid');
+ $qb->andwhere('entity.isactive = :isactive');
+ $qb->setParameter('isactive', $isactive);
$qb->setParameter('userid', $this->getUser()->getId());
break;
@@ -188,6 +218,8 @@ class UserController extends AbstractController
$qb->select('entity')->from($this->entity, 'entity')->from('App:Niveau01', 'niveau01');
$qb->where('entity.niveau01=niveau01.id');
$qb->andWhere('entity.isvisible=true');
+ $qb->andwhere('entity.isactive = :isactive');
+ $qb->setParameter('isactive', $isactive);
switch ($request->getSession()->get('scopeannu')) {
case 1:
@@ -316,12 +348,14 @@ class UserController extends AbstractController
$qb = $em->getManager()->createQueryBuilder();
$qb->select('entity')->from($this->entity, 'entity')
->where('entity.username LIKE :value')
+ ->orWhere('entity.lastname LIKE :value')
+ ->orWhere('entity.firstname LIKE :value')
->setParameter('value', '%'.$q.'%')
->orderBy('entity.username');
$datas = $qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach ($datas as $data) {
- array_push($output, ['id' => $data->getId(), 'text' => $data->getUsername()]);
+ array_push($output, ['id' => $data->getId(), 'text' => $data->getFullname()]);
}
$ret_string['results'] = $output;
@@ -344,6 +378,7 @@ class UserController extends AbstractController
$data = new Entity();
$data->setAvatar('noavatar.png');
$data->setIsvisible(true);
+ $data->setIsactive(true);
$data->setApikey(Uuid::uuid4());
// Création du formulaire
@@ -566,7 +601,7 @@ class UserController extends AbstractController
}
// Retour à la liste
- if ('user' == $access) {
+ if ('all' == $access) {
return $this->redirectToRoute('app_home');
} else {
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route));
@@ -584,7 +619,7 @@ class UserController extends AbstractController
$this->data => $data,
'listgroups' => $this->getListGroups($access, $em),
'listmodos' => $this->getListModos($em),
- 'maxsize' => ('user' == $access ? 1200 : null),
+ 'maxsize' => ('all' == $access ? 1200 : null),
]);
}
@@ -660,7 +695,7 @@ class UserController extends AbstractController
return true;
break;
- case 'user':
+ case 'all':
if ($this->getUser()->getId() != $entity->getId()) {
throw $this->createAccessDeniedException('Permission denied');
}
@@ -688,7 +723,7 @@ class UserController extends AbstractController
return true;
break;
- case 'user':
+ case 'all':
if ($this->getUser()->getId() != $entity->getId()) {
throw $this->createAccessDeniedException('Permission denied');
}
diff --git a/src/Entity/Niveau01.php b/src/Entity/Niveau01.php
index 00d55cb..a9ce71f 100644
--- a/src/Entity/Niveau01.php
+++ b/src/Entity/Niveau01.php
@@ -32,6 +32,26 @@ class Niveau01
*/
private $label;
+ /**
+ * @ORM\Column(type="text", nullable=true)
+ */
+ private $code;
+
+ /**
+ * @ORM\Column(type="text", nullable=true)
+ */
+ private $postaladress;
+
+ /**
+ * @ORM\Column(type="string", length=60, nullable=true)
+ */
+ private $telephonenumber;
+
+ /**
+ * @ORM\Column(type="string", length=60, nullable=true)
+ */
+ private $email;
+
/**
* @ORM\Column(type="string")
*/
@@ -285,4 +305,52 @@ class Niveau01
return $this;
}
+
+ public function getCode(): ?string
+ {
+ return $this->code;
+ }
+
+ public function setCode(?string $code): self
+ {
+ $this->code = $code;
+
+ return $this;
+ }
+
+ public function getPostaladress(): ?string
+ {
+ return $this->postaladress;
+ }
+
+ public function setPostaladress(?string $postaladress): self
+ {
+ $this->postaladress = $postaladress;
+
+ return $this;
+ }
+
+ public function getTelephonenumber(): ?string
+ {
+ return $this->telephonenumber;
+ }
+
+ public function setTelephonenumber(?string $telephonenumber): self
+ {
+ $this->telephonenumber = $telephonenumber;
+
+ return $this;
+ }
+
+ public function getEmail(): ?string
+ {
+ return $this->email;
+ }
+
+ public function setEmail(?string $email): self
+ {
+ $this->email = $email;
+
+ return $this;
+ }
}
diff --git a/src/Entity/Niveau02.php b/src/Entity/Niveau02.php
index f25a857..fe2e2b1 100644
--- a/src/Entity/Niveau02.php
+++ b/src/Entity/Niveau02.php
@@ -32,6 +32,26 @@ class Niveau02
*/
private $label;
+ /**
+ * @ORM\Column(type="text", nullable=true)
+ */
+ private $code;
+
+ /**
+ * @ORM\Column(type="text", nullable=true)
+ */
+ private $postaladress;
+
+ /**
+ * @ORM\Column(type="string", length=60, nullable=true)
+ */
+ private $telephonenumber;
+
+ /**
+ * @ORM\Column(type="string", length=60, nullable=true)
+ */
+ private $email;
+
/**
* @ORM\Column(type="string")
*/
@@ -204,4 +224,52 @@ class Niveau02
return $this;
}
+
+ public function getCode(): ?string
+ {
+ return $this->code;
+ }
+
+ public function setCode(?string $code): self
+ {
+ $this->code = $code;
+
+ return $this;
+ }
+
+ public function getPostaladress(): ?string
+ {
+ return $this->postaladress;
+ }
+
+ public function setPostaladress(?string $postaladress): self
+ {
+ $this->postaladress = $postaladress;
+
+ return $this;
+ }
+
+ public function getTelephonenumber(): ?string
+ {
+ return $this->telephonenumber;
+ }
+
+ public function setTelephonenumber(?string $telephonenumber): self
+ {
+ $this->telephonenumber = $telephonenumber;
+
+ return $this;
+ }
+
+ public function getEmail(): ?string
+ {
+ return $this->email;
+ }
+
+ public function setEmail(?string $email): self
+ {
+ $this->email = $email;
+
+ return $this;
+ }
}
diff --git a/src/Entity/Niveau03.php b/src/Entity/Niveau03.php
index 36ab22e..4a079f1 100644
--- a/src/Entity/Niveau03.php
+++ b/src/Entity/Niveau03.php
@@ -32,6 +32,26 @@ class Niveau03
*/
private $label;
+ /**
+ * @ORM\Column(type="text", nullable=true)
+ */
+ private $code;
+
+ /**
+ * @ORM\Column(type="text", nullable=true)
+ */
+ private $postaladress;
+
+ /**
+ * @ORM\Column(type="string", length=60, nullable=true)
+ */
+ private $telephonenumber;
+
+ /**
+ * @ORM\Column(type="string", length=60, nullable=true)
+ */
+ private $email;
+
/**
* @ORM\Column(type="string")
*/
@@ -220,4 +240,52 @@ class Niveau03
return $this;
}
+
+ public function getCode(): ?string
+ {
+ return $this->code;
+ }
+
+ public function setCode(?string $code): self
+ {
+ $this->code = $code;
+
+ return $this;
+ }
+
+ public function getPostaladress(): ?string
+ {
+ return $this->postaladress;
+ }
+
+ public function setPostaladress(?string $postaladress): self
+ {
+ $this->postaladress = $postaladress;
+
+ return $this;
+ }
+
+ public function getTelephonenumber(): ?string
+ {
+ return $this->telephonenumber;
+ }
+
+ public function setTelephonenumber(?string $telephonenumber): self
+ {
+ $this->telephonenumber = $telephonenumber;
+
+ return $this;
+ }
+
+ public function getEmail(): ?string
+ {
+ return $this->email;
+ }
+
+ public function setEmail(?string $email): self
+ {
+ $this->email = $email;
+
+ return $this;
+ }
}
diff --git a/src/Entity/Niveau04.php b/src/Entity/Niveau04.php
index 11d5a19..400c6fb 100644
--- a/src/Entity/Niveau04.php
+++ b/src/Entity/Niveau04.php
@@ -32,6 +32,26 @@ class Niveau04
*/
private $label;
+ /**
+ * @ORM\Column(type="text", nullable=true)
+ */
+ private $code;
+
+ /**
+ * @ORM\Column(type="text", nullable=true)
+ */
+ private $postaladress;
+
+ /**
+ * @ORM\Column(type="string", length=60, nullable=true)
+ */
+ private $telephonenumber;
+
+ /**
+ * @ORM\Column(type="string", length=60, nullable=true)
+ */
+ private $email;
+
/**
* @ORM\Column(type="string")
*/
@@ -196,4 +216,52 @@ class Niveau04
return $this;
}
+
+ public function getCode(): ?string
+ {
+ return $this->code;
+ }
+
+ public function setCode(?string $code): self
+ {
+ $this->code = $code;
+
+ return $this;
+ }
+
+ public function getPostaladress(): ?string
+ {
+ return $this->postaladress;
+ }
+
+ public function setPostaladress(?string $postaladress): self
+ {
+ $this->postaladress = $postaladress;
+
+ return $this;
+ }
+
+ public function getTelephonenumber(): ?string
+ {
+ return $this->telephonenumber;
+ }
+
+ public function setTelephonenumber(?string $telephonenumber): self
+ {
+ $this->telephonenumber = $telephonenumber;
+
+ return $this;
+ }
+
+ public function getEmail(): ?string
+ {
+ return $this->email;
+ }
+
+ public function setEmail(?string $email): self
+ {
+ $this->email = $email;
+
+ return $this;
+ }
}
diff --git a/src/Entity/User.php b/src/Entity/User.php
index fb2514c..815b35a 100644
--- a/src/Entity/User.php
+++ b/src/Entity/User.php
@@ -283,7 +283,12 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
public function getDisplayname()
{
- return $this->firstname.' '.$this->lastname;
+ return $this->firstname.' '.$this->lastname.(!$this->isactive ? ' (inactif)' : '');
+ }
+
+ public function getFullname()
+ {
+ return $this->username.' = '.$this->firstname.' '.$this->lastname.(!$this->isactive ? ' (inactif)' : '');
}
// == FIN DU CODE A NE PAS REGENERER
diff --git a/src/EventListener/UserSubscriber.php b/src/EventListener/UserSubscriber.php
index f69d063..73fb205 100644
--- a/src/EventListener/UserSubscriber.php
+++ b/src/EventListener/UserSubscriber.php
@@ -109,7 +109,11 @@ class UserSubscriber implements EventSubscriberInterface
$attributes = $this->ldap->listAttributesUser();
$ldapentrys = $this->ldap->search($filter, $attributes, $this->ldap->getParameter('baseuser'));
if (empty($ldapentrys)) {
- $this->ldap->addUser($this->entity);
+ if ($this->entity->isIsactive()) {
+ $this->ldap->addUser($this->entity);
+ }
+ } elseif (!$this->entity->isIsactive()) {
+ $this->nine2ldapremove();
} elseif ($this->ldap->ismodifyUser($this->entity, $ldapentrys[0])) {
$this->ldap->modifyUser($this->entity, $ldapentrys[0]['cn']);
}
diff --git a/src/Form/GroupType.php b/src/Form/GroupType.php
index ecead96..3107bb9 100644
--- a/src/Form/GroupType.php
+++ b/src/Form/GroupType.php
@@ -41,7 +41,7 @@ class GroupType extends AbstractType
'remote_route' => 'app_'.$options['access'].'_user_selectlist',
'class' => 'App\Entity\User',
'primary_key' => 'id',
- 'text_property' => 'username',
+ 'text_property' => 'fullname',
'minimum_input_length' => 2,
'page_limit' => 10,
'allow_clear' => true,
diff --git a/src/Form/Niveau01Type.php b/src/Form/Niveau01Type.php
index fff6a71..4a1ba25 100644
--- a/src/Form/Niveau01Type.php
+++ b/src/Form/Niveau01Type.php
@@ -4,6 +4,7 @@ namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
+use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
@@ -27,6 +28,35 @@ class Niveau01Type extends AbstractType
]
);
+ $builder->add('code',
+ TextType::class, [
+ 'label' => 'Code',
+ 'required' => false,
+ ]
+ );
+
+ $builder->add('email',
+ EmailType::class, [
+ 'label' => 'Mail',
+ 'required' => false,
+ ]
+ );
+
+ $builder->add('postaladress',
+ TextareaType::class, [
+ 'label' => 'Adresse',
+ 'required' => false,
+ 'attr' => ['style' => 'height:90px'],
+ ]
+ );
+
+ $builder->add('telephonenumber',
+ TextType::class, [
+ 'label' => 'Téléphone',
+ 'required' => false,
+ ]
+ );
+
// Si masteridentity = LDAP alors on demande le filtre des utilisateurs qui appartiennent à ce groupe
if ('LDAP' == $options['appMasteridentity'] || 'LDAP2NINE' == $options['appSynchro']) {
$builder->add('fgassocldap',
diff --git a/src/Form/Niveau02Type.php b/src/Form/Niveau02Type.php
index 548cf58..23c2db3 100644
--- a/src/Form/Niveau02Type.php
+++ b/src/Form/Niveau02Type.php
@@ -6,7 +6,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr\Join;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
+use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -54,6 +56,35 @@ class Niveau02Type extends AbstractType
'label' => 'Label',
]
);
+
+ $builder->add('code',
+ TextType::class, [
+ 'label' => 'Code',
+ 'required' => false,
+ ]
+ );
+
+ $builder->add('email',
+ EmailType::class, [
+ 'label' => 'Mail',
+ 'required' => false,
+ ]
+ );
+
+ $builder->add('postaladress',
+ TextareaType::class, [
+ 'label' => 'Adresse',
+ 'required' => false,
+ 'attr' => ['style' => 'height:90px'],
+ ]
+ );
+
+ $builder->add('telephonenumber',
+ TextType::class, [
+ 'label' => 'Téléphone',
+ 'required' => false,
+ ]
+ );
}
public function configureOptions(OptionsResolver $resolver)
diff --git a/src/Form/Niveau03Type.php b/src/Form/Niveau03Type.php
index 0b3d2f0..a7e2cd4 100644
--- a/src/Form/Niveau03Type.php
+++ b/src/Form/Niveau03Type.php
@@ -6,7 +6,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr\Join;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
+use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -76,6 +78,35 @@ class Niveau03Type extends AbstractType
'label' => 'Label',
]
);
+
+ $builder->add('code',
+ TextType::class, [
+ 'label' => 'Code',
+ 'required' => false,
+ ]
+ );
+
+ $builder->add('email',
+ EmailType::class, [
+ 'label' => 'Mail',
+ 'required' => false,
+ ]
+ );
+
+ $builder->add('postaladress',
+ TextareaType::class, [
+ 'label' => 'Adresse',
+ 'required' => false,
+ 'attr' => ['style' => 'height:90px'],
+ ]
+ );
+
+ $builder->add('telephonenumber',
+ TextType::class, [
+ 'label' => 'Téléphone',
+ 'required' => false,
+ ]
+ );
}
public function configureOptions(OptionsResolver $resolver)
diff --git a/src/Form/Niveau04Type.php b/src/Form/Niveau04Type.php
index 970b27f..9efc3bb 100644
--- a/src/Form/Niveau04Type.php
+++ b/src/Form/Niveau04Type.php
@@ -6,7 +6,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr\Join;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
+use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
+use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -97,6 +99,35 @@ class Niveau04Type extends AbstractType
'label' => 'Label',
]
);
+
+ $builder->add('code',
+ TextType::class, [
+ 'label' => 'Code',
+ 'required' => false,
+ ]
+ );
+
+ $builder->add('email',
+ EmailType::class, [
+ 'label' => 'Mail',
+ 'required' => false,
+ ]
+ );
+
+ $builder->add('postaladress',
+ TextareaType::class, [
+ 'label' => 'Adresse',
+ 'required' => false,
+ 'attr' => ['style' => 'height:90px'],
+ ]
+ );
+
+ $builder->add('telephonenumber',
+ TextType::class, [
+ 'label' => 'Téléphone',
+ 'required' => false,
+ ]
+ );
}
public function configureOptions(OptionsResolver $resolver)
diff --git a/src/Form/UserType.php b/src/Form/UserType.php
index 2a79290..1975f43 100644
--- a/src/Form/UserType.php
+++ b/src/Form/UserType.php
@@ -39,6 +39,16 @@ class UserType extends AbstractType
]
);
+ if ('all' != $options['access']) {
+ $choices = ['oui' => '1', 'non' => '0'];
+ $builder->add('isactive',
+ ChoiceType::class, [
+ 'label' => 'Actif',
+ 'choices' => $choices,
+ ]
+ );
+ }
+
if ('SQL' == $options['appMasteridentity'] || 'submit' == $options['mode']) {
$builder->add('password',
RepeatedType::class, [
diff --git a/src/Repository/UserRepository.php b/src/Repository/UserRepository.php
index a035825..03f7c85 100644
--- a/src/Repository/UserRepository.php
+++ b/src/Repository/UserRepository.php
@@ -30,4 +30,17 @@ class UserRepository extends ServiceEntityRepository
$this->getEntityManager()->flush();
}
}
+
+ public function getPreference(User $entity, $key, $default)
+ {
+ $preference = $entity->getPreference();
+ dump($preference);
+ if (is_array($preference)) {
+ if (array_key_exists($key, $preference)) {
+ return $preference[$key][0];
+ }
+ }
+
+ return $default;
+ }
}
diff --git a/src/Service/LdapService.php b/src/Service/LdapService.php
index f39be35..ba182a8 100644
--- a/src/Service/LdapService.php
+++ b/src/Service/LdapService.php
@@ -431,6 +431,10 @@ class LdapService
$connection = $this->connect();
$result = null;
+ if (!$user->isIsactive()) {
+ $todel = true;
+ }
+
// NIVEAU01
// On recherche le Niveau01 actuellement asscocié à l'utilisateur
$criteria = '(&(cn=*)(memberUid='.$user->getUsername().'))';
@@ -765,7 +769,9 @@ class LdapService
$attrs['memberuid'] = [];
foreach ($niveau01->getUsers() as $user) {
- array_push($attrs['memberuid'], $user->getUsername());
+ if ($user->isIsactive()) {
+ array_push($attrs['memberuid'], $user->getUsername());
+ }
}
sort($attrs['memberuid']);
@@ -893,7 +899,9 @@ class LdapService
$attrs['memberuid'] = [];
foreach ($niveau02->getUsers() as $user) {
- array_push($attrs['memberuid'], $user->getUsername());
+ if ($user->isIsactive()) {
+ array_push($attrs['memberuid'], $user->getUsername());
+ }
}
sort($attrs['memberuid']);
@@ -1021,7 +1029,9 @@ class LdapService
$attrs['memberuid'] = [];
foreach ($niveau03->getUsers() as $user) {
- array_push($attrs['memberuid'], $user->getUsername());
+ if ($user->isIsactive()) {
+ array_push($attrs['memberuid'], $user->getUsername());
+ }
}
sort($attrs['memberuid']);
@@ -1149,7 +1159,9 @@ class LdapService
$attrs['memberuid'] = [];
foreach ($niveau04->getUsers() as $user) {
- array_push($attrs['memberuid'], $user->getUsername());
+ if ($user->isIsactive()) {
+ array_push($attrs['memberuid'], $user->getUsername());
+ }
}
sort($attrs['memberuid']);
@@ -1277,7 +1289,9 @@ class LdapService
$attrs['memberuid'] = [];
foreach ($group->getUsers() as $usergroup) {
- array_push($attrs['memberuid'], $usergroup->getUser()->getUsername());
+ if ($usergroup->getUser()->isIsactive()) {
+ array_push($attrs['memberuid'], $usergroup->getUser()->getUsername());
+ }
}
sort($attrs['memberuid']);
@@ -1306,11 +1320,13 @@ class LdapService
$result = $this->search($criteria, ['memberuid'], $subbranch);
if (!$this->in_array_r($usergroup->getUser()->getUsername(), $result[0])) {
- $dn = $this->getGroupDN($usergroup->getGroup()->getLabel());
- $entry['memberuid'] = $usergroup->getUser()->getUsername();
- $result = ldap_mod_add($connection, $dn, $entry);
- if (!$result) {
- $this->ldapError();
+ if ($usergroup->getUser()->isIsactive()) {
+ $dn = $this->getGroupDN($usergroup->getGroup()->getLabel());
+ $entry['memberuid'] = $usergroup->getUser()->getUsername();
+ $result = ldap_mod_add($connection, $dn, $entry);
+ if (!$result) {
+ $this->ldapError();
+ }
}
}
diff --git a/src/Service/UserChecker.php b/src/Service/UserChecker.php
index 8013999..f5128dd 100644
--- a/src/Service/UserChecker.php
+++ b/src/Service/UserChecker.php
@@ -17,7 +17,7 @@ class UserChecker implements UserCheckerInterface
}
if (!$user->isIsactive()) {
- throw new CustomUserMessageAccountStatusException('Your user account no longer exists.');
+ throw new CustomUserMessageAccountStatusException('Votre compte a été désactivé');
}
}
@@ -31,4 +31,4 @@ class UserChecker implements UserCheckerInterface
throw new AccountExpiredException('...');
}
}
-}
\ No newline at end of file
+}
diff --git a/templates/Audit/render.html.twig b/templates/Audit/render.html.twig
index 777aa47..56882cf 100644
--- a/templates/Audit/render.html.twig
+++ b/templates/Audit/render.html.twig
@@ -49,7 +49,7 @@
{% if app.user %}
$.ajax({
method: "POST",
- url: "{{ path('app_user_preference') }}",
+ url: "{{ path('app_all_preference') }}",
data: {
id:0,
key:'fgaudit',
diff --git a/templates/Config/edit.html.twig b/templates/Config/edit.html.twig
index 2f5b7fc..2d0f09b 100755
--- a/templates/Config/edit.html.twig
+++ b/templates/Config/edit.html.twig
@@ -66,7 +66,7 @@
{% elseif config.type=="header" %}
{% endif %}
{{ form_row(form.help) }}
diff --git a/templates/Crop/crop01.html.twig b/templates/Crop/crop01.html.twig
index 10e282c..e8a11cd 100644
--- a/templates/Crop/crop01.html.twig
+++ b/templates/Crop/crop01.html.twig
@@ -26,7 +26,7 @@
window.parent.$(".modal-title").html("ETAPE 1 - Téléchargez votre image");
function dropzonesuccess( file, response ) {
- $(location).attr('href',"{{ path('app_user_crop02', {"type": type, "reportinput": reportinput }) }}?file="+response["file"]);
+ $(location).attr('href',"{{ path('app_all_crop02', {"type": type, "reportinput": reportinput }) }}?file="+response["file"]);
}
function closeModal() {
diff --git a/templates/Group/list.html.twig b/templates/Group/list.html.twig
index 6f4ead3..d25e4d4 100644
--- a/templates/Group/list.html.twig
+++ b/templates/Group/list.html.twig
@@ -6,7 +6,7 @@
{%if access=="admin" %}
Ajouter
- {%elseif access=="user" and app.session.get("submitgroup") %}
+ {%elseif access=="all" and app.session.get("submitgroup") %}
Ajouter
{% endif %}
diff --git a/templates/Niveau01/edit.html.twig b/templates/Niveau01/edit.html.twig
index 29fdf13..97cced0 100755
--- a/templates/Niveau01/edit.html.twig
+++ b/templates/Niveau01/edit.html.twig
@@ -45,6 +45,11 @@
Caractères interdits = caractères spéciaux sauf ' @ . - _
+ {{ form_row(form.code) }}
+ {{ form_row(form.email) }}
+ {{ form_row(form.telephonenumber) }}
+ {{ form_row(form.postaladress) }}
+
{% if form.ldapfilter is defined %}
{{ form_row(form.fgassocldap) }}
diff --git a/templates/Niveau02/edit.html.twig b/templates/Niveau02/edit.html.twig
index 3b66b80..2adc819 100755
--- a/templates/Niveau02/edit.html.twig
+++ b/templates/Niveau02/edit.html.twig
@@ -47,6 +47,12 @@
Caractères interdits = caractères spéciaux sauf ' @ . - _
+
+ {{ form_row(form.code) }}
+ {{ form_row(form.email) }}
+ {{ form_row(form.telephonenumber) }}
+ {{ form_row(form.postaladress) }}
+
{% if form.ldapfilter is defined %}
{{ form_row(form.ldapfilter) }}
{% endif %}
diff --git a/templates/Niveau03/edit.html.twig b/templates/Niveau03/edit.html.twig
index 32923b8..dbca0f5 100755
--- a/templates/Niveau03/edit.html.twig
+++ b/templates/Niveau03/edit.html.twig
@@ -48,6 +48,11 @@
Caractères interdits = caractères spéciaux sauf ' @ . - _
+ {{ form_row(form.code) }}
+ {{ form_row(form.email) }}
+ {{ form_row(form.telephonenumber) }}
+ {{ form_row(form.postaladress) }}
+
{% if form.ldapfilter is defined %}
{{ form_row(form.ldapfilter) }}
{% endif %}
diff --git a/templates/Niveau04/edit.html.twig b/templates/Niveau04/edit.html.twig
index 842bd06..f3fcaad 100755
--- a/templates/Niveau04/edit.html.twig
+++ b/templates/Niveau04/edit.html.twig
@@ -49,6 +49,11 @@
Caractères interdits = caractères spéciaux sauf ' @ . - _
+ {{ form_row(form.code) }}
+ {{ form_row(form.email) }}
+ {{ form_row(form.telephonenumber) }}
+ {{ form_row(form.postaladress) }}
+
{% if form.ldapfilter is defined %}
{{ form_row(form.ldapfilter) }}
{% endif %}
diff --git a/templates/User/edit.html.twig b/templates/User/edit.html.twig
index fded132..1cbdee0 100755
--- a/templates/User/edit.html.twig
+++ b/templates/User/edit.html.twig
@@ -67,7 +67,12 @@
{% endif %}
{{ form_widget(form.avatar) }}
- Modifier
+ Modifier
+
+ {% if form.isactive is defined %}
+
{{ form_row(form.isactive) }}
+ {% endif %}
+
diff --git a/templates/User/list.html.twig b/templates/User/list.html.twig
index e71bfca..bd1e525 100644
--- a/templates/User/list.html.twig
+++ b/templates/User/list.html.twig
@@ -1,7 +1,7 @@
{% extends 'base.html.twig' %}
{% block body %}
- {% if access=="admin" or access=="modo" %}
+ {% if access!="all" %}
{% if appMasteridentity=="SQL" or not appSynchroPurgeUser %}
Ajouter
@@ -9,9 +9,17 @@
{% endif %}
{% if auditUse and (access=="admin" or access=="audit") %}
- Audit
+ Audit
{% endif %}
+
+ {% if access!="all" %}
+
+
+
+
+ {%endif%}
+
@@ -99,7 +99,7 @@