Commit 0482d4d4 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Merge branch 'zf-3.x'

parents 78275982 2dca4963
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+2 −0
Original line number Diff line number Diff line
.idea
vendor
 No newline at end of file
+9 −9
Original line number Diff line number Diff line
@@ -3,17 +3,17 @@
  "description": "Module Ldap des applications Unicaen",
  "require": {
    "php":                                  "^5.6 || ^7.0",
    "zendframework/zend-servicemanager":    "~2.4 || ^2.7",
    "zendframework/zend-modulemanager":     "~2.4 || ^2.7",
    "zendframework/zend-config":            "~2.4 || ^2.7",
    "zendframework/zend-serializer":        "~2.4 || ^2.7",
    "zendframework/zend-log":               "~2.4 || ^2.7",
    "zendframework/zend-i18n":              "~2.4 || ^2.7",
    "zendframework/zend-stdlib":            "~2.4 || ^2.7",
    "zendframework/zend-ldap":              "~2.4 || ^2.7"
    "zendframework/zend-config":            "^3.2",
    "zendframework/zend-i18n":              "^2.9",
    "zendframework/zend-ldap":              "^2.10",
    "zendframework/zend-log":               "^2.10",
    "zendframework/zend-modulemanager":     "^2.8",
    "zendframework/zend-serializer":        "^2.9",
    "zendframework/zend-servicemanager":    "^3.4",
    "zendframework/zend-stdlib":            "^3.2"
  },
  "require-dev": {
    "phpunit/PHPUnit": ">=3.7",
    "phpunit/phpunit":         ">=3.7",
    "zendframework/zend-test": ">=2.2"
  },
  "autoload": {
+58 −1
Original line number Diff line number Diff line
<?php

use UnicaenLdap\LdapFactory;
namespace UnicaenLdap;

use UnicaenLdap\Entity\Generic;
use UnicaenLdap\Entity\Group;
use UnicaenLdap\Entity\People;
use UnicaenLdap\Entity\Structure;
use UnicaenLdap\Entity\System;
use UnicaenLdap\Options\ModuleOptionsFactory;
use UnicaenLdap\Service\Generic as LdapGenericService;
use UnicaenLdap\Service\GenericFactory as GenericServiceFactory;
use UnicaenLdap\Service\Group as LdapGroupService;
use UnicaenLdap\Service\GroupFactory as GroupServiceFactory;
use UnicaenLdap\Service\People as LdapPeopleService;
use UnicaenLdap\Service\PeopleFactory as PeopleServiceFactory;
use UnicaenLdap\Service\Structure as LdapStructureService;
use UnicaenLdap\Service\StructureFactory as StructureServiceFactory;
use UnicaenLdap\Service\System as LdapSystemService;
use UnicaenLdap\Service\SystemFactory as SystemServiceFactory;
use Zend\ServiceManager\Proxy\LazyServiceFactory;

;;

return array(
    'unicaen-ldap' => [
@@ -23,5 +37,48 @@ return array(
            'LdapServiceStructure' => StructureServiceFactory::class,
            'LdapServiceSystem'    => SystemServiceFactory::class,
        ],
        'aliases' => [
            'ldap'                 => 'Ldap',
            'ldapOptions'          => 'LdapOptions',
            'ldapServiceGeneric'   => 'LdapServiceGeneric',
            'ldapServiceGroup'     => 'LdapServiceGroup',
            'ldapServicePeople'    => 'LdapServicePeople',
            'ldapServiceStructure' => 'LdapServiceStructure',
            'ldapServiceSystem'    => 'LdapServiceSystem',
            LdapGenericService::class          =>  'LdapServiceGeneric',
            LdapPeopleService::class           =>  'LdapServicePeople',
            LdapGroupService ::class           =>  'LdapServiceGroup',
            LdapStructureService::class        =>  'LdapServiceStructure',
            LdapSystemService::class           =>  'LdapServiceSystem',
        ],
        'lazy_services' => [
            // Mapping services to their class names is required since the ServiceManager is not a declarative DIC.
            'class_map' => [
                'LdapServicePeople'    => LdapPeopleService::class,
                'LdapServiceGeneric'   => LdapGenericService::class,
                'LdapServiceGroup'     => LdapGroupService::class,
                'LdapServiceStructure' => LdapStructureService::class,
                'LdapServiceSystem'    => LdapSystemService::class,
            ],
        ],
        'delegators' => [
            'LdapServicePeople' => [
                LazyServiceFactory::class,
            ],
            'LdapServiceGeneric' => [
                LazyServiceFactory::class,
            ],
            'LdapServiceGroup' => [
                LazyServiceFactory::class,
            ],
            'LdapServiceStructure' => [
                LazyServiceFactory::class,
            ],
            'LdapServiceSystem' => [
                LazyServiceFactory::class,
            ],

        ],

    ],
);
+3 −3
Original line number Diff line number Diff line
@@ -67,11 +67,11 @@ class Group extends Entity
     */
    public function getPeople($orderBy = null)
    {
        /* @var $people \UnicaenLdap\Service\People */
        $people = $this->getService()->getServiceLocator()->get('ldapServicePeople');
        /* @var $peopleService \UnicaenLdap\Service\People */
        $peopleService = $this->getService()->getLdapPeopleService();

        /** @var People[] $result */
        $result = $people->getAllBy($this->get('member'), 'dn', $orderBy);
        $result = $peopleService->getAllBy($this->get('member'), 'dn', $orderBy);

        return $result;
    }
+16 −15
Original line number Diff line number Diff line
@@ -133,9 +133,9 @@ class People extends Entity
     */
    public function getGroups(DateTime $dateObservation = null, $orderBy = null)
    {
        $group = $this->getService()->getServiceLocator()->get('ldapServiceGroup');
        $groupService = $this->getService()->getLdapGroupService();

        return $group->filterValids($group->getAllBy($this->get('memberOf'), 'dn', $orderBy), $dateObservation);
        return $groupService->filterValids($groupService->getAllBy($this->get('memberOf'), 'dn', $orderBy), $dateObservation);
    }

    /**
@@ -171,46 +171,47 @@ class People extends Entity
    /**
     * Retourne les structures auxquelles appartiennent la personne
     *
     * @return Structure[]
     * @return Entity[]|Structure[]
     */
    public function getEduPersonOrgUnit()
    {
        $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure');
        $structureService = $this->getService()->getLdapStructureService();
        $dn = $this->eduPersonOrgUnitDN;
        if (empty($dn)) return null;

        return $structure->getAllBy($dn, 'dn');
        return $structureService->getAllBy($dn, 'dn');
    }

    /**
     * Retourne la structure principale à laquelle appartient la personne
     *
     * @return Structure
     * @return Entity|Structure
     * @throws \UnicaenLdap\Exception
     */
    public function getEduPersonPrimaryOrgUnit()
    {
        $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure');
        $structureService = $this->getService()->getLdapStructureService();
        $dn = $this->eduPersonPrimaryOrgUnitDN;
        if (empty($dn)) return null;

        return $structure->getBy($dn, 'dn');
        return $structureService->getBy($dn, 'dn');
    }

    /**
     * Retourne la structure d'affectation de la personne
     *
     * @todo à terminer
     * @return Structure[]
     * @return Entity|Structure
     * @throws \Exception
     */
    public function getEntiteAffectation()
    {
        throw new \Exception('Méthode pas finie');
        $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure');
        $structureService = $this->getService()->getLdapStructureService();
        $codes = $this->getNode()->getAttribute('supannEntiteAffectation');
        var_dump($codes);

        return $structure->getBy($dn, 'dn');
        return $structureService->getBy($dn, 'dn');
    }

    /**
@@ -223,7 +224,7 @@ class People extends Entity
    public function getEntiteAffectationPrincipale()
    {
        throw new \Exception('Méthode pas finie');
        $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure');
        $structureService = $this->getService()->getLdapStructureService();

        $codes = [];
        $affectations = $this->getNode()->getAttribute('supannAffectation');
@@ -233,7 +234,7 @@ class People extends Entity
        $code = $this->supannAffectation;
        if (empty($dn)) return null;

        return $structure->getBy($dn, 'dn');
        return $structureService->getBy($dn, 'dn');
    }

    /**
@@ -246,13 +247,13 @@ class People extends Entity
    public function getAffectationDescription()
    {
        throw new \Exception('Méthode pas finie');
        $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure');
        $structureService = $this->getService()->getLdapStructureService();

        list($code, $description) = explode(';', $this->supannAffectation);
        $code = $this->supannAffectation;
        if (empty($dn)) return null;

        return $structure->getBy($dn, 'dn');
        return $structureService->getBy($dn, 'dn');
    }

    /**
Loading