Commit 68575131 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Merge branch 'release-2.1.1'

parents b4b34b54 b633f366
Loading
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -277,8 +277,9 @@ class TheseController extends AbstractController
        $role = $this->userContextService->getSelectedIdentityRole();
        $user = $this->userContextService->getIdentityDb();

        $codeRole = $role ? $role->getCode() : null;
        $theses = [];
        switch ($role->getCode()) {
        switch ($codeRole) {
            case Role::CODE_DOCTORANT :
                $theses = $this->getTheseService()->getRepository()->findTheseByDoctorant($user->getIndividu());
                break;
+12 −5
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ use Application\Service\UserContextServiceAwareTrait;
use Application\Service\Utilisateur\UtilisateurService;
use Application\Service\Utilisateur\UtilisateurServiceAwareTrait;
use Application\SourceCodeStringHelperAwareTrait;
use Doctrine\ORM\Query\Expr;
use UnicaenApp\Exception\LogicException;
use UnicaenApp\Exception\RuntimeException;
use UnicaenApp\Service\EntityManagerAwareTrait;
@@ -109,6 +110,7 @@ class UtilisateurController extends \UnicaenAuth\Controller\UtilisateurControlle
     */
    public function indexAction()
    {
        /** @var Individu $individu */
        $individu = null;
        $roles = null;

@@ -126,13 +128,18 @@ class UtilisateurController extends \UnicaenAuth\Controller\UtilisateurControlle
        $rolesAffectes = [];
        if ($individuId !== null) {
            $individu = $this->individuService->getRepository()->find($individuId);
            $rolesAffectes = $this->roleService->getRepository()->findAllByIndividu($individu);
            $rolesAffectes = $individu->getRoles();
        }

        $roles = $this->roleService->getRoles();
        $etablissements = $this->getStructureService()->getAllStructuresAffichablesByType(TypeStructure::CODE_ETABLISSEMENT, 'libelle');
        $unites = $this->getStructureService()->getAllStructuresAffichablesByType(TypeStructure::CODE_UNITE_RECHERCHE, 'libelle');
        $ecoles = $this->getStructureService()->getAllStructuresAffichablesByType(TypeStructure::CODE_ECOLE_DOCTORALE, 'libelle');
        $roles = $this->roleService->findAllRoles();

        // établissements : pour l'instant les rôles ne concernent que des établissements d'inscription donc on flitre
        $etablissementsQb = $this->structureService->getAllStructuresAffichablesByTypeQb(TypeStructure::CODE_ETABLISSEMENT, 'libelle', true);
        $etablissementsQb->join('structure.etablissement', 'etab', Expr\Join::WITH, 'etab.estInscription = 1');
        $etablissements = $etablissementsQb->getQuery()->execute();

        $unites = $this->structureService->getAllStructuresAffichablesByType(TypeStructure::CODE_UNITE_RECHERCHE, 'libelle', true, true);
        $ecoles = $this->structureService->getAllStructuresAffichablesByType(TypeStructure::CODE_ECOLE_DOCTORALE, 'libelle', true, true);

        return new ViewModel([
            'individu' => $individu,
+36 −0
Original line number Diff line number Diff line
@@ -93,6 +93,11 @@ class Individu implements HistoriqueAwareInterface, SourceAwareInterface
     */
    private $id;

    /**
     * @var ArrayCollection
     */
    private $roles;

    /**
     * @var ArrayCollection (mailContact)
     */
@@ -108,6 +113,7 @@ class Individu implements HistoriqueAwareInterface, SourceAwareInterface
     */
    public function __construct()
    {
        $this->roles = new ArrayCollection();
        $this->mailsConfirmations = new ArrayCollection();
        $this->utilisateurs = new ArrayCollection();
    }
@@ -492,6 +498,36 @@ class Individu implements HistoriqueAwareInterface, SourceAwareInterface
        return $this->id;
    }

    /**
     * @return Role[]
     */
    public function getRoles()
    {
        return $this->roles->toArray();
    }

    /**
     * @param Role $role
     * @return self
     */
    public function addRole(Role $role)
    {
        $this->roles->add($role);

        return $this;
    }

    /**
     * @param Role $role
     * @return self
     */
    public function removeRole(Role $role)
    {
        $this->roles->removeElement($role);

        return $this;
    }

    /** @return string */
    public function getMailContact()
    {
+12 −0
Original line number Diff line number Diff line
@@ -21,12 +21,24 @@

        <field name="sourceCode" column="SOURCE_CODE" nullable="true"/>

        <many-to-many field="roles" target-entity="Application\Entity\Db\Role">
            <join-table name="INDIVIDU_ROLE">
                <join-columns>
                    <join-column name="INDIVIDU_ID" referenced-column-name="ID" />
                </join-columns>
                <inverse-join-columns>
                    <join-column name="ROLE_ID" referenced-column-name="ID" unique="true" />
                </inverse-join-columns>
            </join-table>
        </many-to-many>

        <one-to-many target-entity="Application\Entity\Db\MailConfirmation" mapped-by="individu" field="mailsConfirmations"/>
        <one-to-many target-entity="Application\Entity\Db\Utilisateur" mapped-by="individu" field="utilisateurs"/>

        <field name="histoCreation" type="datetime" column="HISTO_CREATION"/>
        <field name="histoDestruction" type="datetime" column="HISTO_DESTRUCTION" nullable="true"/>
        <field name="histoModification" type="datetime" column="HISTO_MODIFICATION"/>

        <many-to-one field="source" target-entity="Application\Entity\Db\Source">
            <join-columns>
                <join-column name="SOURCE_ID" referenced-column-name="ID"/>
+4 −0
Original line number Diff line number Diff line
@@ -78,6 +78,10 @@ class RoleRepository extends DefaultEntityRepository
        return $role;
    }

    /**
     * @param $individu
     * @return Role[]
     */
    public function findAllByIndividu($individu)
    {
        $qb = $this->getEntityManager()->getRepository(IndividuRole::class)->createQueryBuilder("ir")
Loading