fix(activeuser): user isactive & adress niveau & route all
Cadoles/nineskeletor/pipeline/head This commit is unstable Details
Cadoles/nineskeletor/pipeline/pr-master This commit is unstable Details

This commit is contained in:
Arnaud Fornerot 2022-10-02 14:50:48 +02:00
parent 2cad98ca86
commit 84230eb347
35 changed files with 749 additions and 214 deletions

4
.env
View File

@ -27,6 +27,8 @@ APP_MODEREGISTRATION= # null | BYADMIN | BYUSER
APP_ADMINS='["admin"]' APP_ADMINS='["admin"]'
# Structure Organisationnelle # 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_NIVEAU01LABEL="Niveau 01"
APP_NIVEAU01LABELS="Niveaux 01" APP_NIVEAU01LABELS="Niveaux 01"
@ -45,8 +47,6 @@ APP_NIVEAU04LABEL="Niveau 04"
APP_NIVEAU04LABELS="Niveaux 04" APP_NIVEAU04LABELS="Niveaux 04"
APP_NIVEAU04MANDATORY='[""]' 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_GROUPUSE=1
APP_GROUPSUBMITER='["ALL"]' APP_GROUPSUBMITER='["ALL"]'

View File

@ -33,8 +33,11 @@ security:
target: app_home target: app_home
access_control: access_control:
- { path: ^/user, roles: [ROLE_ADMIN, ROLE_MODO, ROLE_ANIM, ROLE_USER] } - { path: ^/all, roles: [ROLE_ADMIN, ROLE_MODO, ROLE_MASTER, ROLE_MANAGER, ROLE_USER] }
- { path: ^/modo, roles: [ROLE_ADMIN, ROLE_MODO] } - { 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] } - { path: ^/admin, roles: [ROLE_ADMIN] }
when@test: when@test:

View File

