fix(activeuser): user isactive & adress niveau & route all
This commit is contained in:
parent
2cad98ca86
commit
84230eb347
4
.env
4
.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"]'
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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 }
|
||||
defaults: { access: all }
|
||||
|
||||
|
|
|
@ -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))');
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ class GroupController extends AbstractController
|
|||
return $this->render($this->twig.'list.html.twig', [
|
||||
'useheader' => true,
|
||||
'usemenu' => false,
|
||||
'usesidebar' => ('user' != $access),
|
||||
'usesidebar' => ('all' != $access),
|
||||
'access' => $access,
|
||||
]);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ class GroupController extends AbstractController
|
|||
// Nombre total d'enregistrement
|
||||
$qb = $em->getManager()->createQueryBuilder();
|
||||
$qb->select('COUNT(entity)')->from($this->entity, 'entity')->getQuery()->getSingleScalarResult();
|
||||
if ('user' == $access) {
|
||||
if ('all' == $access) {
|
||||
$qb->from('App:UserGroup', 'usergroup')
|
||||
->andWhere('entity.isworkgroup=:flag')
|
||||
->andWhere('entity.id=usergroup.group')
|
||||
|
@ -66,7 +66,7 @@ class GroupController extends AbstractController
|
|||
->setParameter('value', '%'.$search['value'].'%')
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
if ('user' == $access) {
|
||||
if ('all' == $access) {
|
||||
$qb->from('App:UserGroup', 'usergroup')
|
||||
->andWhere('entity.isworkgroup=:flag')
|
||||
->andWhere('entity.id=usergroup.group')
|
||||
|
@ -89,7 +89,7 @@ class GroupController extends AbstractController
|
|||
$qb = $em->getManager()->createQueryBuilder();
|
||||
$qb->select('entity')
|
||||
->from($this->entity, 'entity');
|
||||
if ('user' == $access) {
|
||||
if ('all' == $access) {
|
||||
$qb->from('App:UserGroup', 'usergroup')
|
||||
->andWhere('entity.isworkgroup=:flag')
|
||||
->andWhere('entity.id=usergroup.group')
|
||||
|
@ -146,7 +146,7 @@ class GroupController extends AbstractController
|
|||
}
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
case 'all':
|
||||
if ($this->canupdate($access, $data, $em, false)) {
|
||||
$action .= "<a href='".$this->generateUrl(str_replace('_admin_', '_'.$access.'_', $this->route).'_update', ['id' => $data->getId()])."'><i class='fa fa-file fa-fw fa-2x'></i></a>";
|
||||
}
|
||||
|
@ -164,8 +164,10 @@ class GroupController extends AbstractController
|
|||
|
||||
$userinfo = '';
|
||||
if ($data->getOwner()) {
|
||||
$userinfo .= "<img src='".$this->generateUrl('app_minio_image', ['file' => 'avatar/'.$data->getOwner()->getAvatar()])."' class='avatar'>";
|
||||
$userinfo .= '<br>'.$data->getOwner()->getUsername();
|
||||
$userinfo .= '<div class="d-flex align-items-center">';
|
||||
$userinfo .= "<img src='".$this->generateUrl('app_minio_image', ['file' => 'avatar/'.$data->getOwner()->getAvatar()])."' class='avatar me-2'>";
|
||||
$userinfo .= '<div>'.$data->getOwner()->getFullname().'</div>';
|
||||
$userinfo .= '</div>';
|
||||
}
|
||||
|
||||
$visitecpt = 0;
|
||||
|
@ -194,7 +196,7 @@ class GroupController extends AbstractController
|
|||
// Initialisation de l'enregistrement
|
||||
$data = new Entity();
|
||||
$data->setApikey(Uuid::uuid4());
|
||||
if ('user' == $access) {
|
||||
if ('all' == $access) {
|
||||
$data->setOwner($this->getUser());
|
||||
$data->setIsworkgroup(true);
|
||||
}
|
||||
|
@ -235,12 +237,12 @@ class GroupController extends AbstractController
|
|||
return $this->render($this->twig.'edit.html.twig', [
|
||||
'useheader' => true,
|
||||
'usemenu' => false,
|
||||
'usesidebar' => ('user' != $access),
|
||||
'usesidebar' => ('all' != $access),
|
||||
'mode' => 'submit',
|
||||
'access' => $access,
|
||||
'form' => $form->createView(),
|
||||
$this->data => $data,
|
||||
'maxsize' => ('user' == $access ? 1200 : null),
|
||||
'maxsize' => ('all' == $access ? 1200 : null),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -284,12 +286,12 @@ class GroupController extends AbstractController
|
|||
return $this->render($this->twig.'edit.html.twig', [
|
||||
'useheader' => true,
|
||||
'usemenu' => false,
|
||||
'usesidebar' => ('user' != $access),
|
||||
'usesidebar' => ('all' != $access),
|
||||
$this->data => $data,
|
||||
'mode' => 'update',
|
||||
'access' => $access,
|
||||
'form' => $form->createView(),
|
||||
'maxsize' => ('user' == $access ? 1200 : null),
|
||||
'maxsize' => ('all' == $access ? 1200 : null),
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -332,7 +334,7 @@ class GroupController extends AbstractController
|
|||
return $this->render($this->twig.'users.html.twig', [
|
||||
'useheader' => true,
|
||||
'usemenu' => false,
|
||||
'usesidebar' => ('user' != $access),
|
||||
'usesidebar' => ('all' != $access),
|
||||
'access' => $access,
|
||||
$this->data => $data,
|
||||
]);
|
||||
|
@ -375,7 +377,9 @@ class GroupController extends AbstractController
|
|||
$qb->select('COUNT(user)')
|
||||
->from('App:User', 'user')
|
||||
->where($qb->expr()->not($qb->expr()->exists($sub->getDQL())))
|
||||
->setParameter('groupid', $id);
|
||||
->andWhere('user.isactive=:isactive')
|
||||
->setParameter('groupid', $id)
|
||||
->setParameter('isactive', true);
|
||||
break;
|
||||
|
||||
case 'modo':
|
||||
|
@ -386,11 +390,13 @@ class GroupController extends AbstractController
|
|||
->where($qb->expr()->not($qb->expr()->exists($sub->getDQL())))
|
||||
->andWhere('usermodo.niveau01 = user.niveau01')
|
||||
->andWhere('usermodo.user = :userid')
|
||||
->andWhere('user.isactive=:isactive')
|
||||
->setParameter('userid', $usermodo)
|
||||
->setParameter('groupid', $id);
|
||||
->setParameter('groupid', $id)
|
||||
->setParameter('isactive', true);
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
case 'all':
|
||||
$niveau01 = $this->getUser()->getNiveau01();
|
||||
$niveau02 = $this->getUser()->getNiveau02();
|
||||
$niveau03 = $this->getUser()->getNiveau03();
|
||||
|
@ -399,7 +405,9 @@ class GroupController extends AbstractController
|
|||
$qb->select('COUNT(user)')
|
||||
->from('App:User', 'user')
|
||||
->where($qb->expr()->not($qb->expr()->exists($sub->getDQL())))
|
||||
->setParameter('groupid', $id);
|
||||
->andWhere('user.isactive=:isactive')
|
||||
->setParameter('groupid', $id)
|
||||
->setParameter('isactive', true);
|
||||
|
||||
switch ($request->getSession()->get('scopeannu')) {
|
||||
case 1:
|
||||
|
@ -434,8 +442,10 @@ class GroupController extends AbstractController
|
|||
->from('App:User', 'user')
|
||||
->where('user.username LIKE :value OR user.email LIKE :value')
|
||||
->andWhere($qb->expr()->not($qb->expr()->exists($sub->getDQL())))
|
||||
->andWhere('user.isactive=:isactive')
|
||||
->setParameter('value', '%'.$search['value'].'%')
|
||||
->setParameter('groupid', $id)
|
||||
->setParameter('isactive', true)
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
break;
|
||||
|
@ -449,21 +459,25 @@ class GroupController extends AbstractController
|
|||
->andWhere($qb->expr()->not($qb->expr()->exists($sub->getDQL())))
|
||||
->andWhere('usermodo.niveau01 = user.niveau01')
|
||||
->andWhere('usermodo.user = :userid')
|
||||
->andWhere('user.isactive=:isactive')
|
||||
->setParameter('userid', $usermodo)
|
||||
->setParameter('value', '%'.$search['value'].'%')
|
||||
->setParameter('groupid', $id)
|
||||
->setParameter('isactive', true)
|
||||
->getQuery()
|
||||
->getSingleScalarResult();
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
case 'all':
|
||||
$qb = $em->getManager()->createQueryBuilder()
|
||||
->select('COUNT(user)')
|
||||
->from('App:User', 'user')
|
||||
->where('user.username LIKE :value OR user.email LIKE :value')
|
||||
->andWhere($qb->expr()->not($qb->expr()->exists($sub->getDQL())))
|
||||
->andWhere('user.isactive=:isactive')
|
||||
->setParameter('value', '%'.$search['value'].'%')
|
||||
->setParameter('groupid', $id);
|
||||
->setParameter('groupid', $id)
|
||||
->setParameter('isactive', true);
|
||||
|
||||
switch ($request->getSession()->get('scopeannu')) {
|
||||
case 1:
|
||||
|
@ -498,23 +512,23 @@ class GroupController extends AbstractController
|
|||
|
||||
// Parcours des Enregistrement
|
||||
$qb = $em->getManager()->createQueryBuilder();
|
||||
$qb->select('user')->from('App:User', 'user');
|
||||
$qb->select('user')->from('App:User', 'user')->Where('user.isactive=:isactive')->setParameter('isactive', true);
|
||||
|
||||
switch ($access) {
|
||||
case 'admin':
|
||||
$qb->where($qb->expr()->not($qb->expr()->exists($sub->getDQL())));
|
||||
$qb->andWhere($qb->expr()->not($qb->expr()->exists($sub->getDQL())));
|
||||
break;
|
||||
|
||||
case 'modo':
|
||||
$qb->from('App:UserModo', 'usermodo')
|
||||
->where($qb->expr()->not($qb->expr()->exists($sub->getDQL())))
|
||||
->andWhere($qb->expr()->not($qb->expr()->exists($sub->getDQL())))
|
||||
->andWhere('usermodo.niveau01 = user.niveau01')
|
||||
->andWhere('usermodo.user = :userid')
|
||||
->setParameter('userid', $usermodo);
|
||||
break;
|
||||
|
||||
case 'user':
|
||||
$qb->where($qb->expr()->not($qb->expr()->exists($sub->getDQL())));
|
||||
case 'all':
|
||||
$qb->andWhere($qb->expr()->not($qb->expr()->exists($sub->getDQL())));
|
||||
switch ($request->getSession()->get('scopeannu')) {
|
||||
case 1:
|
||||
$qb->andWhere('user.niveau01 = :niveau01')->setParameter('niveau01', $niveau01);
|
||||
|
@ -598,7 +612,7 @@ class GroupController extends AbstractController
|
|||
|
||||
// Nombre total d'enregistrement
|
||||
$qb = $em->getManager()->createQueryBuilder();
|
||||
if ('admin' == $access || 'user' == $access) {
|
||||
if ('admin' == $access || 'all' == $access) {
|
||||
$qb->select('COUNT(user)')
|
||||
->from('App:User', 'user')
|
||||
->where($qb->expr()->exists($sub->getDQL()))
|
||||
|
@ -620,7 +634,7 @@ class GroupController extends AbstractController
|
|||
if ('' == $search['value']) {
|
||||
$totalf = $total;
|
||||
} else {
|
||||
if ('admin' == $access || 'user' == $access) {
|
||||
if ('admin' == $access || 'all' == $access) {
|
||||
$totalf = $em->getManager()->createQueryBuilder()
|
||||
->select('COUNT(user)')
|
||||
->from('App:User', 'user')
|
||||
|
@ -659,7 +673,7 @@ class GroupController extends AbstractController
|
|||
$qb = $em->getManager()->createQueryBuilder();
|
||||
$qb->select('user')->from('App:User', 'user');
|
||||
|
||||
if ('admin' == $access || 'user' == $access) {
|
||||
if ('admin' == $access || 'all' == $access) {
|
||||
$qb->where($qb->expr()->exists($sub->getDQL()));
|
||||
} else {
|
||||
$qb->from('App:UserModo', 'usermodo')
|
||||
|
@ -715,7 +729,7 @@ class GroupController extends AbstractController
|
|||
$rolegroup = (0 == $usergroup->getRolegroup() ? 'Utilisateur' : (50 == $usergroup->getRolegroup() ? 'Collaborateur' : 'Gestionnaire'));
|
||||
}
|
||||
|
||||
$tmp = ['DT_RowId' => 'user'.$data->getId(), $action, $avatar, $data->getUsername(), $data->getEmail(), $rolegroup];
|
||||
$tmp = ['DT_RowId' => 'user'.$data->getId(), $action, $avatar, $data->getUsername().(!$data->isIsactive() ? '<br><small><i>Inactif</i></small>' : ''), $data->getEmail(), $rolegroup];
|
||||
array_push($output['data'], $tmp);
|
||||
}
|
||||
|
||||
|
@ -842,7 +856,7 @@ class GroupController extends AbstractController
|
|||
break;
|
||||
case 'modo': return false;
|
||||
break;
|
||||
case 'user': return $request->getSession()->get('submitgroup');
|
||||
case 'all': return $request->getSession()->get('submitgroup');
|
||||
break;
|
||||
}
|
||||
throw $this->createAccessDeniedException('Permission denied');
|
||||
|
@ -854,7 +868,7 @@ class GroupController extends AbstractController
|
|||
switch ($access) {
|
||||
case 'admin': $toreturn = ($entity->getId() > 0);
|
||||
break;
|
||||
case 'user':
|
||||
case 'all':
|
||||
if (!$entity->isIsworkgroup() || $entity->getOwner() != $this->getUser()) {
|
||||
$toreturn = false;
|
||||
} else {
|
||||
|
@ -877,7 +891,7 @@ class GroupController extends AbstractController
|
|||
break;
|
||||
case 'modo': $toreturn = ($entity->getId() > 0);
|
||||
break;
|
||||
case 'user':
|
||||
case 'all':
|
||||
$usergroup = $em->getRepository("App\Entity\UserGroup")->findOneBy(['user' => $this->getUser(), 'group' => $entity]);
|
||||
if (!$usergroup || !$entity->isIsworkgroup() || $entity->getId() < 0) {
|
||||
$toreturn = false;
|
||||
|
@ -901,7 +915,7 @@ class GroupController extends AbstractController
|
|||
break;
|
||||
case 'modo': $toreturn = ($entity->getId() > 0);
|
||||
break;
|
||||
case 'user':
|
||||
case 'all':
|
||||
$usergroup = $em->getRepository("App\Entity\UserGroup")->findOneBy(['user' => $this->getUser(), 'group' => $entity]);
|
||||
if (!$usergroup || !$entity->isIsworkgroup() || $entity->getId() < 0) {
|
||||
$toreturn = false;
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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']);
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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, [
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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('...');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
{% elseif config.type=="header" %}
|
||||
<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;">
|
||||
<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>
|
||||
{% endif %}
|
||||
{{ form_row(form.help) }}
|
||||
|
|
|
@ -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() {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<p>
|
||||
{%if access=="admin" %}
|
||||
<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>
|
||||
{% endif %}
|
||||
|
||||
|
|
|
@ -45,6 +45,11 @@
|
|||
Caractères interdits = caractères spéciaux sauf ' @ . - _<br>
|
||||
</div>
|
||||
|
||||
{{ 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) }}
|
||||
|
||||
|
|
|
@ -47,6 +47,12 @@
|
|||
Caractères interdits = caractères spéciaux sauf ' @ . - _<br>
|
||||
</div>
|
||||
|
||||
|
||||
{{ 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 %}
|
||||
|
|
|
@ -48,6 +48,11 @@
|
|||
Caractères interdits = caractères spéciaux sauf ' @ . - _<br>
|
||||
</div>
|
||||
|
||||
{{ 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 %}
|
||||
|
|
|
@ -49,6 +49,11 @@
|
|||
Caractères interdits = caractères spéciaux sauf ' @ . - _<br>
|
||||
</div>
|
||||
|
||||
{{ 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 %}
|
||||
|
|
|
@ -67,7 +67,12 @@
|
|||
{% endif %}
|
||||
<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) }}
|
||||
<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>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{% extends 'base.html.twig' %}
|
||||
|
||||
{% block body %}
|
||||
{% if access=="admin" or access=="modo" %}
|
||||
{% if access!="all" %}
|
||||
<h1 class="page-header">Gestion des Utilisateurs</h1>
|
||||
{% if appMasteridentity=="SQL" or not appSynchroPurgeUser %}
|
||||
<a class="btn btn-success" href={{ path('app_'~access~'_user_submit') }}>Ajouter</a>
|
||||
|
@ -9,9 +9,17 @@
|
|||
{% endif %}
|
||||
|
||||
{% if auditUse and (access=="admin" or access=="audit") %}
|
||||
<a class="btn btn-secondary float-end" href="{{ path("app_"~access~"_audit_render",{entityname:"User"}) }}"><i class="fas fa-eye fa-fw"></i> Audit</a>
|
||||
<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 %}
|
||||
|
||||
|
||||
{% 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-header">
|
||||
<i class="fa fa-table fa-fw"></i> Liste des Utilisateurs
|
||||
|
@ -61,9 +69,26 @@
|
|||
ajax: "{{ path('app_modo_user_tablelist') }}",
|
||||
{% else %}
|
||||
order: [[ 1, "asc" ]],
|
||||
ajax: "{{ path('app_user_user_tablelist') }}",
|
||||
ajax: "{{ path('app_all_user_tablelist') }}",
|
||||
{% 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>
|
||||
{% endblock %}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
<div class="pe-3">
|
||||
<nav class="nav">
|
||||
{% 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;">
|
||||
</a>
|
||||
|
||||
|
@ -50,11 +50,11 @@
|
|||
{% endif %}
|
||||
|
||||
{% 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 %}
|
||||
|
||||
{% 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 %}
|
||||
|
||||
<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>
|
||||
|
||||
{% 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 %}
|
||||
</div>
|
||||
</div>
|
||||
|
@ -99,7 +99,7 @@
|
|||
|
||||
<ul id="menulink" class="nav navbar-right pe-3" style="display:none;">
|
||||
{% 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;">
|
||||
</a>
|
||||
|
||||
|
@ -110,11 +110,13 @@
|
|||
{% endif %}
|
||||
|
||||
{% 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 %}
|
||||
|
||||
<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 href="{{path("app_logout")}}"><i class="fa fa-sign-out-alt fa-fw"></i></a>
|
||||
|
@ -180,7 +182,7 @@
|
|||
{% if app.user %}
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "{{ path('app_user_preference') }}",
|
||||
url: "{{ path('app_all_preference') }}",
|
||||
data: {
|
||||
id:0,
|
||||
key:'fgheader',
|
||||
|
|
Loading…
Reference in New Issue