From dc0e7c0000575d96ecc1cff1d468695c2a78f806 Mon Sep 17 00:00:00 2001
From: lecluse <lecluse@d57fa8bc-6af1-4de9-8b7d-78e900e231e7>
Date: Thu, 18 Sep 2014 15:04:29 +0000
Subject: [PATCH] =?UTF-8?q?Mise=20en=20place=20des=20classes=20de=20r?=
 =?UTF-8?q?=C3=B4les=20et=20d=C3=A9but=20de=20refactoring=20du=20code?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 data/Migration v1.1.html                      |  20 +++
 .../Application/config/intervenant.config.php |  14 +-
 module/Application/config/module.config.php   |  45 +++--
 .../config/offre-formation.config.php         |  14 +-
 .../Application/config/recherche.config.php   |   2 +-
 module/Application/config/service.config.php  |   6 +-
 .../Application/config/structure.config.php   |   2 +-
 .../config/volume-horaire.config.php          |   2 +-
 .../Application/Acl/AdministrateurRole.php    |  24 +++
 .../src/Application/Acl/ComposanteDbRole.php  |  23 ---
 .../src/Application/Acl/ComposanteRole.php    |  95 ++++++++--
 .../src/Application/Acl/DbRole.php            | 130 --------------
 .../src/Application/Acl/DrhRole.php           |  44 +++++
 .../src/Application/Acl/EtablissementRole.php |  35 ++++
 .../Acl/IntervenantExterieurRole.php          |  34 ----
 .../Acl/IntervenantPermanentRole.php          |  34 ----
 .../src/Application/Acl/IntervenantRole.php   |  69 ++++----
 .../Controller/OffreFormationController.php   |   4 +-
 .../ServiceReferentielController.php          |   2 +-
 ...rvenantPermanentWithServiceReferentiel.php |   4 +-
 .../Db/Finder/FinderServiceReferentiel.php    |   4 +-
 .../Application.Entity.Db.Validation.dcm.xml  |   2 -
 .../src/Application/Entity/Db/Role.php        |   4 +-
 .../Application/Entity/Db/RoleUtilisateur.php |   5 +-
 .../src/Application/Entity/Db/TypeRole.php    |   4 +-
 .../Application/Entity/Db/VRolePersonnel.php  |  99 -----------
 .../Application/Form/VolumeHoraire/Saisie.php |   2 +-
 .../Interfaces/IntervenantAwareInterface.php  |  28 +++
 .../Interfaces/PersonnelAwareInterface.php    |  27 +++
 .../Interfaces/StructureAwareInterface.php    |  27 +++
 .../Interfaces/TypeRoleAwareInterface.php     |  27 +++
 .../Provider/Identity/IdentityProvider.php    |  95 +++++-----
 .../Identity/IdentityProviderFactory.php      |   5 +-
 .../Provider/Role/RoleProvider.php            | 165 ++++++------------
 .../Provider/Role/RoleProviderFactory.php     |  10 +-
 .../Application/Service/ContextProvider.php   |  11 +-
 .../Service/ElementPedagogique.php            |  24 ++-
 .../src/Application/Service/Etape.php         |  24 ++-
 .../src/Application/Service/Role.php          |  46 -----
 .../Application/Service/RoleUtilisateur.php   |  47 -----
 .../src/Application/Service/Service.php       |   2 +-
 .../src/Application/Service/Structure.php     |   4 +-
 .../src/Application/Service/TypeRole.php      |  33 ++++
 .../Application/Service/TypeRolePhpRole.php   | 100 -----------
 .../Traits/PersonnelAwareTrait.php            |  40 +++++
 .../Application/Traits/TypeRoleAwareTrait.php |  40 +++++
 .../view/application/service/index.phtml      |   2 +-
 module/Import/config/module.config.php        |   8 +-
 48 files changed, 654 insertions(+), 834 deletions(-)
 create mode 100644 data/Migration v1.1.html
 create mode 100644 module/Application/src/Application/Acl/AdministrateurRole.php
 delete mode 100644 module/Application/src/Application/Acl/ComposanteDbRole.php
 delete mode 100644 module/Application/src/Application/Acl/DbRole.php
 create mode 100644 module/Application/src/Application/Acl/DrhRole.php
 create mode 100644 module/Application/src/Application/Acl/EtablissementRole.php
 delete mode 100644 module/Application/src/Application/Acl/IntervenantExterieurRole.php
 delete mode 100644 module/Application/src/Application/Acl/IntervenantPermanentRole.php
 delete mode 100644 module/Application/src/Application/Entity/Db/VRolePersonnel.php
 create mode 100644 module/Application/src/Application/Interfaces/IntervenantAwareInterface.php
 create mode 100644 module/Application/src/Application/Interfaces/PersonnelAwareInterface.php
 create mode 100644 module/Application/src/Application/Interfaces/StructureAwareInterface.php
 create mode 100644 module/Application/src/Application/Interfaces/TypeRoleAwareInterface.php
 delete mode 100644 module/Application/src/Application/Service/RoleUtilisateur.php
 create mode 100644 module/Application/src/Application/Service/TypeRole.php
 delete mode 100644 module/Application/src/Application/Service/TypeRolePhpRole.php
 create mode 100644 module/Application/src/Application/Traits/PersonnelAwareTrait.php
 create mode 100644 module/Application/src/Application/Traits/TypeRoleAwareTrait.php

diff --git a/data/Migration v1.1.html b/data/Migration v1.1.html
new file mode 100644
index 0000000000..3d942c9b82
--- /dev/null
+++ b/data/Migration v1.1.html	
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <title>Guide de migration vers la v1.1</title>
+        <meta charset="UTF-8">
+    </head>
+    <body>
+        <h1>Guide de migration vers la v1.1</h1>
+        <h2>TODO au niveau de la BDD</h2>
+        <ul>
+            <li>Penser à mettre à jour le contenu de la table TYPE_ROLE</li>
+            <li>Penser à déclarer comme admin. Bertrand, Bruno, Laurent</li>
+        </ul>
+        <h2>TODO BDD AVANT migration :</h2>
+        <ul>
+            <li>Supprimer la table TYPE_ROLE_PHP_ROLE</li>
+            <li>Supprimer VRolePersonnel</li>
+        </ul>
+    </body>
+</html>
\ No newline at end of file
diff --git a/module/Application/config/intervenant.config.php b/module/Application/config/intervenant.config.php
index 6e4a07c817..e375cbe387 100644
--- a/module/Application/config/intervenant.config.php
+++ b/module/Application/config/intervenant.config.php
@@ -2,8 +2,6 @@
 
 namespace Application;
 
-const ROLE_ID_DRH = 'DRH';
-
 use Application\Acl\ComposanteRole;
 use Application\Acl\IntervenantRole;
 use Application\Acl\IntervenantPermanentRole;
@@ -310,32 +308,32 @@ return array(
                 array(
                     'controller' => 'Application\Controller\Intervenant',
                     'action'     => array('index', 'apercevoir', 'feuille-de-route'),
-                    'roles'      => array(IntervenantRole::ROLE_ID, ComposanteRole::ROLE_ID,'Administrateur'),
+                    'roles'      => array(IntervenantRole::ROLE_ID, ComposanteRole::ROLE_ID,'administrateur'),
                 ),
                 array(
                     'controller' => 'Application\Controller\Intervenant',
                     'action'     => array('voir', 'choisir', 'rechercher', 'search'),
-                    'roles'      => array(ComposanteRole::ROLE_ID,'Administrateur'),
+                    'roles'      => array(ComposanteRole::ROLE_ID,'administrateur'),
                 ),
                 array(
                     'controller' => 'Application\Controller\Intervenant',
                     'action'     => array('voir-heures-comp'),
-                    'roles'      => array(ROLE_ID_DRH,'Administrateur'),
+                    'roles'      => array('drh','administrateur'),
                 ),
                 array(
                     'controller' => 'Application\Controller\Dossier',
                     'action'     => array('voir', 'modifier', 'pieces-jointes'),
-                    'roles'      => array(IntervenantExterieurRole::ROLE_ID, ComposanteRole::ROLE_ID,'Administrateur'),
+                    'roles'      => array(IntervenantExterieurRole::ROLE_ID, ComposanteRole::ROLE_ID,'administrateur'),
                 ),
                 array(
                     'controller' => 'Application\Controller\ModificationServiceDu',
                     'action'     => array('saisir'),
-                    'roles'      => array(ComposanteRole::ROLE_ID,'Administrateur'),
+                    'roles'      => array(ComposanteRole::ROLE_ID,'administrateur'),
                 ),
                 array(
                     'controller' => 'Application\Controller\Workflow',
                     'action'     => array('nav-next'),
-                    'roles'      => array('user','Administrateur'),
+                    'roles'      => array('user','administrateur'),
                 ),
             ),
         ),