@ -6,23 +6,34 @@ app_home:
app_user_home: app_user_home:
path: /user path: /user
controller: App\Controller\HomeController::homeuser controller: App\Controller\HomeController::homeuser
defaults: { access: admin } defaults: { access: user }
app_admin_home: app_manager_home:
path: /admin path: /manager
controller: App\Controller\HomeController::homeadmin controller: App\Controller\HomeController::homemanager
defaults: { access: admin } defaults: { access: manager }
app_master_home:
path: /master
controller: App\Controller\HomeController::homemaster
defaults: { access: master }
app_modo_home: app_modo_home:
path: /modo path: /modo
controller: App\Controller\HomeController::homemodo controller: App\Controller\HomeController::homemodo
defaults: { access: modo } defaults: { access: modo }
app_admin_home:
path: /admin
controller: App\Controller\HomeController::homeadmin
defaults: { access: admin }
oneup_uploader: oneup_uploader:
resource: . resource: .
type: uploader type: uploader
#== Security ==================================================================================================== #== Security ====================================================================================================
#-- Access public
app_login: app_login:
path: /login path: /login
controller: App\Controller\SecurityController::login controller: App\Controller\SecurityController::login
@ -39,28 +50,21 @@ app_logout:
path: /logout path: /logout
controller: App\Controller\SecurityController::logout controller: App\Controller\SecurityController::logout
app_redirect:
path: /user/redirect/{route}/{id}
controller: App\Controller\SecurityController::redirecturl
defaults: { access: user }
app_noperm: app_noperm:
path: /noperm path: /noperm
controller: App\Controller\SecurityController::noperm controller: App\Controller\SecurityController::noperm
#== Websocket==================================================================================================== #== Websocket====================================================================================================
#-- Access user #-- Access all
app_publish_sample: app_publish_sample:
path: /user/publish/sample/{id} path: /all/publish/sample/{id}
controller: App\Controller\PublishController::sample controller: App\Controller\PublishController::sample
defaults: { access: user } defaults: { access: all }
app_publish: app_publish:
path: /user/publish/{channel}/{id} path: /all/publish/{channel}/{id}
controller: App\Controller\PublishController::publish controller: App\Controller\PublishController::publish
defaults: { access: user } defaults: { access: all }
#== Config ====================================================================================================== #== Config ======================================================================================================
#-- Access admin #-- Access admin
@ -95,7 +99,6 @@ app_admin_config_logo:
defaults: { access: admin } defaults: { access: admin }
#== Theme ======================================================================================================= #== Theme =======================================================================================================
#-- Access admin #-- Access admin
app_admin_theme: app_admin_theme:
path: /admin/theme path: /admin/theme
@ -108,7 +111,7 @@ app_admin_theme_select:
defaults: { name: "", access: admin } defaults: { name: "", access: admin }
#== API ========================================================================================================= #== API =========================================================================================================
#-- Access visiteur #-- Access public
app_rest: app_rest:
path: /docrest path: /docrest
controller: App\Controller\HomeController::docrest controller: App\Controller\HomeController::docrest
@ -146,44 +149,16 @@ app_admin_log_get:
defaults: { access: admin } defaults: { access: admin }
#== Crop ======================================================================================================== #== Crop ========================================================================================================
#-- Access user #-- Access all
app_user_crop01: app_all_crop01:
path: /user/crop01/{type}/{reportinput} path: /all/crop01/{type}/{reportinput}
controller: App\Controller\CropController::crop01 controller: App\Controller\CropController::crop01
app_user_crop02: app_all_crop02:
path: /user/crop02/{type}/{reportinput} path: /all/crop02/{type}/{reportinput}
controller: App\Controller\CropController::crop02 controller: App\Controller\CropController::crop02
#== Minio ======================================================================================================= #== 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 #-- Access public
app_minio_logo: app_minio_logo:
path: /minio/logo path: /minio/logo
@ -198,7 +173,7 @@ app_minio_document:
controller: App\Controller\MinioController::document controller: App\Controller\MinioController::document
#== Hydra ======================================================================================================= #== Hydra =======================================================================================================
#-- Access public
app_hydra_loginsql: app_hydra_loginsql:
path: /hydra/loginsql path: /hydra/loginsql
controller: App\Controller\HydraController::loginsql controller: App\Controller\HydraController::loginsql
@ -220,13 +195,13 @@ app_hydra_consent:
controller: App\Controller\HydraController::consent controller: App\Controller\HydraController::consent
#== Ckeditor ==================================================================================================== #== Ckeditor ====================================================================================================
#-- Access all
app_ckeditor_upload: app_ckeditor_upload:
path: /user/upload path: /all/upload
controller: App\Controller\MinioController::ckupload controller: App\Controller\MinioController::ckupload
defaults: { access: user } defaults: { access: all }
#== Audit ======================================================================================================= #== Audit =======================================================================================================
#--Access admin #--Access admin
app_admin_audit_renderid: app_admin_audit_renderid:
path: /admin/audit/{entityname}/{entityid} path: /admin/audit/{entityname}/{entityid}
@ -324,8 +299,7 @@ app_modo_niveau02_delete:
controller: App\Controller\Niveau02Controller::delete controller: App\Controller\Niveau02Controller::delete
defaults: { access: modo } defaults: { access: modo }
#-- Access public
#-- Access visiteur
app_niveau02_selectlist: app_niveau02_selectlist:
path: /niveau02/selectlist path: /niveau02/selectlist
controller: App\Controller\Niveau02Controller::selectlist controller: App\Controller\Niveau02Controller::selectlist
@ -383,8 +357,7 @@ app_modo_niveau03_delete:
controller: App\Controller\Niveau03Controller::delete controller: App\Controller\Niveau03Controller::delete
defaults: { access: modo } defaults: { access: modo }
#-- Access public
#-- Access visiteur
app_niveau03_selectlist: app_niveau03_selectlist:
path: /niveau03/selectlist path: /niveau03/selectlist
controller: App\Controller\Niveau03Controller::selectlist controller: App\Controller\Niveau03Controller::selectlist
@ -442,7 +415,7 @@ app_modo_niveau04_delete:
controller: App\Controller\Niveau04Controller::delete controller: App\Controller\Niveau04Controller::delete
defaults: { access: modo } defaults: { access: modo }
#-- Access visiteur #-- Access public
app_niveau04_selectlist: app_niveau04_selectlist:
path: /niveau04/selectlist path: /niveau04/selectlist
controller: App\Controller\Niveau04Controller::selectlist controller: App\Controller\Niveau04Controller::selectlist
@ -545,67 +518,66 @@ app_modo_group_usergroup_changerole:
controller: App\Controller\GroupController::userchangerole controller: App\Controller\GroupController::userchangerole
defaults: { access: modo } defaults: { access: modo }
#-- Access all
#-- Access user app_all_group:
app_user_group: path: /all/group
path: /user/group
controller: App\Controller\GroupController::list controller: App\Controller\GroupController::list
defaults: { access: user } defaults: { access: all }
app_user_group_tablelist: app_all_group_tablelist:
path: /user/group/tablelist path: /all/group/tablelist
controller: App\Controller\GroupController::tablelist controller: App\Controller\GroupController::tablelist
defaults: { access: user } defaults: { access: all }
app_user_group_submit: app_all_group_submit:
path: /user/group/submit path: /all/group/submit
controller: App\Controller\GroupController::submit controller: App\Controller\GroupController::submit
defaults: { access: user } defaults: { access: all }
app_user_group_update: app_all_group_update:
path: /user/group/update/{id} path: /all/group/update/{id}
controller: App\Controller\GroupController::update controller: App\Controller\GroupController::update
defaults: { access: user } defaults: { access: all }
app_user_group_delete: app_all_group_delete:
path: /user/group/delete/{id} path: /all/group/delete/{id}
controller: App\Controller\GroupController::delete controller: App\Controller\GroupController::delete
defaults: { access: user } defaults: { access: all }
app_user_group_users: app_all_group_users:
path: /user/group/users/{id} path: /all/group/users/{id}
controller: App\Controller\GroupController::users controller: App\Controller\GroupController::users
defaults: { access: user } defaults: { access: all }
app_user_group_usersnotin: app_all_group_usersnotin:
path: /user/group/usersnotin/{id} path: /all/group/usersnotin/{id}
controller: App\Controller\GroupController::usersnotin controller: App\Controller\GroupController::usersnotin
defaults: { access: user } defaults: { access: all }
app_user_group_usersin: app_all_group_usersin:
path: /user/group/usersin/{id} path: /all/group/usersin/{id}
controller: App\Controller\GroupController::usersin controller: App\Controller\GroupController::usersin
defaults: { access: user } defaults: { access: all }
app_user_group_usergroup_add: app_all_group_usergroup_add:
path: /user/group/usergroup/add/{groupid}/{userid} path: /all/group/usergroup/add/{groupid}/{userid}
controller: App\Controller\GroupController::useradd controller: App\Controller\GroupController::useradd
defaults: { access: user } defaults: { access: all }
app_user_group_usergroup_del: app_all_group_usergroup_del:
path: /user/group/usergroup/del/{groupid}/{userid} path: /all/group/usergroup/del/{groupid}/{userid}
controller: App\Controller\GroupController::userdel controller: App\Controller\GroupController::userdel
defaults: { access: user } defaults: { access: all }
app_user_group_usergroup_changerole: app_all_group_usergroup_changerole:
path: /user/group/usergroup/changerole/{groupid}/{userid}/{roleid} path: /all/group/usergroup/changerole/{groupid}/{userid}/{roleid}
controller: App\Controller\GroupController::userchangerole controller: App\Controller\GroupController::userchangerole
defaults: { access: user } defaults: { access: all }
app_user_group_userout: app_all_group_userout:
path: /user/group/userout/{id} path: /all/group/userout/{id}
controller: App\Controller\GroupController::userout controller: App\Controller\GroupController::userout
defaults: { access: user } defaults: { access: all }
#== Whitelist =================================================================================================== #== Whitelist ===================================================================================================
#-- Access admin #-- Access admin
@ -634,7 +606,7 @@ app_admin_whitelist_delete:
controller: App\Controller\WhitelistController::delete controller: App\Controller\WhitelistController::delete
defaults: { access: admin } defaults: { access: admin }
#-- Acces visiteur #-- Access public
app_whitelist_is: app_whitelist_is:
path: /whitelist/is path: /whitelist/is
controller: App\Controller\WhitelistController::is controller: App\Controller\WhitelistController::is
@ -682,7 +654,7 @@ app_modo_registration_delete:
controller: App\Controller\RegistrationController::delete controller: App\Controller\RegistrationController::delete
defaults: { access: modo } defaults: { access: modo }
#-- Access visiteur #-- Access public
app_registration: app_registration:
path: /registration path: /registration
controller: App\Controller\RegistrationController::submit controller: App\Controller\RegistrationController::submit
@ -766,33 +738,34 @@ app_modo_user_delete:
controller: App\Controller\UserController::delete controller: App\Controller\UserController::delete
defaults: { access: modo } defaults: { access: modo }
#-- Access user #-- Access all
app_user_user: app_all_user:
path: /user/update path: /all/update
controller: App\Controller\UserController::profil controller: App\Controller\UserController::profil
defaults: { access: user } defaults: { access: all }
app_user_users: app_all_users:
path: /user/users path: /all/users
controller: App\Controller\UserController::list controller: App\Controller\UserController::list
defaults: { access: user } defaults: { access: all }
app_user_user_tablelist: app_all_user_tablelist:
path: /user/user/tablelist path: /all/user/tablelist
controller: App\Controller\UserController::tablelist controller: App\Controller\UserController::tablelist
defaults: { access: user } defaults: { access: all }
app_user_user_selectlist: app_all_user_selectlist:
path: /user/user/selectlist path: /all/user/selectlist
controller: App\Controller\UserController::selectlist controller: App\Controller\UserController::selectlist
defaults: { access: user } defaults: { access: all }
app_user_view: app_all_view:
path: /user/view/{id} path: /all/view/{id}
controller: App\Controller\UserController::view controller: App\Controller\UserController::view
defaults: { access: user } defaults: { access: all }
app_user_preference: app_all_preference:
path: /user/preference path: /all/preference
controller: App\Controller\UserController::preference controller: App\Controller\UserController::preference
defaults: { access: user } defaults: { access: all }

View File

@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration;
/** /**
* Auto-generated Migration: Please modify to your needs! * Auto-generated Migration: Please modify to your needs!
*/ */
final class Version20220929145036 extends AbstractMigration final class Version20221002124137 extends AbstractMigration
{ {
public function getDescription(): string 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 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 UNIQUE INDEX UNIQ_4B98C21EA750E8 ON groupe (label)');
$this->addSql('CREATE INDEX IDX_4B98C217E3C61F9 ON groupe (owner_id)'); $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 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 UNIQUE INDEX UNIQ_F4F52F99EA750E8 ON niveau02 (label)');
$this->addSql('CREATE INDEX IDX_F4F52F9959FDD7AB ON niveau02 (niveau01_id)'); $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 UNIQUE INDEX UNIQ_83F21F0FEA750E8 ON niveau03 (label)');
$this->addSql('CREATE INDEX IDX_83F21F0F4B487845 ON niveau03 (niveau02_id)'); $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 UNIQUE INDEX UNIQ_1D968AACEA750E8 ON niveau04 (label)');
$this->addSql('CREATE INDEX IDX_1D968AACF3F41F20 ON niveau04 (niveau03_id)'); $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))'); $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))');

View File

@ -424,8 +424,13 @@ class SynchroCommand extends Command
if (!in_array($user->getUsername(), $tbusers)) { if (!in_array($user->getUsername(), $tbusers)) {
if ($user->getId() > 0) { if ($user->getId() > 0) {
$this->writeln(' > '.$user->getUSername()); $this->writeln(' > '.$user->getUSername());
$this->em->remove($user); try {
$this->em->flush(); $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('');
$this->writeln('== USER ============================================='); $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(); $attributes = $this->ldap->listAttributesUser();
foreach ($users as $user) { foreach ($users as $user) {
$filter = str_replace('*', $user->getUsername(), $this->filteruser); $filter = str_replace('*', $user->getUsername(), $this->filteruser);
@ -534,7 +539,7 @@ class SynchroCommand extends Command
$ldapentrys = $this->ldap->search($this->filteruser, $attributes, $this->baseuser); $ldapentrys = $this->ldap->search($this->filteruser, $attributes, $this->baseuser);
foreach ($ldapentrys as $ldapentry) { 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) { if (!$user) {
$this->writeln($ldapentry['uid'].' = DELETE'); $this->writeln($ldapentry['uid'].' = DELETE');
$dn = $this->ldap->getUserDN($ldapentry['uid']); $dn = $this->ldap->getUserDN($ldapentry['uid']);
@ -959,8 +964,13 @@ class SynchroCommand extends Command
if (!in_array($user->getUsername(), $tbusers)) { if (!in_array($user->getUsername(), $tbusers)) {
if ($user->getId() > 0) { if ($user->getId() > 0) {
$this->writeln(' > '.$user->getUsername()); $this->writeln(' > '.$user->getUsername());
$this->em->remove($user); try {
$this->em->flush(); $this->em->remove($user);
$this->em->flush();
} catch (\Exception $e) {
$user->setIsactive(false);
$this->em->flush();
}
} }
} }
} }

View File

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

View File

@ -194,11 +194,11 @@ class RegistrationController extends AbstractController
$data = new Registration(); $data = new Registration();
$data->setIsvisible(true); $data->setIsvisible(true);
// Création du formulaire // Création du formulaire
$form = $this->createForm(Form::class, $data, [ $form = $this->createForm(Form::class, $data, [
'mode' => 'submit', 'mode' => 'submit',
'access' => 'user', 'access' => 'all',
'userid' => null, 'userid' => null,
'appMasteridentity' => $this->GetParameter('appMasteridentity'), 'appMasteridentity' => $this->GetParameter('appMasteridentity'),
'appNiveau01label' => $this->GetParameter('appNiveau01label'), 'appNiveau01label' => $this->GetParameter('appNiveau01label'),

View File

@ -135,7 +135,9 @@ class SecurityController extends AbstractController
$user = $this->submituser($username, $firstname, $lastname, $email, $avatar, $niveau01, $em); $user = $this->submituser($username, $firstname, $lastname, $email, $avatar, $niveau01, $em);
$user = $em->getRepository('App\Entity\Group')->calculateSSOGroup($user, $attributes); $user = $em->getRepository('App\Entity\Group')->calculateSSOGroup($user, $attributes);
} elseif ($this->getParameter('casAutoupdate')) { } 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->submitSSONiveau01($attributes, $em);
$this->submitSSOGroup($attributes, $em); $this->submitSSOGroup($attributes, $em);
$this->updateuser($user, $firstname, $lastname, $email, $avatar, $em); $this->updateuser($user, $firstname, $lastname, $email, $avatar, $em);
@ -556,7 +558,9 @@ class SecurityController extends AbstractController
private function autoconnexion($user, $redirect, Request $request) 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 // Récupérer le token de l'utilisateur
$token = new UsernamePasswordToken($user, 'main', $user->getRoles()); $token = new UsernamePasswordToken($user, 'main', $user->getRoles());

View File

@ -20,17 +20,20 @@ class UserController extends AbstractController
private $twig = 'User/'; private $twig = 'User/';
private $route = 'app_admin_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'); throw $this->createAccessDeniedException('Permission denied');
} }
dump($em->getRepository($this->entity)->getPreference($this->getUser(), 'userisactive', true));
return $this->render($this->twig.'list.html.twig', [ return $this->render($this->twig.'list.html.twig', [
'useheader' => true, 'useheader' => true,
'usemenu' => false, 'usemenu' => false,
'usesidebar' => ('user' != $access), 'usesidebar' => ('all' != $access),
'access' => $access, 'access' => $access,
'isactive' => ('true' == $em->getRepository($this->entity)->getPreference($this->getUser(), 'userisactive', true)),
]); ]);
} }
@ -47,31 +50,48 @@ class UserController extends AbstractController
$niveau02 = null; $niveau02 = null;
$niveau03 = null; $niveau03 = null;
$niveau04 = null; $niveau04 = null;
$isactive = true;
// Nombre total d'enregistrement // Nombre total d'enregistrement
switch ($access) { switch ($access) {
case 'admin': 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; break;
case 'modo': case 'modo':
$isactive = $em->getRepository($this->entity)->getPreference($this->getUser(), 'userisactive', true);
$total = $em->getManager()->createQueryBuilder() $total = $em->getManager()->createQueryBuilder()
->select('COUNT(entity)') ->select('COUNT(entity)')
->from($this->entity, 'entity') ->from($this->entity, 'entity')
->from("App\Entity\UserModo", 'usermodo') ->from("App\Entity\UserModo", 'usermodo')
->where('usermodo.niveau01 = entity.niveau01') ->where('usermodo.niveau01 = entity.niveau01')
->andWhere('usermodo.user = :user') ->andWhere('usermodo.user = :user')
->where('entity.isactive = :isactive')
->setParameter('isactive', $isactive)
->setParameter('user', $this->getUser()) ->setParameter('user', $this->getUser())
->getQuery()->getSingleScalarResult(); ->getQuery()->getSingleScalarResult();
break; break;
default: default:
$isactive = true;
$niveau01 = $this->getUser()->getNiveau01(); $niveau01 = $this->getUser()->getNiveau01();
$niveau02 = $this->getUser()->getNiveau02(); $niveau02 = $this->getUser()->getNiveau02();
$niveau03 = $this->getUser()->getNiveau03(); $niveau03 = $this->getUser()->getNiveau03();
$niveau04 = $this->getUser()->getNiveau04(); $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')) { switch ($request->getSession()->get('scopeannu')) {
case 1: case 1:
$qb->andWhere('entity.niveau01 = :niveau01')->setParameter('niveau01', $niveau01); $qb->andWhere('entity.niveau01 = :niveau01')->setParameter('niveau01', $niveau01);
@ -105,7 +125,9 @@ class UserController extends AbstractController
->from($this->entity, 'entity') ->from($this->entity, 'entity')
->from('App:Niveau01', 'niveau01') ->from('App:Niveau01', 'niveau01')
->where('entity.niveau01=niveau01.id') ->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('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'].'%') ->setParameter('value', '%'.$search['value'].'%')
->getQuery() ->getQuery()
->getSingleScalarResult(); ->getSingleScalarResult();
@ -118,10 +140,12 @@ class UserController extends AbstractController
->from('App:Niveau01', 'niveau01') ->from('App:Niveau01', 'niveau01')
->from('App:UserModo', 'usermodo') ->from('App:UserModo', 'usermodo')
->where('entity.niveau01=niveau01.id') ->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('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.niveau01 = entity.niveau01')
->andWhere('usermodo.user = :userid') ->andWhere('usermodo.user = :userid')
->setParameter('value', '%'.$search['value'].'%') ->setParameter('value', '%'.$search['value'].'%')
->setParameter('isactive', $isactive)
->setParameter('userid', $this->getUser()->getId()) ->setParameter('userid', $this->getUser()->getId())
->getQuery() ->getQuery()
->getSingleScalarResult(); ->getSingleScalarResult();
@ -133,9 +157,11 @@ class UserController extends AbstractController
->from($this->entity, 'entity') ->from($this->entity, 'entity')
->from('App:Niveau01', 'niveau01') ->from('App:Niveau01', 'niveau01')
->where('entity.niveau01=niveau01.id') ->where('entity.niveau01=niveau01.id')
->andwhere('entity.isactive = :isactive')
->andWhere('entity.isvisible=true') ->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') ->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')) { switch ($request->getSession()->get('scopeannu')) {
case 1: case 1:
@ -174,6 +200,8 @@ class UserController extends AbstractController
case 'admin': case 'admin':
$qb->select('entity')->from($this->entity, 'entity')->from('App:Niveau01', 'niveau01'); $qb->select('entity')->from($this->entity, 'entity')->from('App:Niveau01', 'niveau01');
$qb->where('entity.niveau01=niveau01.id'); $qb->where('entity.niveau01=niveau01.id');
$qb->andwhere('entity.isactive = :isactive');
$qb->setParameter('isactive', $isactive);
break; break;
case 'modo': case 'modo':
@ -181,6 +209,8 @@ class UserController extends AbstractController
$qb->where('entity.niveau01=niveau01.id'); $qb->where('entity.niveau01=niveau01.id');
$qb->andWhere('usermodo.niveau01 = entity.niveau01'); $qb->andWhere('usermodo.niveau01 = entity.niveau01');
$qb->andWhere('usermodo.user = :userid'); $qb->andWhere('usermodo.user = :userid');
$qb->andwhere('entity.isactive = :isactive');
$qb->setParameter('isactive', $isactive);
$qb->setParameter('userid', $this->getUser()->getId()); $qb->setParameter('userid', $this->getUser()->getId());
break; break;
@ -188,6 +218,8 @@ class UserController extends AbstractController
$qb->select('entity')->from($this->entity, 'entity')->from('App:Niveau01', 'niveau01'); $qb->select('entity')->from($this->entity, 'entity')->from('App:Niveau01', 'niveau01');
$qb->where('entity.niveau01=niveau01.id'); $qb->where('entity.niveau01=niveau01.id');
$qb->andWhere('entity.isvisible=true'); $qb->andWhere('entity.isvisible=true');
$qb->andwhere('entity.isactive = :isactive');
$qb->setParameter('isactive', $isactive);
switch ($request->getSession()->get('scopeannu')) { switch ($request->getSession()->get('scopeannu')) {
case 1: case 1:
@ -316,12 +348,14 @@ class UserController extends AbstractController
$qb = $em->getManager()->createQueryBuilder(); $qb = $em->getManager()->createQueryBuilder();
$qb->select('entity')->from($this->entity, 'entity') $qb->select('entity')->from($this->entity, 'entity')
->where('entity.username LIKE :value') ->where('entity.username LIKE :value')
->orWhere('entity.lastname LIKE :value')
->orWhere('entity.firstname LIKE :value')
->setParameter('value', '%'.$q.'%') ->setParameter('value', '%'.$q.'%')
->orderBy('entity.username'); ->orderBy('entity.username');
$datas = $qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult(); $datas = $qb->setFirstResult(0)->setMaxResults($page_limit)->getQuery()->getResult();
foreach ($datas as $data) { 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; $ret_string['results'] = $output;
@ -344,6 +378,7 @@ class UserController extends AbstractController
$data = new Entity(); $data = new Entity();
$data->setAvatar('noavatar.png'); $data->setAvatar('noavatar.png');
$data->setIsvisible(true); $data->setIsvisible(true);
$data->setIsactive(true);
$data->setApikey(Uuid::uuid4()); $data->setApikey(Uuid::uuid4());
// Création du formulaire // Création du formulaire
@ -566,7 +601,7 @@ class UserController extends AbstractController
} }
// Retour à la liste // Retour à la liste
if ('user' == $access) { if ('all' == $access) {
return $this->redirectToRoute('app_home'); return $this->redirectToRoute('app_home');
} else { } else {
return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route)); return $this->redirectToRoute(str_replace('_admin_', '_'.$access.'_', $this->route));
@ -584,7 +619,7 @@ class UserController extends AbstractController
$this->data => $data, $this->data => $data,
'listgroups' => $this->getListGroups($access, $em), 'listgroups' => $this->getListGroups($access, $em),
'listmodos' => $this->getListModos($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; return true;
break; break;
case 'user': case 'all':
if ($this->getUser()->getId() != $entity->getId()) { if ($this->getUser()->getId() != $entity->getId()) {
throw $this->createAccessDeniedException('Permission denied'); throw $this->createAccessDeniedException('Permission denied');
} }
@ -688,7 +723,7 @@ class UserController extends AbstractController
return true; return true;
break; break;
case 'user': case 'all':
if ($this->getUser()->getId() != $entity->getId()) { if ($this->getUser()->getId() != $entity->getId()) {
throw $this->createAccessDeniedException('Permission denied'); throw $this->createAccessDeniedException('Permission denied');
} }

View File

@ -32,6 +32,26 @@ class Niveau01
*/ */
private $label; 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") * @ORM\Column(type="string")
*/ */
@ -285,4 +305,52 @@ class Niveau01
return $this; 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;
}
} }

View File

@ -32,6 +32,26 @@ class Niveau02
*/ */
private $label; 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") * @ORM\Column(type="string")
*/ */
@ -204,4 +224,52 @@ class Niveau02
return $this; 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;
}
} }

View File

@ -32,6 +32,26 @@ class Niveau03
*/ */
private $label; 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") * @ORM\Column(type="string")
*/ */
@ -220,4 +240,52 @@ class Niveau03
return $this; 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;
}
} }