diff --git a/module/Application/config/module.config.php b/module/Application/config/module.config.php
index 1f838e4698..3bdc5092d9 100755
--- a/module/Application/config/module.config.php
+++ b/module/Application/config/module.config.php
@@ -114,27 +114,27 @@ $main =  array(
     ),
     'bjyauthorize' => array(
         'role_providers' => array(
-            /**
-             * 
-             */
-            'ApplicationRoleProvider' => array(),
-            
-            /**
-             * Rôles issus de l'annuaire LDAP
-             */
-//            'UnicaenAuth\Provider\Role\Config' => array(
-//                // intervant = rôle de base
-//                'intervenant' => array('name' => "Intervenant", 'children' => array(
-//                    // gestionnaires de composantes
-//                    'cn=ucbn_composantes_responsables,ou=groups,dc=unicaen,dc=fr' => array('name' => "Responsable de composante", 'children' => array(
-//                        // directeurs de composantes
-//                        'cn=ucbn_composantes_directeurs,ou=groups,dc=unicaen,dc=fr' => array('name' => "Directeur de composante", 'children' => array(
-//                            // administrateur de l'appli
-////                            'cn=admin_cartagen,ou=groups,dc=unicaen,dc=fr',
-//                        )),
-//                    )),
-//                )),
-//            ),
+            'ApplicationRoleProvider' => [
+                'Application\\Acl\\AdministrateurRole',
+
+                'Application\\Acl\\ComposanteRole',
+                    'Application\\Acl\\DirecteurComposanteRole',
+                    'Application\\Acl\\GestionnaireComposanteRole',
+                    'Application\\Acl\\ResponsableComposanteRole',
+                    'Application\\Acl\\SuperviseurComposanteRole',
+                    'Application\\Acl\\ResponsableRechercheLaboRole',
+
+                'Application\\Acl\\DrhRole',
+                    'Application\\Acl\\GestionnaireDrhRole',
+                    'Application\\Acl\\ResponsableDrhRole',
+
+                'Application\\Acl\\EtablissementRole',
+                    'Application\\Acl\\SuperviseurEtablissementRole',
+
+                'Application\\Acl\\IntervenantRole',
+                    'Application\\Acl\\IntervenantExterieurRole',
+                    'Application\\Acl\\IntervenantPermanentRole',
+            ],
         ),
     ),
     'service_manager' => array(
@@ -146,9 +146,8 @@ $main =  array(
             'ApplicationParametres'                          => 'Application\\Service\\Parametres',
             'ApplicationTypeIntervention'                    => 'Application\\Service\\TypeIntervention',
             'ApplicationSource'                              => 'Application\\Service\\Source',
-            'ApplicationTypeRolePhpRole'                     => 'Application\\Service\\TypeRolePhpRole',
             'ApplicationRole'                                => 'Application\\Service\\Role',
-            'ApplicationRoleUtilisateur'                     => 'Application\\Service\\RoleUtilisateur',
+            'ApplicationTypeRole'                            => 'Application\\Service\\TypeRole',
             'NavigationPageVisibility'                       => 'Application\\Service\\NavigationPageVisibility',
         ),
         'factories' => array(
diff --git a/module/Application/config/offre-formation.config.php b/module/Application/config/offre-formation.config.php
index ba25384f25..8aef839200 100644
--- a/module/Application/config/offre-formation.config.php
+++ b/module/Application/config/offre-formation.config.php
@@ -281,12 +281,12 @@ return array(
                 array(
                     'controller' => 'Application\Controller\OffreFormation',
                     'action'     => array('search-structures', 'search-niveaux'),
-                    'roles'      => array(IntervenantRole::ROLE_ID, ComposanteRole::ROLE_ID,'Administrateur'),
+                    'roles'      => array(IntervenantRole::ROLE_ID, ComposanteRole::ROLE_ID,'administrateur'),
                 ),
                 array(
                     'controller' => 'Application\Controller\OffreFormation',
                     'action'     => array('index', 'export'),
-                    'roles'      => array(ComposanteRole::ROLE_ID,'Administrateur'),
+                    'roles'      => array(ComposanteRole::ROLE_ID,'administrateur'),
                 ),
                 /**
                  * Etape
@@ -294,12 +294,12 @@ return array(
                 array(
                     'controller' => 'Application\Controller\OffreFormation\Etape',
                     'action'     => array('voir', 'apercevoir', 'search'),
-                    'roles'      => array(IntervenantRole::ROLE_ID, ComposanteRole::ROLE_ID,'Administrateur'),
+                    'roles'      => array(IntervenantRole::ROLE_ID, ComposanteRole::ROLE_ID,'administrateur'),
                 ),
                 array(
                     'controller' => 'Application\Controller\OffreFormation\Etape',
                     'action'     => array('ajouter', 'modifier', 'supprimer'),
-                    'roles'      => array(ComposanteRole::ROLE_ID,'Administrateur'),
+                    'roles'      => array(ComposanteRole::ROLE_ID,'administrateur'),
                 ),
                 /**
                  * ElementPedagogique
@@ -307,12 +307,12 @@ return array(
                 array(
                     'controller' => 'Application\Controller\OffreFormation\ElementPedagogique',
                     'action'     => array('voir', 'apercevoir', 'search', 'getPeriode'),
-                    'roles'      => array(IntervenantRole::ROLE_ID, ComposanteRole::ROLE_ID,'Administrateur'),
+                    'roles'      => array(IntervenantRole::ROLE_ID, ComposanteRole::ROLE_ID,'administrateur'),
                 ),
                 array(
                     'controller' => 'Application\Controller\OffreFormation\ElementPedagogique',
                     'action'     => array('ajouter', 'modifier', 'supprimer'),
-                    'roles'      => array(ComposanteRole::ROLE_ID,'Administrateur'),
+                    'roles'      => array(ComposanteRole::ROLE_ID,'administrateur'),
                 ),
                 /**
                  * Modulateur
@@ -320,7 +320,7 @@ return array(
                 array(
                     'controller' => 'Application\Controller\OffreFormation\Modulateur',
                     'action'     => array('saisir'),
-                    'roles'      => array(ComposanteRole::ROLE_ID,'Administrateur'),
+                    'roles'      => array(ComposanteRole::ROLE_ID,'administrateur'),
                 ),
             ),
         ),
diff --git a/module/Application/config/recherche.config.php b/module/Application/config/recherche.config.php
index 9d4ac0bee6..2163cd3c60 100644
--- a/module/Application/config/recherche.config.php
+++ b/module/Application/config/recherche.config.php
@@ -24,7 +24,7 @@ return array(
             'BjyAuthorize\Guard\Controller' => array(
                 array(
                     'controller' => 'Application\Controller\Recherche',
-                    'roles' => array('user','Administrateur')),
+                    'roles' => array('user')),
             ),
         ),
     ),
diff --git a/module/Application/config/service.config.php b/module/Application/config/service.config.php
index 2ffc1bef78..af272b6894 100644
--- a/module/Application/config/service.config.php
+++ b/module/Application/config/service.config.php
@@ -179,15 +179,15 @@ return array(
                 array(
                     'controller' => 'Application\Controller\Service',
                     'action' => array('intervenant', 'saisie', 'suppression', 'voir', 'rafraichir-ligne', 'volumes-horaires-refresh'),
-                    'roles' => array(IntervenantRole::ROLE_ID, ComposanteRole::ROLE_ID,'Administrateur')),
+                    'roles' => array(IntervenantRole::ROLE_ID, ComposanteRole::ROLE_ID,'administrateur')),
                 array(
                     'controller' => 'Application\Controller\Service',
                     'action' => array('index', 'resume','resume-refresh','filtres'),
-                    'roles' => array(ComposanteRole::ROLE_ID,'Administrateur')),
+                    'roles' => array(ComposanteRole::ROLE_ID,'administrateur')),
                 array( 
                     'controller' => 'Application\Controller\ServiceReferentiel',
                     'action' => array('index', 'intervenant', 'saisir', 'supprimer', 'voir', 'voirLigne', 'voirListe'),
-                    'roles' => array(IntervenantRole::ROLE_ID, ComposanteRole::ROLE_ID,'Administrateur')),
+                    'roles' => array(IntervenantRole::ROLE_ID, ComposanteRole::ROLE_ID,'administrateur')),
             ),
         ),
     ),
diff --git a/module/Application/config/structure.config.php b/module/Application/config/structure.config.php
index a69f671032..6ec6b1b3c4 100644
--- a/module/Application/config/structure.config.php
+++ b/module/Application/config/structure.config.php
@@ -91,7 +91,7 @@ return array(
                 array(
                     'controller' => 'Application\Controller\Structure',
                     'action' => array('index', 'choisir', 'recherche', 'voir', 'apercevoir'),
-                    'roles' => array(IntervenantRole::ROLE_ID, ComposanteRole::ROLE_ID)),
+                    'roles' => array(IntervenantRole::ROLE_ID, ComposanteRole::ROLE_ID, 'administrateur')),
             ),
         ),
     ),
diff --git a/module/Application/config/volume-horaire.config.php b/module/Application/config/volume-horaire.config.php
index 4df8dcd476..0f6fcf3ecf 100644
--- a/module/Application/config/volume-horaire.config.php
+++ b/module/Application/config/volume-horaire.config.php
@@ -94,7 +94,7 @@ return array(
                 array(
                     'controller' => 'Application\Controller\VolumeHoraire',
                     'action' => array('voir', 'liste', 'saisie'),
-                    'roles' => array(IntervenantRole::ROLE_ID, ComposanteRole::ROLE_ID,'Administrateur')),
+                    'roles' => array(IntervenantRole::ROLE_ID, ComposanteRole::ROLE_ID,'administrateur')),
             ),
         ),
     ),
diff --git a/module/Application/src/Application/Acl/AdministrateurRole.php b/module/Application/src/Application/Acl/AdministrateurRole.php
new file mode 100644
index 0000000000..d26be763ba
--- /dev/null
+++ b/module/Application/src/Application/Acl/AdministrateurRole.php
@@ -0,0 +1,24 @@
+<?php
+
+namespace Application\Acl;
+
+use UnicaenAuth\Acl\NamedRole;
+use Application\Interfaces\PersonnelAwareInterface;
+use Application\Traits\PersonnelAwareTrait;
+
+/**
+ * Rôle père de tous les rôles "administrateur".
+ *
+ * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
+ */
+class AdministrateurRole extends NamedRole implements PersonnelAwareInterface
+{
+    use PersonnelAwareTrait;
+
+    const ROLE_ID = 'administrateur';
+
+    public function __construct($id = self::ROLE_ID, $parent = 'user', $name = 'Administrateur', $description = null, $selectable = true)
+    {
+        parent::__construct($id, $parent, $name, $description, $selectable);
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Acl/ComposanteDbRole.php b/module/Application/src/Application/Acl/ComposanteDbRole.php
deleted file mode 100644
index 40fd81ef8b..0000000000
--- a/module/Application/src/Application/Acl/ComposanteDbRole.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-namespace Application\Acl;
-
-/**
- * Rôle correspondant à une responsabilité issue de la bdd (entité Role).
- *
- * @see \Application\Entity\Db\Role
- * @see \Application\Entity\Db\TypeRole
- * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
- */
-class ComposanteDbRole extends DbRole
-{
-    /**
-     * Retourne la représentation littérale de cet objet.
-     * 
-     * @return string
-     */
-    public function __toString()
-    {
-        return sprintf("%s (%s)", "Composante", $this->getStructure());
-    }
-}
\ No newline at end of file
diff --git a/module/Application/src/Application/Acl/ComposanteRole.php b/module/Application/src/Application/Acl/ComposanteRole.php
index d55f64ecda..2c0fc9b5e3 100644
--- a/module/Application/src/Application/Acl/ComposanteRole.php
+++ b/module/Application/src/Application/Acl/ComposanteRole.php
@@ -2,18 +2,29 @@
 
 namespace Application\Acl;
 
-use Zend\Permissions\Acl\Role\RoleInterface;
-use BjyAuthorize\Acl\HierarchicalRoleInterface;
+use UnicaenAuth\Acl\NamedRole;
+use Application\Interfaces\StructureAwareInterface;
+use Application\Traits\StructureAwareTrait;
+use Application\Interfaces\PersonnelAwareInterface;
+use Application\Traits\PersonnelAwareTrait;
 
 /**
  * Rôle père de tous les rôles "composante".
  *
  * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
  */
-class ComposanteRole implements RoleInterface, HierarchicalRoleInterface
+class ComposanteRole extends NamedRole implements StructureAwareInterface, PersonnelAwareInterface
 {
+    use StructureAwareTrait;
+    use PersonnelAwareTrait;
+
     const ROLE_ID = 'composante';
-        
+
+    public function __construct($id = self::ROLE_ID, $parent = 'user', $name = 'Composante', $description = null, $selectable = true)
+    {
+        parent::__construct($id, $parent, $name, $description, $selectable);
+    }
+
     /**
      * Returns the string identifier of the Role
      *
@@ -21,16 +32,80 @@ class ComposanteRole implements RoleInterface, HierarchicalRoleInterface
      */
     public function getRoleId()
     {
-        return self::ROLE_ID;
+        if ($structure = $this->getStructure()){
+            return static::ROLE_ID.'-'.$structure->getSourceCode();
+        }else{
+            return static::ROLE_ID;
+        }
     }
-    
+
     /**
-     * Get the parent role
+     * Retourne la représentation littérale de cet objet.
      *
-     * @return \Zend\Permissions\Acl\Role\RoleInterface|null
+     * @return string
      */
-    public function getParent()
+    public function __toString()
+    {
+        return sprintf("%s (%s)", $this->getRoleName(), $this->getStructure());
+    }
+}
+
+class DirecteurComposanteRole extends ComposanteRole
+{
+    const ROLE_ID = 'directeur-composante';
+
+    public function __construct($id = self::ROLE_ID, $parent = ComposanteRole::ROLE_ID, $name = 'Directeur de composante', $description = null, $selectable = true)
+    {
+        parent::__construct($id, $parent, $name, $description, $selectable);
+    }
+}
+
+class GestionnaireComposanteRole extends ComposanteRole
+{
+    const ROLE_ID = 'gestionnaire-composante';
+
+    public function __construct($id = self::ROLE_ID, $parent = ComposanteRole::ROLE_ID, $name = 'Gestionnaire de composante', $description = null, $selectable = true)
     {
-        return 'user';
+        parent::__construct($id, $parent, $name, $description, $selectable);
     }
+}
+
+class ResponsableComposanteRole extends ComposanteRole
+{
+    const ROLE_ID = 'responsable-composante';
+
+    public function __construct($id = self::ROLE_ID, $parent = ComposanteRole::ROLE_ID, $name = 'Responsable de composante', $description = null, $selectable = true)
+    {
+        parent::__construct($id, $parent, $name, $description, $selectable);
+    }
+}
+
+class SuperviseurComposanteRole extends ComposanteRole
+{
+    const ROLE_ID = 'superviseur-composante';
+
+    public function __construct($id = self::ROLE_ID, $parent = ComposanteRole::ROLE_ID, $name = 'Superviseur de composante', $description = null, $selectable = true)
+    {
+        parent::__construct($id, $parent, $name, $description, $selectable);
+    }
+}
+
+class ResponsableRechercheLaboRole extends ComposanteRole
+{
+    const ROLE_ID = 'responsable-recherche-labo';
+
+    public function __construct($id = self::ROLE_ID, $parent = ComposanteRole::ROLE_ID, $name = 'Responsable d\'équipe de recherche', $description = null, $selectable = true)
+    {
+        parent::__construct($id, $parent, $name, $description, $selectable);
+    }
+}
+
+
+
+
+/**
+ * @deprecated since version 1.1
+ */
+class ComposanteDbRole extends ComposanteRole
+{
 }
\ No newline at end of file
diff --git a/module/Application/src/Application/Acl/DbRole.php b/module/Application/src/Application/Acl/DbRole.php
deleted file mode 100644
index bbf7a16a4f..0000000000
--- a/module/Application/src/Application/Acl/DbRole.php
+++ /dev/null
@@ -1,130 +0,0 @@
-<?php
-
-namespace Application\Acl;
-
-use Zend\Permissions\Acl\Role\RoleInterface;
-use BjyAuthorize\Acl\HierarchicalRoleInterface;
-use Application\Entity\Db\TypeRole;
-use Application\Entity\Db\Structure;
-
-class DbRole implements RoleInterface, HierarchicalRoleInterface
-{    
-    /**
-     * @var TypeRole
-     */
-    protected $typeRole;
-    
-    /**
-     * @var Structure
-     */
-    protected $structure;
-    
-    /**
-     * @var string
-     */
-    protected $roleId;
-    
-    /**
-     * @var string|RoleInterface|null
-     */
-    protected $parent;
-    
-    /**
-     * Constructeur.
-     * 
-     * @param TypeRole $typeRole
-     * @param Structure $structure
-     * @param string|RoleInterface|null $parent
-     */
-    public function __construct(TypeRole $typeRole, Structure $structure, $parent = null)
-    {
-        $this->typeRole  = $typeRole;
-        $this->structure = $structure;
-        $this->parent    = $parent;
-    }
-    
-    /**
-     * Retourne la représentation littérale de cet objet.
-     * 
-     * @return string
-     */
-    public function __toString()
-    {
-        return sprintf("%s (%s)", $this->getTypeRole(), $this->getStructure());
-    }
-    
-    /**
-     * Returns the string identifier of the Role
-     *
-     * @return string
-     */
-    public function getRoleId()
-    {
-        if (null === $this->roleId) {
-            $this->roleId = static::createRoleId($this->getTypeRole(), $this->getStructure());
-        }
-        return $this->roleId;
-    }
-    
-    /**
-     * Fabrique un id de rôle au format utilisé par cette classe de rôle.
-     * 
-     * @param \Application\Entity\Db\TypeRole $typeRole
-     * @param \Application\Entity\Db\Structure $structure
-     * @return string
-     */
-    static public function createRoleId(TypeRole $typeRole, Structure $structure)
-    {
-        return sprintf("%s_%s", $typeRole->getCode(), $structure->getSourceCode());
-    }
-    
-    /**
-     * Get the parent role
-     *
-     * @return string|RoleInterface|null
-     */
-    public function getParent()
-    {
-        return $this->parent;
-    }
-    
-    /**
-     * 
-     * @return TypeRole
-     */
-    public function getTypeRole()
-    {
-        return $this->typeRole;
-    }
-
-    /**
-     * 
-     * @return Structure
-     */
-    public function getStructure()
-    {
-        return $this->structure;
-    }
-
-    /**
-     * 
-     * @param \Application\Entity\Db\TypeRole $typeRole
-     * @return \Application\Provider\Role\DbRole
-     */
-    public function setTypeRole(TypeRole $typeRole)
-    {
-        $this->typeRole = $typeRole;
-        return $this;
-    }
-
-    /**
-     * 
-     * @param \Application\Entity\Db\Structure $structure
-     * @return \Application\Provider\Role\DbRole
-     */
-    public function setStructure(Structure $structure)
-    {
-        $this->structure = $structure;
-        return $this;
-    }
-}
\ No newline at end of file
diff --git a/module/Application/src/Application/Acl/DrhRole.php b/module/Application/src/Application/Acl/DrhRole.php
new file mode 100644
index 0000000000..cf2efd7806
--- /dev/null
+++ b/module/Application/src/Application/Acl/DrhRole.php
@@ -0,0 +1,44 @@
+<?php
+
+namespace Application\Acl;
+
+use UnicaenAuth\Acl\NamedRole;
+use Application\Interfaces\PersonnelAwareInterface;
+use Application\Traits\PersonnelAwareTrait;
+
+/**
+ * Rôle père de tous les rôles "composante".
+ *
+ * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
+ */
+class DrhRole extends NamedRole implements PersonnelAwareInterface
+{
+    use PersonnelAwareTrait;
+
+    const ROLE_ID = 'drh';
+
+    public function __construct($id = self::ROLE_ID, $parent = 'user', $name = 'DRH', $description = null, $selectable = true)
+    {
+        parent::__construct($id, $parent, $name, $description, $selectable);
+    }
+}
+
+class GestionnaireDrhRole extends DrhRole
+{
+    const ROLE_ID = 'gestionnaire-drh';
+
+    public function __construct($id = self::ROLE_ID, $parent = DrhRole::ROLE_ID, $name = 'Gestionnaire DRH', $description = null, $selectable = true)
+    {
+        parent::__construct($id, $parent, $name, $description, $selectable);
+    }
+}
+
+class ResponsableDrhRole extends DrhRole
+{
+    const ROLE_ID = 'responsable-drh';
+
+    public function __construct($id = self::ROLE_ID, $parent = DrhRole::ROLE_ID, $name = 'Responsable DRH', $description = null, $selectable = true)
+    {
+        parent::__construct($id, $parent, $name, $description, $selectable);
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Acl/EtablissementRole.php b/module/Application/src/Application/Acl/EtablissementRole.php
new file mode 100644
index 0000000000..f3e5ee4bbd
--- /dev/null
+++ b/module/Application/src/Application/Acl/EtablissementRole.php
@@ -0,0 +1,35 @@
+<?php
+
+namespace Application\Acl;
+
+use UnicaenAuth\Acl\NamedRole;
+use Application\Interfaces\PersonnelAwareInterface;
+use Application\Traits\PersonnelAwareTrait;
+
+/**
+ * Rôle père de tous les rôles "composante".
+ *
+ * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
+ */
+class EtablissementRole extends NamedRole implements PersonnelAwareInterface
+{
+    use PersonnelAwareTrait;
+
+    const ROLE_ID = 'etablissement';
+
+    public function __construct($id = self::ROLE_ID, $parent = 'user', $name = 'Établissement', $description = null, $selectable = true)
+    {
+        parent::__construct($id, $parent, $name, $description, $selectable);
+    }
+
+}
+
+class SuperviseurEtablissementRole extends EtablissementRole
+{
+    const ROLE_ID = 'superviseur-etablissement';
+
+    public function __construct($id = self::ROLE_ID, $parent = EtablissementRole::ROLE_ID, $name = 'Superviseur établissement', $description = null, $selectable = true)
+    {
+        parent::__construct($id, $parent, $name, $description, $selectable);
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Acl/IntervenantExterieurRole.php b/module/Application/src/Application/Acl/IntervenantExterieurRole.php
deleted file mode 100644
index 0b153e1a08..0000000000
--- a/module/Application/src/Application/Acl/IntervenantExterieurRole.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-namespace Application\Acl;
-
-use UnicaenAuth\Acl\NamedRole;
-
-/**
- * Rôle correspondant à un intervenant vacataire.
- *
- * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
- */
-class IntervenantExterieurRole extends IntervenantRole
-{
-    const ROLE_ID = "intervenant-exterieur";
-    
-    /**
-     * Constructeur.
-     * 
-     * @param string|null               $id
-     * @param RoleInterface|string|null $parent
-     * @param string                    $name
-     * @param string                    $description
-     * @param bool                      $selectable
-     */
-    public function __construct($id = null, $parent = null, $name = null, $description = null, $selectable = true)
-    {
-        NamedRole::__construct(
-                $id = static::ROLE_ID, 
-                $parent = IntervenantRole::ROLE_ID, 
-                $name = "Intervenant vacataire", 
-                $description, 
-                $selectable);
-    }
-}
\ No newline at end of file
diff --git a/module/Application/src/Application/Acl/IntervenantPermanentRole.php b/module/Application/src/Application/Acl/IntervenantPermanentRole.php
deleted file mode 100644
index b1552ba424..0000000000
--- a/module/Application/src/Application/Acl/IntervenantPermanentRole.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-namespace Application\Acl;
-
-use UnicaenAuth\Acl\NamedRole;
-
-/**
- * Rôle correspondant à un intervenant permanent.
- *
- * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
- */
-class IntervenantPermanentRole extends IntervenantRole
-{
-    const ROLE_ID = "intervenant-permanent";
-    
-    /**
-     * Constructeur.
-     * 
-     * @param string|null               $id
-     * @param RoleInterface|string|null $parent
-     * @param string                    $name
-     * @param string                    $description
-     * @param bool                      $selectable
-     */
-    public function __construct($id = null, $parent = null, $name = null, $description = null, $selectable = true)
-    {
-        NamedRole::__construct(
-                $id = static::ROLE_ID, 
-                $parent = IntervenantRole::ROLE_ID, 
-                $name = "Intervenant permanent", 
-                $description, 
-                $selectable);
-    }
-}
\ No newline at end of file
diff --git a/module/Application/src/Application/Acl/IntervenantRole.php b/module/Application/src/Application/Acl/IntervenantRole.php
index bf064d1df0..b5bd2027ed 100644
--- a/module/Application/src/Application/Acl/IntervenantRole.php
+++ b/module/Application/src/Application/Acl/IntervenantRole.php
@@ -3,57 +3,50 @@
 namespace Application\Acl;
 
 use UnicaenAuth\Acl\NamedRole;
+use Application\Interfaces\StructureAwareInterface;
+use Application\Interfaces\IntervenantAwareInterface;
+use Application\Traits\IntervenantAwareTrait;
+use Application\Traits\StructureAwareTrait;
 
 /**
  * Description of IntervenantRole
  *
  * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
  */
-class IntervenantRole extends NamedRole
+class IntervenantRole extends NamedRole implements StructureAwareInterface, IntervenantAwareInterface
 {
+    use StructureAwareTrait;
+    use IntervenantAwareTrait;
+
     const ROLE_ID = "intervenant";
-    
-    /**
-     * @var \Application\Entity\Db\Intervenant
-     */
-    protected $intervenant;
-    
-    /**
-     * Constructeur.
-     * 
-     * @param string|null               $id
-     * @param RoleInterface|string|null $parent
-     * @param string                    $name
-     * @param string                    $description
-     * @param bool                      $selectable
-     */
-    public function __construct($id = null, $parent = null, $name = null, $description = null, $selectable = true)
+
+    public function __construct($id = self::ROLE_ID, $parent = 'user', $name = 'Intervenant', $description = null, $selectable = true)
     {
-        NamedRole::__construct(
-                $id = static::ROLE_ID, 
-                $parent = 'user', 
-                $name = "Intervenant", 
-                $description, 
-                $selectable);
+        parent::__construct($id, $parent, $name, $description, $selectable);
     }
-    
-    /**
-     * 
-     * @return \Application\Entity\Db\Intervenant
-     */
-    public function getIntervenant()
+}
+
+
+
+class IntervenantPermanentRole extends IntervenantRole
+{
+    const ROLE_ID = "intervenant-permanent";
+
+    public function __construct($id = self::ROLE_ID, $parent = IntervenantRole::ROLE_ID, $name = "Intervenant permanent", $description = null, $selectable = true)
     {
-        return $this->intervenant;
+        parent::__construct($id, $parent, $name, $description, $selectable);
     }
+}
+
+
+
+class IntervenantExterieurRole extends IntervenantRole
+{
+    const ROLE_ID = "intervenant-exterieur";
+    protected $parent = IntervenantRole::ROLE_ID;
 
-    /**
-     * 
-     * @param \Application\Entity\Db\Intervenant $intervenant
-     * @return \Application\Acl\IntervenantRole
-     */
-    public function setIntervenant(\Application\Entity\Db\Intervenant $intervenant = null)
+    public function __construct($id = self::ROLE_ID, $parent = IntervenantRole::ROLE_ID, $name = "Intervenant vacataire", $description = null, $selectable = true)
     {
-        $this->intervenant = $intervenant;
-        return $this;
+        parent::__construct($id, $parent, $name, $description, $selectable);
     }
 }
\ No newline at end of file
diff --git a/module/Application/src/Application/Controller/OffreFormationController.php b/module/Application/src/Application/Controller/OffreFormationController.php
index 84324f76ff..b0c293fc81 100644
--- a/module/Application/src/Application/Controller/OffreFormationController.php
+++ b/module/Application/src/Application/Controller/OffreFormationController.php
@@ -48,7 +48,7 @@ class OffreFormationController extends AbstractActionController implements Conte
         $etape     = $this->context()->etapeFromQuery();
         if ($niveau) $niveau = \Application\Entity\NiveauEtape::getInstance($niveau); // entité Niveau
         // structure de responsabilité si aucun filtre spécifié
-        if (!$structure && $role instanceof \Application\Acl\DbRole) {
+        if (!$structure && $role instanceof \Application\Acl\Role) {
             $structure = $role->getStructure();
         }
         
@@ -144,7 +144,7 @@ class OffreFormationController extends AbstractActionController implements Conte
         $etape     = $this->context()->etapeFromQuery();
         if ($niveau) $niveau = \Application\Entity\NiveauEtape::getInstance($niveau); // entité Niveau
         // structure de responsabilité si aucun filtre spécifié
-        if (!$structure && $role instanceof \Application\Acl\DbRole) {
+        if (!$structure && $role instanceof \Application\Acl\Role) {
             $structure = $role->getStructure();
         }
 
diff --git a/module/Application/src/Application/Controller/ServiceReferentielController.php b/module/Application/src/Application/Controller/ServiceReferentielController.php
index 955ffba035..aa0b95b503 100644
--- a/module/Application/src/Application/Controller/ServiceReferentielController.php
+++ b/module/Application/src/Application/Controller/ServiceReferentielController.php
@@ -191,7 +191,7 @@ class ServiceReferentielController extends AbstractActionController implements C
             $intervenant = $role->getIntervenant();
         }
         
-        if ($role instanceof \Application\Acl\DbRole) {
+        if ($role instanceof \Application\Acl\Role) {
             // récupère l'éventuel intervenant du contexte local
             $intervenant = $context->getIntervenant();
         }
diff --git a/module/Application/src/Application/Entity/Db/Finder/FinderIntervenantPermanentWithServiceReferentiel.php b/module/Application/src/Application/Entity/Db/Finder/FinderIntervenantPermanentWithServiceReferentiel.php
index 1db9d08058..96d4bdff5f 100644
--- a/module/Application/src/Application/Entity/Db/Finder/FinderIntervenantPermanentWithServiceReferentiel.php
+++ b/module/Application/src/Application/Entity/Db/Finder/FinderIntervenantPermanentWithServiceReferentiel.php
@@ -2,7 +2,7 @@
 
 namespace Application\Entity\Db\Finder;
 
-use Application\Acl\DbRole;
+use Application\Acl\Role;
 use Application\Acl\IntervenantRole;
 use Application\Entity\Db\IntervenantPermanent;
 
@@ -57,7 +57,7 @@ class FinderIntervenantPermanentWithServiceReferentiel extends AbstractFinder
 //                    ->andWhere("sr.intervenant = :intervenant")
 //                    ->setParameter('intervenant', $context->getIntervenant());
         }
-        elseif ($role instanceof DbRole) {
+        elseif ($role instanceof Role) {
             $or = $this->expr()->orX(
                     "sr.structure       = :structureResp", 
                     "stmp.structureNiv2 = :structureResp"
diff --git a/module/Application/src/Application/Entity/Db/Finder/FinderServiceReferentiel.php b/module/Application/src/Application/Entity/Db/Finder/FinderServiceReferentiel.php
index c2a08fe655..ff1fe48612 100644
--- a/module/Application/src/Application/Entity/Db/Finder/FinderServiceReferentiel.php
+++ b/module/Application/src/Application/Entity/Db/Finder/FinderServiceReferentiel.php
@@ -2,7 +2,7 @@
 
 namespace Application\Entity\Db\Finder;
 
-use Application\Acl\DbRole;
+use Application\Acl\Role;
 use Application\Acl\IntervenantRole;
 
 /**
@@ -35,7 +35,7 @@ class FinderServiceReferentiel extends AbstractFinder
                     ->andWhere("sr.intervenant = :intervenant")
                     ->setParameter('intervenant', $context->getIntervenant());
         }
-        elseif ($role instanceof DbRole) {
+        elseif ($role instanceof Role) {
             $e = $this->expr()->orX(
                     "sr.structure     = :structureResp", 
                     "s2.structureNiv2 = :structureResp"
diff --git a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Validation.dcm.xml b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Validation.dcm.xml
index c0021a72c5..8983d18918 100644
--- a/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Validation.dcm.xml
+++ b/module/Application/src/Application/Entity/Db/Mapping/Application.Entity.Db.Validation.dcm.xml
@@ -11,8 +11,6 @@
     <id name="id" type="integer" column="ID">
       <generator strategy="SEQUENCE"/>
     </id>
-    <field name="dateConseilAcademique" type="datetime" column="DATE_COMMISSION_RECHERCHE" nullable="true"/>
-    <field name="dateConseilRestreint" type="datetime" column="DATE_CONSEIL_RESTREINT" nullable="true"/>
     <field name="histoCreation" type="datetime" column="HISTO_CREATION" nullable="false"/>
     <field name="histoDestruction" type="datetime" column="HISTO_DESTRUCTION" nullable="true"/>
     <field name="histoModification" type="datetime" column="HISTO_MODIFICATION" nullable="false"/>
diff --git a/module/Application/src/Application/Entity/Db/Role.php b/module/Application/src/Application/Entity/Db/Role.php
index eac296d5c5..39770a77fb 100644
--- a/module/Application/src/Application/Entity/Db/Role.php
+++ b/module/Application/src/Application/Entity/Db/Role.php
@@ -2,12 +2,10 @@
 
 namespace Application\Entity\Db;
 
-use Doctrine\ORM\Mapping as ORM;
-
 /**
  * Role
  */
-class Role
+class Role implements HistoriqueAwareInterface
 {
     /**
      * @var \DateTime
diff --git a/module/Application/src/Application/Entity/Db/RoleUtilisateur.php b/module/Application/src/Application/Entity/Db/RoleUtilisateur.php
index 65447ab4ef..e84d1712ca 100644
--- a/module/Application/src/Application/Entity/Db/RoleUtilisateur.php
+++ b/module/Application/src/Application/Entity/Db/RoleUtilisateur.php
@@ -5,10 +5,9 @@ namespace Application\Entity\Db;
 /**
  * RoleUtilisateur
  */
-class RoleUtilisateur implements \BjyAuthorize\Acl\HierarchicalRoleInterface
+class RoleUtilisateur
 {
-    const ROLE_ID_ADMIN = 'Administrateur'; // idem table ROLE_UTILISATEUR
-    
+
     /**
      * @var integer
      */
diff --git a/module/Application/src/Application/Entity/Db/TypeRole.php b/module/Application/src/Application/Entity/Db/TypeRole.php
index 6cdfd92304..37c6a19fc3 100644
--- a/module/Application/src/Application/Entity/Db/TypeRole.php
+++ b/module/Application/src/Application/Entity/Db/TypeRole.php
@@ -44,7 +44,7 @@ class TypeRole implements HistoriqueAwareInterface, RoleInterface
     protected $role;
 
     /**
-     * 
+     *
      */
     public function __construct()
     {
@@ -205,4 +205,4 @@ class TypeRole implements HistoriqueAwareInterface, RoleInterface
     {
         return $this->role;
     }
-}
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Entity/Db/VRolePersonnel.php b/module/Application/src/Application/Entity/Db/VRolePersonnel.php
deleted file mode 100644
index 2614b7b828..0000000000
--- a/module/Application/src/Application/Entity/Db/VRolePersonnel.php
+++ /dev/null
@@ -1,99 +0,0 @@
-<?php
-
-namespace Application\Entity\Db;
-
-/**
- * VRolePersonnel
- */
-class VRolePersonnel
-{
-    /**
-     * @var integer
-     */
-    protected $id;
-
-    /**
-     * @var \Application\Entity\Db\Role
-     */
-    protected $role;
-
-    /**
-     * @var \Application\Entity\Db\Structure
-     */
-    protected $structure;
-
-    /**
-     * @var \Application\Entity\Db\TypeRole
-     */
-    protected $typeRole;
-
-    /**
-     * @var \Application\Entity\Db\Personnel
-     */
-    protected $personnel;
-
-    /**
-     * @var string
-     */
-    protected $phpRoleId;
-
-    /**
-     * Get id
-     *
-     * @return integer 
-     */
-    public function getId()
-    {
-        return $this->id;
-    }
-
-    /**
-     * Get role
-     *
-     * @return \Application\Entity\Db\Role 
-     */
-    public function getRole()
-    {
-        return $this->role;
-    }
-
-    /**
-     * Get structure
-     *
-     * @return \Application\Entity\Db\Structure 
-     */
-    public function getStructure()
-    {
-        return $this->structure;
-    }
-
-    /**
-     * Get typeRole
-     *
-     * @return \Application\Entity\Db\TypeRoleVRolePersonnel 
-     */
-    public function getTypeRole()
-    {
-        return $this->typeRole;
-    }
-
-    /**
-     * Get personnel
-     *
-     * @return \Application\Entity\Db\Personnel 
-     */
-    public function getPersonnel()
-    {
-        return $this->personnel;
-    }
-
-    /**
-     * Get phpRoleId
-     *
-     * @return string 
-     */
-    public function getPhpRoleId()
-    {
-        return $this->phpRoleId;
-    }
-}
diff --git a/module/Application/src/Application/Form/VolumeHoraire/Saisie.php b/module/Application/src/Application/Form/VolumeHoraire/Saisie.php
index c5492da0f3..c33ba731f6 100644
--- a/module/Application/src/Application/Form/VolumeHoraire/Saisie.php
+++ b/module/Application/src/Application/Form/VolumeHoraire/Saisie.php
@@ -48,7 +48,7 @@ class Saisie extends Form implements InputFilterProviderInterface, ServiceLocato
         ));
 
         $role = $this->getContextProvider()->getSelectedIdentityRole();
-        if ($role instanceof \Application\Acl\DbRole) {
+        if ($role instanceof \Application\Acl\Role) {
 
             $this->add(array(
                 'name' => 'motif-non-paiement',
diff --git a/module/Application/src/Application/Interfaces/IntervenantAwareInterface.php b/module/Application/src/Application/Interfaces/IntervenantAwareInterface.php
new file mode 100644
index 0000000000..5d9d3acd44
--- /dev/null
+++ b/module/Application/src/Application/Interfaces/IntervenantAwareInterface.php
@@ -0,0 +1,28 @@
+<?php
+
+namespace Application\Interfaces;
+
+use Application\Entity\Db\Intervenant;
+
+/**
+ *
+ * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
+ */
+interface IntervenantAwareInterface
+{
+    
+    /**
+     * Spécifie l'intervenant concerné.
+     * 
+     * @param Intervenant $intervenant Intervenant concerné
+     * @return self
+     */
+    public function setIntervenant(Intervenant $intervenant);
+    
+    /**
+     * Retourne l'intervenant concerné.
+     * 
+     * @return Intervenant
+     */
+    public function getIntervenant();
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Interfaces/PersonnelAwareInterface.php b/module/Application/src/Application/Interfaces/PersonnelAwareInterface.php
new file mode 100644
index 0000000000..9de3b7206d
--- /dev/null
+++ b/module/Application/src/Application/Interfaces/PersonnelAwareInterface.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Application\Interfaces;
+
+use Application\Entity\Db\Personnel;
+
+/**
+ *
+ * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
+ */
+interface PersonnelAwareInterface
+{
+
+    /**
+     * Spécifie le personnel concerné.
+     *
+     * @param Personnel $personnel Personnel concerné
+     */
+    public function setPersonnel(Personnel $personnel = null);
+
+    /**
+     * Retourne le personnel concerné.
+     *
+     * @return Personnel
+     */
+    public function getPersonnel();
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Interfaces/StructureAwareInterface.php b/module/Application/src/Application/Interfaces/StructureAwareInterface.php
new file mode 100644
index 0000000000..2ba6cc25fd
--- /dev/null
+++ b/module/Application/src/Application/Interfaces/StructureAwareInterface.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Application\Interfaces;
+
+use Application\Entity\Db\Structure;
+
+/**
+ *
+ * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
+ */
+interface StructureAwareInterface
+{
+    
+    /**
+     * Spécifie la structure concernée.
+     * 
+     * @param Structure $structure Structure concernée
+     */
+    public function setStructure(Structure $structure = null);
+    
+    /**
+     * Retourne la structure concernée.
+     * 
+     * @return Structure
+     */
+    public function getStructure();
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Interfaces/TypeRoleAwareInterface.php b/module/Application/src/Application/Interfaces/TypeRoleAwareInterface.php
new file mode 100644
index 0000000000..8315ad3604
--- /dev/null
+++ b/module/Application/src/Application/Interfaces/TypeRoleAwareInterface.php
@@ -0,0 +1,27 @@
+<?php
+
+namespace Application\Interfaces;
+
+use Application\Entity\Db\TypeRole;
+
+/**
+ *
+ * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
+ */
+interface TypeRoleAwareInterface
+{
+
+    /**
+     * Spécifie le type de rôle concerné.
+     *
+     * @param TypeRole $typeRole Type de rôle concernée
+     */
+    public function setTypeRole(TypeRole $typeRole = null);
+
+    /**
+     * Retourne le type de rôle concerné.
+     *
+     * @return TypeRole
+     */
+    public function getTypeRole();
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Provider/Identity/IdentityProvider.php b/module/Application/src/Application/Provider/Identity/IdentityProvider.php
index 9f663bd4fa..3ce19d530b 100644
--- a/module/Application/src/Application/Provider/Identity/IdentityProvider.php
+++ b/module/Application/src/Application/Provider/Identity/IdentityProvider.php
@@ -1,16 +1,12 @@
 <?php
 namespace Application\Provider\Identity;
 
-use Application\Acl\DbRole;
-use Application\Acl\IntervenantExterieurRole;
-use Application\Acl\IntervenantPermanentRole;
-use Application\Acl\IntervenantRole;
+use Application\Acl;
 use Application\Entity\Db\IntervenantExterieur;
 use Application\Entity\Db\IntervenantPermanent;
 use Application\Entity\Db\Role;
 use Application\Entity\Db\Utilisateur;
 use Common\Exception\RuntimeException;
-use Doctrine\ORM\EntityManager;
 use UnicaenApp\Service\EntityManagerAwareInterface;
 use UnicaenApp\Service\EntityManagerAwareTrait;
 use UnicaenAuth\Provider\Identity\ChainableProvider;
@@ -28,23 +24,17 @@ class IdentityProvider implements ServiceLocatorAwareInterface, ChainableProvide
 {
     use ServiceLocatorAwareTrait;
     use EntityManagerAwareTrait;
-    
+
     /**
      * @var array
      */
     protected $roles;
-    
-    /**
-     * Constructeur.
-     * 
-     * @param EntityManager $entityManager
-     */
-    public function __construct(EntityManager $entityManager)
+
+    public function init()
     {
-        $this->setEntityManager($entityManager);
         $this->getEntityManager()->getFilters()->enable('historique');
     }
-    
+
     /**
      * {@inheritDoc}
      */
@@ -52,103 +42,104 @@ class IdentityProvider implements ServiceLocatorAwareInterface, ChainableProvide
     {
         $event->addRoles($this->getIdentityRoles());
     }
-    
+
     /**
      * {@inheritDoc}
      */
     public function getIdentityRoles()
     {
         if (null === $this->roles) {
-            $this->roles = array();
-            
+            $this->roles = [];
+
             if (!$this->getServiceLocator()->get('AuthUserContext')->getIdentity()) {
                 return $this->roles;
             }
-            
+
             /**
              * Rôles que possède l'utilisateur dans la base de données.
              */
             $this->roles = array_merge($this->roles, $this->getDbRoles());
-            
+
             /**
              * Rôle correspondant au type d'intervenant auquel appartient l'utilisateur
              */
-            $this->roles[] = $this->getIntervenantRole();
+            $intervenantRole = $this->getIntervenantRole();
+            if ($intervenantRole){
+                $this->roles[] = $intervenantRole;
+            }
+
         }
-        
-//        var_dump($this->roles);
-        
+
+        //var_dump($this->roles);
+
         return $this->roles;
     }
-    
+
     /**
      * Fetch dans la base de données les rôles que possède l'utilisateur sur une structure précise.
-     * 
+     *
      * @return array Id des rôles trouvés
      */
     protected function getDbRoles()
     {
         $utilisateur = $this->getDbUser();
-        $roles       = array();
-        
+        $roles       = [];
+
         if (!$utilisateur) {
             return $roles;
         }
-        
-        /**
-         * Rôles utilisateurs au sein de l'application (tables UTILISATEUR, ROLE_UTILISATEUR et ROLE_UTILISATEUR_LINKER)
-         */
-        foreach ($utilisateur->getRoleUtilisateur() as $roleUtilisateur) { /* @var $roleUtilisateur \Application\Entity\Db\RoleUtilisateur */
-            $roles[] = $roleUtilisateur->getRoleId();
-        }
-        
+
         /**
          * Responsabilités métier importées (tables ROLE et TYPE_ROLE)
          */
         if ($utilisateur->getPersonnel()) {
             foreach ($utilisateur->getPersonnel()->getRole() as $role) { /* @var $role Role */
-                $roles[] = DbRole::createRoleId($role->getType(), $role->getStructure()); // le role id suffit, pas besoin d'instance
+                $roleId = $role->getType()->getCode();
+                if ($structure = $role->getStructure()){
+                    $roleId .= '-'.$structure->getSourceCode();
+                }
+                $roles[] = $roleId;
             }
         }
-        
+
         return $roles;
     }
-    
+
     /**
      * Retourne le rôle correspondant au type d'intervenant auquel appartient l'utilisateur.
-     * 
-     * @return RoleInterface
+     *
+     * @return RoleInterface|null
      */
     protected function getIntervenantRole()
     {
         $utilisateur = $this->getDbUser();
-        
+
         if (!$utilisateur) {
-            return array();
+            return null;
         }
-        
+
         $intervenant = $utilisateur->getIntervenant();
-        
+
         if (!$intervenant) {
-            return IntervenantRole::ROLE_ID;
+            return Acl\IntervenantRole::ROLE_ID;
         }
-        
+
         if ($intervenant instanceof IntervenantPermanent) {
-            $role = IntervenantPermanentRole::ROLE_ID;
+            $role = Acl\IntervenantPermanentRole::ROLE_ID;
         }
         elseif ($intervenant instanceof IntervenantExterieur) {
-            $role = IntervenantExterieurRole::ROLE_ID;
+            $role = Acl\IntervenantExterieurRole::ROLE_ID;
         }
         else {
             throw new RuntimeException("Type d'intervenant inattendu : " . get_class($intervenant));
         }
-        
+
         return $role;
     }
-    
+
     /**
      * Retourne l'utilisateur connecté.
-     * 
+     *
      * @return Utilisateur
      */
     private function getDbUser()
diff --git a/module/Application/src/Application/Provider/Identity/IdentityProviderFactory.php b/module/Application/src/Application/Provider/Identity/IdentityProviderFactory.php
index 12b1e9f1fa..f06c977d89 100644
--- a/module/Application/src/Application/Provider/Identity/IdentityProviderFactory.php
+++ b/module/Application/src/Application/Provider/Identity/IdentityProviderFactory.php
@@ -22,6 +22,9 @@ class IdentityProviderFactory implements FactoryInterface
     {
         $em = $serviceLocator->get('doctrine.entitymanager.orm_default'); /* @var $em \Doctrine\ORM\EntityManager */
         
-        return new IdentityProvider($em);
+        $identityProvider = new IdentityProvider;
+        $identityProvider->setEntityManager($em);
+        $identityProvider->init();
+        return $identityProvider;
     }
 }
\ No newline at end of file
diff --git a/module/Application/src/Application/Provider/Role/RoleProvider.php b/module/Application/src/Application/Provider/Role/RoleProvider.php
index d61cfd774e..b879ac884d 100644
--- a/module/Application/src/Application/Provider/Role/RoleProvider.php
+++ b/module/Application/src/Application/Provider/Role/RoleProvider.php
@@ -3,147 +3,84 @@
 namespace Application\Provider\Role;
 
 use BjyAuthorize\Provider\Role\ProviderInterface;
-use Application\Acl\IntervenantRole;
-use Application\Acl\IntervenantPermanentRole;
-use Application\Acl\IntervenantExterieurRole;
-use Application\Acl\DbRole;
-use Application\Acl\ComposanteRole;
-use Application\Acl\ComposanteDbRole;
-use Application\Entity\Db\Role as RoleEntity;
-use Application\Service\Role as RoleService;
-use Application\Service\RoleUtilisateur as RoleUtilisateurService;
-use Zend\Permissions\Acl\Role\GenericRole;
+use UnicaenApp\Service\EntityManagerAwareInterface;
+use UnicaenApp\Service\EntityManagerAwareTrait;
+use Application\Interfaces\StructureAwareInterface;
 
 /**
  * Fournisseur des rôles utilisateurs de l'application :
- * - ceux définis dans la table TYPE_ROLE ;
- * - rôle "intervenant".
- * 
- * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
+ * - ceux définis dans la configuration du fournisseur
+ *
+ *  * @author Bertrand GAUTHIER <bertrand.gauthier at unicaen.fr>
  */
-class RoleProvider implements ProviderInterface
+class RoleProvider implements ProviderInterface, EntityManagerAwareInterface
 {
+    use EntityManagerAwareTrait;
+
     /**
      * @var array
      */
-    protected $config = array();
-    
+    protected $config = [];
+
     /**
      * @var array
      */
     protected $roles;
-    
+
     /**
      * Constructeur.
-     * 
-     * @param RoleService $serviceRole
-     * @param RoleUtilisateurService $serviceRoleUtilisateur
      * @param array $config
      */
-    public function __construct(
-            RoleService $serviceRole, 
-            RoleUtilisateurService $serviceRoleUtilisateur, 
-            $config = null)
+    public function __construct( $config = [] )
     {
-        $this
-                ->setServiceRole($serviceRole)
-                ->setServiceRoleUtilisateur($serviceRoleUtilisateur);
-        
         $this->config = $config;
     }
-    
+
+    public function init()
+    {
+        $this->getEntityManager()->getFilters()->enable('historique');
+    }
+
     /**
      * @return \Zend\Permissions\Acl\Role\RoleInterface[]
-     * @see \Application\Entity\Db\TypeRole
      */
     public function getRoles()
     {
-        if (null === $this->roles) {            
-            /**
-             * Rôles "intervenant"
-             */
-            $roleIntervenant          = new IntervenantRole();
-            $roleIntervenantPermanent = new IntervenantPermanentRole();
-            $roleIntervenantExterieur = new IntervenantExterieurRole();
-            
-            /**
-             * Rôles "composante" : exercés sur une structure de niveau 2 PORTEUSE d'éléments pédagogiques
-             */
-            // rôle père
-            $roleComposante = new ComposanteRole();
-            // rôles métier (importés d'Harpege) correspondant au ROLE_ID PHP
-            $qb = $this->serviceRole->finderRolePersonnelByRole($roleComposante->getRoleId());
-            $rolesComposante = array();
-            foreach ($qb->getQuery()->getResult() as $vrp) { /* @var $vrp \Application\Entity\Db\VRolePersonnel */
-                $rolesComposante[] = $vrp->getRole();
-            }
+        if (null === $this->roles) {
+            $this->roles = array();
 
-            /**
-             * Rôles utilisateurs au sein de l'application (tables UTILISATEUR, ROLE_UTILISATEUR et ROLE_UTILISATEUR_LINKER)
-             */
-            $rolesAppli = $this->serviceRoleUtilisateur->getList();
-            
-            /**
-             * Collecte des rôles
-             */
-            $roles = array();
-            $roles[$roleIntervenant->getRoleId()]          = $roleIntervenant;
-            $roles[$roleIntervenantPermanent->getRoleId()] = $roleIntervenantPermanent;
-            $roles[$roleIntervenantExterieur->getRoleId()] = $roleIntervenantExterieur;
-            $roles[$roleComposante->getRoleId()]           = $roleComposante;
-            foreach ($rolesComposante as $r) { /* @var $r \Application\Entity\Db\Role */
-                $role = new ComposanteDbRole($r->getType(), $r->getStructure(), $roleComposante);
-                $roles[$role->getRoleId()] = $role;
-            }
-            foreach ($rolesAppli as $r) { /* @var $r \Application\Entity\Db\RoleUtilisateur */
-                $role = new \UnicaenAuth\Acl\NamedRole($r->getRoleId());
-                $roles[$role->getRoleId()] = $role;
+            // Chargement des rôles de base
+            foreach( $this->config as $classname ){
+                if (class_exists( $classname )){
+                    $role = new $classname; /* @var $role \Zend\Permissions\Acl\Role\RoleInterface */
+                    $this->roles[$role->getRoleId()] = $role;
+                }else{
+                    throw new \UnicaenApp\Exception\LogicException('La classe "'.$classname.'" déclarée dans la configuration du fournisseur de rôles n\'a pas été trouvée.');
+                }
             }
-            
-            $this->roles = $roles;
+
+            // chargement des rôles métiers
+            $qb = $this->getEntityManager()->createQueryBuilder()
+                ->from("Application\Entity\Db\Role", "r")
+                ->select("r, tr, s")
+                ->distinct()
+                ->join("r.type", "tr")
+                ->leftJoin("r.structure", "s");
+            foreach ($qb->getQuery()->getResult() as $role) { /* @var $role \Application\Entity\Db\Role */
+                $roleId = $role->getType()->getCode();
+                if (! isset($this->roles[$roleId])){
+                    throw new Exception('Le rôle "'.$roleId.'" est inconnu.');
+                }
+                $classname = get_class($this->roles[$roleId]);
+                if ($this->roles[$roleId] instanceof StructureAwareInterface && $role->getStructure()){
+                    $roleId .= '-'.$role->getStructure()->getSourceCode();
+                    $this->roles[$roleId] = new $classname($roleId);
+                    $this->roles[$roleId]->setStructure( $role->getStructure() );
+                }else{
+                    $this->roles[$roleId] = new $classname($roleId);
+                }
+           }
         }
-        
-//        var_dump(array_keys($this->roles));
-        
         return $this->roles;
     }
-    
-    /**
-     * 
-     * @param \Application\Entity\Db\Role $roleEntity
-     * @return \Zend\Permissions\Acl\Role\GenericRole
-     */
-    public function getRoleFromRoleEntity(RoleEntity $roleEntity)
-    {
-        $roles  = $this->getRoles();
-        $roleId = DbRole::createRoleId($roleEntity->getType(), $roleEntity->getStructure());
-        
-        if (isset($roles[$roleId])) {
-            return $roles[$roleId];
-        }
-        
-        return new GenericRole($roleId);
-    }
-    
-    /**
-     * @var RoleService
-     */
-    private $serviceRole;
-    
-    /**
-     * @var RoleUtilisateurService
-     */
-    private $serviceRoleUtilisateur;
-    
-    public function setServiceRole(RoleService $serviceRole)
-    {
-        $this->serviceRole = $serviceRole;
-        return $this;
-    }
-
-    public function setServiceRoleUtilisateur(RoleUtilisateurService $serviceRoleUtilisateur)
-    {
-        $this->serviceRoleUtilisateur = $serviceRoleUtilisateur;
-        return $this;
-    }
 }
\ No newline at end of file
diff --git a/module/Application/src/Application/Provider/Role/RoleProviderFactory.php b/module/Application/src/Application/Provider/Role/RoleProviderFactory.php
index 323e1f232b..f27b89b918 100644
--- a/module/Application/src/Application/Provider/Role/RoleProviderFactory.php
+++ b/module/Application/src/Application/Provider/Role/RoleProviderFactory.php
@@ -21,9 +21,8 @@ class RoleProviderFactory implements FactoryInterface
      */
     public function createService(ServiceLocatorInterface $serviceLocator)
     {
-        $serviceRole            = $serviceLocator->get('applicationRole');            /* @var $serviceRole \Application\Service\Role */
-        $serviceUtilisateurRole = $serviceLocator->get('applicationRoleUtilisateur'); /* @var $serviceUtilisateurRole \Application\Service\RoleUtilisateur */
         $config                 = $serviceLocator->get('BjyAuthorize\Config');
+        $em                     = $serviceLocator->get('doctrine.entitymanager.orm_default'); /* @var $em \Doctrine\ORM\EntityManager */
 
         if (! isset($config['role_providers']['ApplicationRoleProvider'])) {
             throw new InvalidArgumentException(
@@ -32,7 +31,10 @@ class RoleProviderFactory implements FactoryInterface
         }
 
         $providerConfig = $config['role_providers']['ApplicationRoleProvider'];
-        
-        return new RoleProvider($serviceRole, $serviceUtilisateurRole, $providerConfig);
+
+        $roleProvider = new RoleProvider( $providerConfig );
+        $roleProvider->setEntityManager($em);
+        $roleProvider->init();
+        return $roleProvider;
     }
 }
\ No newline at end of file
diff --git a/module/Application/src/Application/Service/ContextProvider.php b/module/Application/src/Application/Service/ContextProvider.php
index 4f590904bb..c2cc3826bf 100644
--- a/module/Application/src/Application/Service/ContextProvider.php
+++ b/module/Application/src/Application/Service/ContextProvider.php
@@ -4,7 +4,9 @@ namespace Application\Service;
 
 use Application\Service\Parametres;
 use Application\Acl\IntervenantRole;
-use Application\Acl\DbRole;
+use Application\Interfaces\IntervenantAwareInterface;
+use Application\Interfaces\PersonnelAwareInterface;
+use Application\Acl\Role;
 
 /**
  * Service fournissant les différents contextes de fonctionnement de l'application.
@@ -93,16 +95,19 @@ class ContextProvider extends AbstractService
     
     /**
      * 
-     * @return DbRole|IntervenantRole
+     * @return Role|IntervenantRole
      */
     public function getSelectedIdentityRole()
     {
         if (null === $this->selectedIdentityRole) {
             $this->selectedIdentityRole = $this->getServiceLocator()->get('AuthUserContext')->getSelectedIdentityRole();
             
-            if ($this->selectedIdentityRole instanceof IntervenantRole) {
+            if ($this->selectedIdentityRole instanceof IntervenantAwareInterface) {
                 $this->selectedIdentityRole->setIntervenant($this->getGlobalContext()->getIntervenant());
             }
+            if ($this->selectedIdentityRole instanceof PersonnelAwareInterface){
+                $this->selectedIdentityRole->setPersonnel($this->getGlobalContext()->getPersonnel());
+            }
         }
         
         return $this->selectedIdentityRole;
diff --git a/module/Application/src/Application/Service/ElementPedagogique.php b/module/Application/src/Application/Service/ElementPedagogique.php
index 14545537c8..0f627bf90c 100644
--- a/module/Application/src/Application/Service/ElementPedagogique.php
+++ b/module/Application/src/Application/Service/ElementPedagogique.php
@@ -251,21 +251,19 @@ EOS;
     {
         $localContext = $this->getContextProvider()->getLocalContext();
         $role         = $this->getServiceLocator()->get('ApplicationContextProvider')->getSelectedIdentityRole();
-        
-        if ($role instanceof \Application\Acl\DbRole) { 
-            if (!$localContext->getStructure()) {
-                throw new \Common\Exception\LogicException("Le filtre structure est requis dans la méthode " . __METHOD__);
-            }
-            if ($localContext->getStructure()->getId() === $role->getStructure()->getId()
-                    || $localContext->getStructure()->estFilleDeLaStructureDeNiv2($role->getStructure())) {
-                return true;
-            }
-            
-            $this->cannotDoThat(
-                    "Votre structure de responsabilité ('{$role->getStructure()}') ne vous permet pas d'ajouter/modifier un enseignement"
-                    . "pour la structure '{$localContext->getStructure()}'", $runEx);
+
+        if (!$localContext->getStructure()) {
+            throw new \Common\Exception\LogicException("Le filtre structure est requis dans la méthode " . __METHOD__);
+        }
+        if ($localContext->getStructure()->getId() === $role->getStructure()->getId()
+                || $localContext->getStructure()->estFilleDeLaStructureDeNiv2($role->getStructure())) {
+            return true;
         }
 
+        $this->cannotDoThat(
+                "Votre structure de responsabilité ('{$role->getStructure()}') ne vous permet pas d'ajouter/modifier un enseignement"
+                . "pour la structure '{$localContext->getStructure()}'", $runEx);
+
         return $this->cannotDoThat('Vous n\'avez pas les droits nécessaires pour ajouter/modifier un enseignement', $runEx);
     }
 
diff --git a/module/Application/src/Application/Service/Etape.php b/module/Application/src/Application/Service/Etape.php
index 09c2e7bf7e..ae5c968487 100644
--- a/module/Application/src/Application/Service/Etape.php
+++ b/module/Application/src/Application/Service/Etape.php
@@ -107,19 +107,17 @@ class Etape extends AbstractEntityService
         $localContext = $this->getContextProvider()->getLocalContext();
         $role         = $this->getServiceLocator()->get('ApplicationContextProvider')->getSelectedIdentityRole();
 
-        if ($role instanceof \Application\Acl\DbRole) { 
-            if (!$localContext->getStructure()) {
-                throw new \Common\Exception\LogicException("Le filtre structure est requis dans la méthode " . __METHOD__);
-            }
-            if ($localContext->getStructure()->getId() === $role->getStructure()->getId()
-                    || $localContext->getStructure()->estFilleDeLaStructureDeNiv2($role->getStructure())) {
-                return true;
-            }
-            
-            $this->cannotDoThat(
-                    "Votre structure de responsabilité ('{$role->getStructure()}') ne vous permet pas d'ajouter/modifier de formation"
-                    . "pour la structure '{$localContext->getStructure()}'", $runEx);
+        if (!$localContext->getStructure()) {
+            throw new \Common\Exception\LogicException("Le filtre structure est requis dans la méthode " . __METHOD__);
         }
+        if ($localContext->getStructure()->getId() === $role->getStructure()->getId()
+                || $localContext->getStructure()->estFilleDeLaStructureDeNiv2($role->getStructure())) {
+            return true;
+        }
+
+        $this->cannotDoThat(
+                "Votre structure de responsabilité ('{$role->getStructure()}') ne vous permet pas d'ajouter/modifier de formation"
+                . "pour la structure '{$localContext->getStructure()}'", $runEx);
 
         return $this->cannotDoThat('Vous n\'avez pas les droits nécessaires pour ajouter ou modifier une formation', $runEx);
     }
@@ -173,7 +171,7 @@ class Etape extends AbstractEntityService
             if ($etape->getStructure() != $ir->getStructure()){
                 return $this->cannotDoThat('Vous n\'avez pas les autorisations nécessaires pour éditer les modulateurs de cette structure', $runEx);
             }
-        }elseif($ir instanceof \Application\Acl\DbRole){
+        }elseif($ir instanceof \Application\Acl\Role){
             return $this->cannotDoThat('Vous n\'êtes pas autorisé à éditer de modulateurs', $runEx);
         }elseif($ir instanceof \Application\Acl\IntervenantRole){
             return $this->cannotDoThat('Les intervenants n\'ont pas la possibilité d\'ajouter de modulateur', $runEx);
diff --git a/module/Application/src/Application/Service/Role.php b/module/Application/src/Application/Service/Role.php
index dcf2a5df0f..af78dd62ef 100644
--- a/module/Application/src/Application/Service/Role.php
+++ b/module/Application/src/Application/Service/Role.php
@@ -69,50 +69,4 @@ class Role extends AbstractEntityService
         
         return $qb;
     }
-    
-    /**
-     * Retourne une liste d'entités en fonction du QueryBuilder donné
-     *
-     * La liste de présente sous la forme d'un tableau associatif, dont les clés sont les ID des entités et les valeurs les entités elles-mêmes
-     *
-     * @param QueryBuilder|null $qb
-     * @param string|null $alias
-     * @return array
-     */
-    public function getList(QueryBuilder $qb=null, $alias=null )
-    {
-        list($qb, $alias) = $this->initQuery($qb, $alias);
-        
-        $qb
-                ->addSelect("tr987, s12")
-                ->distinct()
-                ->innerJoin('r.type', 'tr987')
-                ->innerJoin('r.structure', 's12')
-                ->andWhere('tr987.code <> :codeExclu')->setParameter('codeExclu', 'IND')/*
-                ->andWhere('s.niveau = :niv')->setParameter('niv', 2)*/;
-        
-        return parent::getList($qb);
-    }
-    
-    /**
-     * @param \Zend\Permissions\Acl\Role\RoleInterface|string $role
-     * @return QueryBuilder
-     */
-    public function finderRolePersonnelByRole($role)
-    {
-        if ($role instanceof \Zend\Permissions\Acl\Role\RoleInterface) {
-            $role = $role->getRoleId();
-        }
-        
-        $qb = $this->getEntityManager()->createQueryBuilder()
-                ->from("Application\Entity\Db\VRolePersonnel", "v")
-                ->select("v, tr, s, p")
-                ->join("v.typeRole", "tr")
-                ->join("v.structure", "s")
-                ->join("v.personnel", "p")
-                ->orderBy("v.structure, v.typeRole")
-                ->andWhere("v.phpRoleId = :roleId")->setParameter('roleId', $role);
-        
-        return $qb;
-    }
 }
\ No newline at end of file
diff --git a/module/Application/src/Application/Service/RoleUtilisateur.php b/module/Application/src/Application/Service/RoleUtilisateur.php
deleted file mode 100644
index 3693266fd6..0000000000
--- a/module/Application/src/Application/Service/RoleUtilisateur.php
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-
-namespace Application\Service;
-
-use Doctrine\ORM\QueryBuilder;
-
-/**
- * Description of RoleUtilisateur
- *
- * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
- */
-class RoleUtilisateur extends AbstractEntityService
-{
-    /**
-     * retourne la classe des entités
-     *
-     * @return string
-     * @throws RuntimeException
-     */
-    public function getEntityClass()
-    {
-        return 'Application\Entity\Db\RoleUtilisateur';
-    }
-
-    /**
-     * Retourne l'alias d'entité courante
-     *
-     * @return string
-     */
-    public function getAlias()
-    {
-        return 'ru';
-    }
-
-    /**
-     * Retourne la liste des périodes d'enseignement
-     *
-     * @param QueryBuilder|null $queryBuilder
-     * @return QueryBuilder
-     */
-    public function finderByUtilisateur(\Application\Entity\Db\Utilisateur $utilisateur, QueryBuilder $qb = null, $alias = null)
-    {
-        list($qb, $alias) = $this->initQuery($qb, $alias);
-        $qb->andWhere("$alias.utilisateur = :utilisateur")->setParameter('utilisateur', $utilisateur);
-        return $qb;
-    }
-}
\ No newline at end of file
diff --git a/module/Application/src/Application/Service/Service.php b/module/Application/src/Application/Service/Service.php
index 8ca9d40670..d5c6cd7d7a 100644
--- a/module/Application/src/Application/Service/Service.php
+++ b/module/Application/src/Application/Service/Service.php
@@ -148,7 +148,7 @@ class Service extends AbstractEntityService
         if ($role instanceof \Application\Acl\IntervenantRole){ // Si c'est un intervenant
             $this->finderByIntervenant( $context->getIntervenant(), $qb, $alias );
         }
-        elseif ($role instanceof \Application\Acl\DbRole){ // Si c'est un RA
+        elseif ($role instanceof \Application\Acl\ComposanteRole){ // Si c'est un RA
 //            $this->finderByStructureEns( $role->getStructure(), $qb, $alias );
 //            $this->finderByStructureResp( $role->getStructure(), $qb, $alias );
         }
diff --git a/module/Application/src/Application/Service/Structure.php b/module/Application/src/Application/Service/Structure.php
index 6bdf6e5286..a0c767238d 100644
--- a/module/Application/src/Application/Service/Structure.php
+++ b/module/Application/src/Application/Service/Structure.php
@@ -70,13 +70,13 @@ class Structure extends AbstractEntityService
     /**
      * Retourne la liste des structures pour lesquelles le rôle est autorisé à officier
      *
-     * @param \Application\Acl\DbRole $role
+     * @param \Application\Acl\Role $role
      */
     public function finderByRole( $role, QueryBuilder $qb=null, $alias=null)
     {
         list($qb,$alias) = $this->initQuery($qb, $alias);
 
-        if (! $role instanceof \Application\Acl\DbRole) return $qb;
+        if (! $role instanceof \Application\Acl\Role) return $qb;
         $this->finderByStructure( $role->getStructure(), $qb, $alias );
         
         return $qb;
diff --git a/module/Application/src/Application/Service/TypeRole.php b/module/Application/src/Application/Service/TypeRole.php
new file mode 100644
index 0000000000..c673bc0b60
--- /dev/null
+++ b/module/Application/src/Application/Service/TypeRole.php
@@ -0,0 +1,33 @@
+<?php
+
+namespace Application\Service;
+
+use Doctrine\ORM\QueryBuilder;
+
+/**
+ * Description of TypeRole
+ *
+ * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
+ */
+class TypeRole extends AbstractEntityService
+{
+    /**
+     * retourne la classe des entités
+     *
+     * @return string
+     */
+    public function getEntityClass()
+    {
+        return 'Application\Entity\Db\TypeRole';
+    }
+
+    /**
+     * Retourne l'alias d'entité courante
+     *
+     * @return string
+     */
+    public function getAlias()
+    {
+        return 'tr';
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Service/TypeRolePhpRole.php b/module/Application/src/Application/Service/TypeRolePhpRole.php
deleted file mode 100644
index 662ea0fdf2..0000000000
--- a/module/Application/src/Application/Service/TypeRolePhpRole.php
+++ /dev/null
@@ -1,100 +0,0 @@
-<?php
-
-namespace Application\Service;
-
-use Doctrine\ORM\QueryBuilder;
-
-/**
- * Description of TypeRolePhpRole
- *
- * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
- */
-class TypeRolePhpRole extends AbstractEntityService
-{
-    /**
-     * retourne la classe des entités
-     *
-     * @return string
-     * @throws RuntimeException
-     */
-    public function getEntityClass()
-    {
-        return 'Application\Entity\Db\TypeRolePhpRole';
-    }
-
-    /**
-     * Retourne l'alias d'entité courante
-     *
-     * @return string
-     */
-    public function getAlias()
-    {
-        return 'trpr';
-    }
-    
-    /**
-     * 
-     * @param \Application\Entity\Db\TypeRole|string $typeRole
-     * @param QueryBuilder $qb
-     * @param string $alias
-     * @return QueryBuilder
-     */
-    public function finderByTypeRole($typeRole, QueryBuilder $qb = null, $alias = null)
-    {
-        list($qb, $alias) = $this->initQuery($qb, $alias);
-        
-        if ($typeRole instanceof \Application\Entity\Db\TypeRole) {
-            $typeRole = $typeRole->getCode();
-        }
-        
-        $qb
-                ->innerJoin("$alias.typeRole", $trAlias = uniqid('tr'))
-                ->andWhere("$trAlias.code = :code")->setParameter('code', $typeRole);
-        
-        return $qb;
-    }
-    
-    /**
-     * 
-     * @param \Zend\Permissions\Acl\Role\RoleInterface|string $phpRole
-     * @param QueryBuilder $qb
-     * @param string $alias
-     * @return QueryBuilder
-     */
-    public function finderByPhpRole($phpRole, QueryBuilder $qb = null, $alias = null)
-    {
-        list($qb, $alias) = $this->initQuery($qb, $alias);
-        
-        if ($phpRole instanceof \Zend\Permissions\Acl\Role\RoleInterface) {
-            $phpRole = $phpRole->getRoleId();
-        }
-        
-        $qb
-                ->distinct()
-                ->andWhere("$alias.phpRoleId = :roleId")->setParameter('roleId', $phpRole);
-        
-        return $qb;
-    }
-    
-    /**
-     * Retourne une liste d'entités en fonction du QueryBuilder donné
-     *
-     * La liste de présente sous la forme d'un tableau associatif, dont les clés sont les ID des entités et les valeurs les entités elles-mêmes
-     *
-     * @param QueryBuilder|null $qb
-     * @param string|null $alias
-     * @return array
-     */
-//    public function getList(QueryBuilder $qb=null, $alias=null )
-//    {
-//        list($qb, $alias) = $this->initQuery($qb, $alias);
-//        
-//        $qb
-//                ->addSelect("tr, s")
-//                ->distinct()
-//                ->innerJoin('r.typeRole', $trAlias = uniqid('tr'))
-//                ->andWhere("$trAlias.code <> :codeExclu")->setParameter('codeExclu', 'IND');
-//        
-//        return parent::getList($qb);
-//    }
-}
\ No newline at end of file
diff --git a/module/Application/src/Application/Traits/PersonnelAwareTrait.php b/module/Application/src/Application/Traits/PersonnelAwareTrait.php
new file mode 100644
index 0000000000..e415bb3516
--- /dev/null
+++ b/module/Application/src/Application/Traits/PersonnelAwareTrait.php
@@ -0,0 +1,40 @@
+<?php
+
+namespace Application\Traits;
+
+use Application\Entity\Db\Personnel;
+
+/**
+ * Description of PersonnelAwareTrait
+ *
+ * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
+ */
+trait PersonnelAwareTrait
+{
+    /**
+     * @var Personnel
+     */
+    protected $personnel;
+
+    /**
+     * Spécifie le personnel concerné.
+     *
+     * @param Personnel $personnel Personnel concerné
+     */
+    public function setPersonnel(Personnel $personnel = null)
+    {
+        $this->personnel = $personnel;
+
+        return $this;
+    }
+
+    /**
+     * Retourne le personnel concerné.
+     *
+     * @return Personnel
+     */
+    public function getPersonnel()
+    {
+        return $this->personnel;
+    }
+}
\ No newline at end of file
diff --git a/module/Application/src/Application/Traits/TypeRoleAwareTrait.php b/module/Application/src/Application/Traits/TypeRoleAwareTrait.php
new file mode 100644
index 0000000000..212b8bedf6
--- /dev/null
+++ b/module/Application/src/Application/Traits/TypeRoleAwareTrait.php
@@ -0,0 +1,40 @@
+<?php
+
+namespace Application\Traits;
+
+use Application\Entity\Db\TypeRole;
+
+/**
+ * Description of TypeRoleAwareTrait
+ *
+ * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
+ */
+trait TypeRoleAwareTrait
+{
+    /**
+     * @var TypeRole
+     */
+    protected $typeRole;
+
+    /**
+     * Spécifie le type de rôle concerné.
+     *
+     * @param TypeRole $typeRole Type de rôle concerné
+     */
+    public function setTypeRole(TypeRole $typeRole = null)
+    {
+        $this->typeRole = $typeRole;
+
+        return $this;
+    }
+
+    /**
+     * Retourne le type de rôle concerné.
+     *
+     * @return TypeRole
+     */
+    public function getTypeRole()
+    {
+        return $this->typeRole;
+    }
+}
\ No newline at end of file
diff --git a/module/Application/view/application/service/index.phtml b/module/Application/view/application/service/index.phtml
index 026bdfbe30..8d831f8a61 100644
--- a/module/Application/view/application/service/index.phtml
+++ b/module/Application/view/application/service/index.phtml
@@ -12,7 +12,7 @@
     th.heures, td.heures { width: 3em !important; }
 </style>
 
-<?php if ($role instanceof \Application\Acl\DbRole): ?>
+<?php if ($role instanceof \Application\Acl\Role): ?>
 <?php echo $this->messenger()->setMessages(array('warning' => "Sont visibles ici les référentiels et les enseignements prévisionnels des intervenants affectés "
         . "ou enseignant dans votre structure de responsabilité ({$role->getStructure()}) ou l'une de ses sous-structures.")); ?>
 <?php endif; ?>
diff --git a/module/Import/config/module.config.php b/module/Import/config/module.config.php
index e1910829ba..6e1e032f31 100644
--- a/module/Import/config/module.config.php
+++ b/module/Import/config/module.config.php
@@ -2,12 +2,6 @@
 
 namespace Import;
 
-/**
- * @todo Impossible de faire le use ci-dessous!
- */
-//use Application\Entity\Db\RoleUtilisateur;
-const ROLE_ID_ADMIN = 'Administrateur';
-
 return array(
     'controllers' => array(
         'invokables' => array(
@@ -73,7 +67,7 @@ return array(
                 array(
                     'controller' => 'Import\Controller\Import',
                     'action' => array('index','updateViewsAndPackages','showImportTbl','showDiff','update','updateTables'),
-                    'roles' => array(ROLE_ID_ADMIN),
+                    'roles' => array('administrateur'),
                 ),
             ),
         ),
-- 
GitLab