View File

@ -32,6 +32,26 @@ class Niveau04
*/ */
private $label; 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") * @ORM\Column(type="string")
*/ */
@ -196,4 +216,52 @@ class Niveau04
return $this; 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;
}
} }

View File

@ -283,7 +283,12 @@ class User implements UserInterface, LegacyPasswordAuthenticatedUserInterface
public function getDisplayname() 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 // == FIN DU CODE A NE PAS REGENERER

View File

@ -109,7 +109,11 @@ class UserSubscriber implements EventSubscriberInterface
$attributes = $this->ldap->listAttributesUser(); $attributes = $this->ldap->listAttributesUser();
$ldapentrys = $this->ldap->search($filter, $attributes, $this->ldap->getParameter('baseuser')); $ldapentrys = $this->ldap->search($filter, $attributes, $this->ldap->getParameter('baseuser'));
if (empty($ldapentrys)) { 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])) { } elseif ($this->ldap->ismodifyUser($this->entity, $ldapentrys[0])) {
$this->ldap->modifyUser($this->entity, $ldapentrys[0]['cn']); $this->ldap->modifyUser($this->entity, $ldapentrys[0]['cn']);
} }

View File

@ -41,7 +41,7 @@ class GroupType extends AbstractType
'remote_route' => 'app_'.$options['access'].'_user_selectlist', 'remote_route' => 'app_'.$options['access'].'_user_selectlist',
'class' => 'App\Entity\User', 'class' => 'App\Entity\User',
'primary_key' => 'id', 'primary_key' => 'id',
'text_property' => 'username', 'text_property' => 'fullname',
'minimum_input_length' => 2, 'minimum_input_length' => 2,
'page_limit' => 10, 'page_limit' => 10,
'allow_clear' => true, 'allow_clear' => true,

View File

@ -4,6 +4,7 @@ namespace App\Form;
use Symfony\Component\Form\AbstractType; use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType; 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\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType; use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType; 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 // Si masteridentity = LDAP alors on demande le filtre des utilisateurs qui appartiennent à ce groupe
if ('LDAP' == $options['appMasteridentity'] || 'LDAP2NINE' == $options['appSynchro']) { if ('LDAP' == $options['appMasteridentity'] || 'LDAP2NINE' == $options['appSynchro']) {
$builder->add('fgassocldap', $builder->add('fgassocldap',

View File

@ -6,7 +6,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\Query\Expr\Join;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType; 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\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
@ -54,6 +56,35 @@ class Niveau02Type extends AbstractType
'label' => 'Label', '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) public function configureOptions(OptionsResolver $resolver)

View File

@ -6,7 +6,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\Query\Expr\Join;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType; 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\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
@ -76,6 +78,35 @@ class Niveau03Type extends AbstractType
'label' => 'Label', '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) public function configureOptions(OptionsResolver $resolver)

View File

@ -6,7 +6,9 @@ use Doctrine\ORM\EntityRepository;
use Doctrine\ORM\Query\Expr\Join; use Doctrine\ORM\Query\Expr\Join;
use Symfony\Bridge\Doctrine\Form\Type\EntityType; use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType; 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\SubmitType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface; use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\OptionsResolver\OptionsResolver;
@ -97,6 +99,35 @@ class Niveau04Type extends AbstractType
'label' => 'Label', '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) public function configureOptions(OptionsResolver $resolver)

View File

@ -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']) { if ('SQL' == $options['appMasteridentity'] || 'submit' == $options['mode']) {
$builder->add('password', $builder->add('password',
RepeatedType::class, [ RepeatedType::class, [

View File

@ -30,4 +30,17 @@ class UserRepository extends ServiceEntityRepository
$this->getEntityManager()->flush(); $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;
}
} }

View File

@ -431,6 +431,10 @@ class LdapService
$connection = $this->connect(); $connection = $this->connect();
$result = null; $result = null;
if (!$user->isIsactive()) {
$todel = true;
}
// NIVEAU01 // NIVEAU01
// On recherche le Niveau01 actuellement asscocié à l'utilisateur // On recherche le Niveau01 actuellement asscocié à l'utilisateur
$criteria = '(&(cn=*)(memberUid='.$user->getUsername().'))'; $criteria = '(&(cn=*)(memberUid='.$user->getUsername().'))';
@ -765,7 +769,9 @@ class LdapService
$attrs['memberuid'] = []; $attrs['memberuid'] = [];
foreach ($niveau01->getUsers() as $user) { foreach ($niveau01->getUsers() as $user) {
array_push($attrs['memberuid'], $user->getUsername()); if ($user->isIsactive()) {
array_push($attrs['memberuid'], $user->getUsername());
}
} }
sort($attrs['memberuid']); sort($attrs['memberuid']);
@ -893,7 +899,9 @@ class LdapService
$attrs['memberuid'] = []; $attrs['memberuid'] = [];
foreach ($niveau02->getUsers() as $user) { foreach ($niveau02->getUsers() as $user) {
array_push($attrs['memberuid'], $user->getUsername()); if ($user->isIsactive()) {
array_push($attrs['memberuid'], $user->getUsername());
}
} }
sort($attrs['memberuid']); sort($attrs['memberuid']);
@ -1021,7 +1029,9 @@ class LdapService
$attrs['memberuid'] = []; $attrs['memberuid'] = [];
foreach ($niveau03->getUsers() as $user) { foreach ($niveau03->getUsers() as $user) {
array_push($attrs['memberuid'], $user->getUsername()); if ($user->isIsactive()) {
array_push($attrs['memberuid'], $user->getUsername());
}
} }
sort($attrs['memberuid']); sort($attrs['memberuid']);
@ -1149,7 +1159,9 @@ class LdapService
$attrs['memberuid'] = []; $attrs['memberuid'] = [];
foreach ($niveau04->getUsers() as $user) { foreach ($niveau04->getUsers() as $user) {
array_push($attrs['memberuid'], $user->getUsername()); if ($user->isIsactive()) {
array_push($attrs['memberuid'], $user->getUsername());
}
} }
sort($attrs['memberuid']); sort($attrs['memberuid']);
@ -1277,7 +1289,9 @@ class LdapService
$attrs['memberuid'] = []; $attrs['memberuid'] = [];
foreach ($group->getUsers() as $usergroup) { 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']); sort($attrs['memberuid']);
@ -1306,11 +1320,13 @@ class LdapService
$result = $this->search($criteria, ['memberuid'], $subbranch); $result = $this->search($criteria, ['memberuid'], $subbranch);
if (!$this->in_array_r($usergroup->getUser()->getUsername(), $result[0])) { if (!$this->in_array_r($usergroup->getUser()->getUsername(), $result[0])) {
$dn = $this->getGroupDN($usergroup->getGroup()->getLabel()); if ($usergroup->getUser()->isIsactive()) {
$entry['memberuid'] = $usergroup->getUser()->getUsername(); $dn = $this->getGroupDN($usergroup->getGroup()->getLabel());
$result = ldap_mod_add($connection, $dn, $entry); $entry['memberuid'] = $usergroup->getUser()->getUsername();
if (!$result) { $result = ldap_mod_add($connection, $dn, $entry);
$this->ldapError(); if (!$result) {
$this->ldapError();
}
} }
} }

View File

@ -17,7 +17,7 @@ class UserChecker implements UserCheckerInterface
} }
if (!$user->isIsactive()) { 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('...'); throw new AccountExpiredException('...');
} }
} }
} }

View File

@ -49,7 +49,7 @@
{% if app.user %} {% if app.user %}
$.ajax({ $.ajax({
method: "POST", method: "POST",
url: "{{ path('app_user_preference') }}", url: "{{ path('app_all_preference') }}",
data: { data: {
id:0, id:0,
key:'fgaudit', key:'fgaudit',

View File

@ -66,7 +66,7 @@
{% elseif config.type=="header" %} {% elseif config.type=="header" %}
<div style="margin:10px auto;"> <div style="margin:10px auto;">
<img id="config_value_img" src="{{ path("app_minio_image",{file:"header/"~config.value}) }}" style="width:100%;margin:auto;display:block;"> <img id="config_value_img" src="{{ path("app_minio_image",{file:"header/"~config.value}) }}" style="width:100%;margin:auto;display:block;">
<a class="btn btn-info btn-modal" style="width:100%" data-modalid="mymodallarge" data-modaltitle="Bannière" data-modalurl="{{ path('app_user_crop01', {"type": "header", "reportinput": "#config_value" }) }}" title='Ajouter une Bannière'>Modifier</a> <a class="btn btn-info btn-modal" style="width:100%" data-modalid="mymodallarge" data-modaltitle="Bannière" data-modalurl="{{ path('app_all_crop01', {"type": "header", "reportinput": "#config_value" }) }}" title='Ajouter une Bannière'>Modifier</a>
</div> </div>
{% endif %} {% endif %}
{{ form_row(form.help) }} {{ form_row(form.help) }}

View File

@ -26,7 +26,7 @@
window.parent.$(".modal-title").html("ETAPE 1 - Téléchargez votre image"); window.parent.$(".modal-title").html("ETAPE 1 - Téléchargez votre image");
function dropzonesuccess( file, response ) { 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() { function closeModal() {

View File

@ -6,7 +6,7 @@
<p> <p>
{%if access=="admin" %} {%if access=="admin" %}
<a class="btn btn-success" href={{ path('app_'~access~'_group_submit') }}>Ajouter</a> <a class="btn btn-success" href={{ path('app_'~access~'_group_submit') }}>Ajouter</a>
{%elseif access=="user" and app.session.get("submitgroup") %} {%elseif access=="all" and app.session.get("submitgroup") %}
<a class="btn btn-success" href={{ path('app_'~access~'_group_submit') }}>Ajouter</a> <a class="btn btn-success" href={{ path('app_'~access~'_group_submit') }}>Ajouter</a>
{% endif %} {% endif %}

View File

@ -45,6 +45,11 @@
Caractères interdits = caractères spéciaux sauf ' @ . - _<br> Caractères interdits = caractères spéciaux sauf ' @ . - _<br>
</div> </div>
{{ form_row(form.code) }}
{{ form_row(form.email) }}
{{ form_row(form.telephonenumber) }}
{{ form_row(form.postaladress) }}
{% if form.ldapfilter is defined %} {% if form.ldapfilter is defined %}
{{ form_row(form.fgassocldap) }} {{ form_row(form.fgassocldap) }}

View File

@ -47,6 +47,12 @@
Caractères interdits = caractères spéciaux sauf ' @ . - _<br> Caractères interdits = caractères spéciaux sauf ' @ . - _<br>
</div> </div>
{{ form_row(form.code) }}
{{ form_row(form.email) }}
{{ form_row(form.telephonenumber) }}
{{ form_row(form.postaladress) }}
{% if form.ldapfilter is defined %} {% if form.ldapfilter is defined %}
{{ form_row(form.ldapfilter) }} {{ form_row(form.ldapfilter) }}
{% endif %} {% endif %}

View File

@ -48,6 +48,11 @@
Caractères interdits = caractères spéciaux sauf ' @ . - _<br> Caractères interdits = caractères spéciaux sauf ' @ . - _<br>
</div> </div>
{{ form_row(form.code) }}
{{ form_row(form.email) }}
{{ form_row(form.telephonenumber) }}
{{ form_row(form.postaladress) }}
{% if form.ldapfilter is defined %} {% if form.ldapfilter is defined %}
{{ form_row(form.ldapfilter) }} {{ form_row(form.ldapfilter) }}
{% endif %} {% endif %}

View File

@ -49,6 +49,11 @@
Caractères interdits = caractères spéciaux sauf ' @ . - _<br> Caractères interdits = caractères spéciaux sauf ' @ . - _<br>
</div> </div>
{{ form_row(form.code) }}
{{ form_row(form.email) }}
{{ form_row(form.telephonenumber) }}
{{ form_row(form.postaladress) }}
{% if form.ldapfilter is defined %} {% if form.ldapfilter is defined %}
{{ form_row(form.ldapfilter) }} {{ form_row(form.ldapfilter) }}
{% endif %} {% endif %}

View File

@ -67,7 +67,12 @@
{% endif %} {% endif %}
<img id="user_avatar_img" src="{{ path('app_minio_image',{file:"avatar/"~avatar}) }}" style="max-width:90px;background-color:var(--colorbgbodydark);"> <img id="user_avatar_img" src="{{ path('app_minio_image',{file:"avatar/"~avatar}) }}" style="max-width:90px;background-color:var(--colorbgbodydark);">
{{ form_widget(form.avatar) }} {{ form_widget(form.avatar) }}
<a class="btn btn-info btn-modal" style="width:100%" data-modalid="mymodallarge" data-modaltitle="Avatar" data-modalurl="{{ path('app_user_crop01', {"type": "avatar", "reportinput": "#user_avatar" }) }}" title='Ajouter un Avatar'>Modifier</a> <a class="btn btn-info btn-modal" style="width:100%" data-modalid="mymodallarge" data-modaltitle="Avatar" data-modalurl="{{ path('app_all_crop01', {"type": "avatar", "reportinput": "#user_avatar" }) }}" title='Ajouter un Avatar'>Modifier</a>
{% if form.isactive is defined %}
<center>{{ form_row(form.isactive) }}</center>
{% endif %}
</div> </div>
</div> </div>

View File

@ -1,7 +1,7 @@
{% extends 'base.html.twig' %} {% extends 'base.html.twig' %}
{% block body %} {% block body %}
{% if access=="admin" or access=="modo" %} {% if access!="all" %}
<h1 class="page-header">Gestion des Utilisateurs</h1> <h1 class="page-header">Gestion des Utilisateurs</h1>
{% if appMasteridentity=="SQL" or not appSynchroPurgeUser %} {% if appMasteridentity=="SQL" or not appSynchroPurgeUser %}
<a class="btn btn-success" href={{ path('app_'~access~'_user_submit') }}>Ajouter</a> <a class="btn btn-success" href={{ path('app_'~access~'_user_submit') }}>Ajouter</a>
@ -9,9 +9,17 @@
{% endif %} {% endif %}
{% if auditUse and (access=="admin" or access=="audit") %} {% 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> <a class="btn btn-secondary float-end ms-3" href="{{ path("app_"~access~"_audit_render",{entityname:"User"}) }}"><i class="fas fa-eye fa-fw"></i> Audit</a>
{% endif %} {% endif %}
{% if access!="all" %}
<div class="form-check form-switch float-end mt-2">
<input class="form-check-input" type="checkbox" role="switch" id="checkisactivate" {% if isactive %}checked{%endif%}>
<label class="form-check-label" for="checkisactivate">{% if isactive %}Utilisateurs Actif{%else%}Utilisateurs Inactif{%endif%}</label>
</div>
{%endif%}
<div class="card mt-4"> <div class="card mt-4">
<div class="card-header"> <div class="card-header">
<i class="fa fa-table fa-fw"></i> Liste des Utilisateurs <i class="fa fa-table fa-fw"></i> Liste des Utilisateurs
@ -61,9 +69,26 @@
ajax: "{{ path('app_modo_user_tablelist') }}", ajax: "{{ path('app_modo_user_tablelist') }}",
{% else %} {% else %}
order: [[ 1, "asc" ]], order: [[ 1, "asc" ]],
ajax: "{{ path('app_user_user_tablelist') }}", ajax: "{{ path('app_all_user_tablelist') }}",
{% endif %} {% endif %}
}); });
{% if access!="all" %}
$('#checkisactivate').change(function() {
$.ajax({
method: "POST",
url: "{{ path('app_all_preference') }}",
data: {
id:0,
key:'userisactive',
value: ($("#checkisactivate").is(":checked"))
},
success: function() {
location.reload();
}
});
});
{% endif %}
}); });
</script> </script>
{% endblock %} {% endblock %}

View File

@ -39,7 +39,7 @@
<div class="pe-3"> <div class="pe-3">
<nav class="nav"> <nav class="nav">
{% if app.user %} {% if app.user %}
<a class="nav-link" href="{{path("app_user_user")}}" title="Mon Profil"> <a class="nav-link" href="{{path("app_all_user")}}" title="Mon Profil">
<img src="{{ path('app_minio_image',{file:"avatar/"~app.user.avatar}) }}" class="avatar" style="width:35px;height:35px;"> <img src="{{ path('app_minio_image',{file:"avatar/"~app.user.avatar}) }}" class="avatar" style="width:35px;height:35px;">
</a> </a>
@ -50,11 +50,11 @@
{% endif %} {% endif %}
{% if app.session.get("showannuaire") %} {% if app.session.get("showannuaire") %}
<a class="nav-link" href="{{path("app_user_users")}}" title="Annuaire des Utilisateurs"><i class="fas fa-address-book fa-2x"></i></a> <a class="nav-link" href="{{path("app_all_users")}}" title="Annuaire des Utilisateurs"><i class="fas fa-address-book fa-2x"></i></a>
{% endif %} {% endif %}
{% if appGroupuse %} {% if appGroupuse %}
<a class="nav-link" href="{{path("app_user_group")}}" title="Gestion des Groupes de Travail"><i class="fas fa-users fa-2x"></i></a> <a class="nav-link" href="{{path("app_all_group")}}" title="Gestion des Groupes de Travail"><i class="fas fa-users fa-2x"></i></a>
{% endif %} {% endif %}
<a id="switchHeader" class="nav-link" onclick="switchHeader()" title="Cacher / Afficher Bannière"><i class="fa fa-chevron-up fa-2x"></i></a> <a id="switchHeader" class="nav-link" onclick="switchHeader()" title="Cacher / Afficher Bannière"><i class="fa fa-chevron-up fa-2x"></i></a>
@ -68,7 +68,7 @@
</nav> </nav>
{% if app.user %} {% if app.user %}
<div id="nameuser" style="text-align:right; margin-top:5px"><a href="{{ path('app_user_user') }}" title="Mon Profil">{{ app.user.firstname }} {{ app.user.lastname }}</a></div> <div id="nameuser" style="text-align:right; margin-top:5px"><a href="{{ path('app_all_user') }}" title="Mon Profil">{{ app.user.firstname }} {{ app.user.lastname }}</a></div>
{% endif %} {% endif %}
</div> </div>
</div> </div>
@ -99,7 +99,7 @@
<ul id="menulink" class="nav navbar-right pe-3" style="display:none;"> <ul id="menulink" class="nav navbar-right pe-3" style="display:none;">
{% if app.user %} {% if app.user %}
<a href="{{path("app_user_user")}}"> <a href="{{path("app_all_user")}}">
<img src="{{ path('app_minio_image',{file:"avatar/"~app.user.avatar}) }}" class="avatar" style="width:25px; height:25px; margin-top:-3px; margin-right:3px;"> <img src="{{ path('app_minio_image',{file:"avatar/"~app.user.avatar}) }}" class="avatar" style="width:25px; height:25px; margin-top:-3px; margin-right:3px;">
</a> </a>
@ -110,11 +110,13 @@
{% endif %} {% endif %}
{% if app.session.get("showannuaire") %} {% if app.session.get("showannuaire") %}
<a href="{{path("app_user_users")}}"><i class="fas fa-address-book fa-fw"></i></a> <a href="{{path("app_all_users")}}"><i class="fas fa-address-book fa-fw"></i></a>
{% endif %} {% endif %}
<a href="{{path("app_user_group")}}"><i class="fas fa-users fa-fw"></i></a> {% if appGroupuse %}
<a href="{{path("app_all_group")}}"><i class="fas fa-users fa-fw"></i></a>
{% endif %}
<a id="switchHeader" class="btn-link" onclick="switchHeader()" title="Cacher / Afficher Bannière"><i class="fa fa-chevron-down fa-fw"></i></a> <a id="switchHeader" class="btn-link" onclick="switchHeader()" title="Cacher / Afficher Bannière"><i class="fa fa-chevron-down fa-fw"></i></a>
<a href="{{path("app_logout")}}"><i class="fa fa-sign-out-alt fa-fw"></i></a> <a href="{{path("app_logout")}}"><i class="fa fa-sign-out-alt fa-fw"></i></a>
@ -180,7 +182,7 @@
{% if app.user %} {% if app.user %}
$.ajax({ $.ajax({
method: "POST", method: "POST",
url: "{{ path('app_user_preference') }}", url: "{{ path('app_all_preference') }}",
data: { data: {
id:0, id:0,
key:'fgheader', key:'fgheader',