Commit e32e2493 authored by David Surville's avatar David Surville
Browse files

Merge zf-3.x

parents 2d285705 5ca3ac88
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+2 −0
Changes for .gitignore: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
.idea
vendor
 No newline at end of file
+9 −9
Changes for composer.json: 9 added lines, 9 removed lines.
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": {
+56 −2
Changes for config/module.config.php: 56 added lines, 2 removed lines.
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' => [
@@ -16,12 +30,52 @@ return array(
        'factories' => [
            'Ldap'                      => LdapFactory::class,
            'LdapOptions'               => ModuleOptionsFactory::class,

            'LdapServiceGeneric'        => GenericServiceFactory::class,
            'LdapServiceGroup'          => GroupServiceFactory::class,
            'LdapServicePeople'         => PeopleServiceFactory::class,
            '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,
            ],
        ],
    ],
);
+1 −1
Changes for src/UnicaenLdap/Entity/Group.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -68,7 +68,7 @@ class Group extends Entity
    public function getPeople($orderBy = null)
    {
        /* @var $people \UnicaenLdap\Service\People */
        $people = $this->getService()->getServiceLocator()->get('ldapServicePeople');
        $people = $this->getService()->getLdapServiceForEntityClass(\UnicaenLdap\Service\People::class);

        /** @var People[] $result */
        $result = $people->getAllBy($this->get('member'), 'dn', $orderBy);
+24 −6
Changes for src/UnicaenLdap/Entity/People.php: 24 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ class People extends BasePeople
     */
    public function getGroups(DateTime $dateObservation = null, $orderBy = null)
    {
        $group = $this->getService()->getServiceLocator()->get('ldapServiceGroup');
        $group = $this->getService()->getLdapServiceForEntityClass(\UnicaenLdap\Service\Group::class);

        return $group->filterValids($group->getAllBy($this->get('memberOf'), 'dn', $orderBy), $dateObservation);
    }
@@ -138,6 +138,24 @@ class People extends BasePeople
        return 0 === strpos($this->uid, 'i');
    }

    /**
     * @var \UnicaenLdap\Service\Structure
     */
    protected $ldapStructureService;

    /**
     * @return \UnicaenLdap\Service\Structure
     */
    protected function getLdapStructureService()
    {
        if (null === $this->ldapStructureService) {
            $this->ldapStructureService =
                $this->getService()->getLdapServiceForEntityClass(\UnicaenLdap\Service\Structure::class);
        }

        return $this->ldapStructureService;
    }

    /**
     * Retourne les structures auxquelles appartiennent la personne
     *
@@ -145,7 +163,7 @@ class People extends BasePeople
     */
    public function getEduPersonOrgUnit()
    {
        $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure');
        $structure = $this->getLdapStructureService();
        $dn = $this->eduPersonOrgUnitDN;
        if (empty($dn)) return null;

@@ -159,7 +177,7 @@ class People extends BasePeople
     */
    public function getEduPersonPrimaryOrgUnit()
    {
        $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure');
        $structure = $this->getLdapStructureService();
        $dn = $this->eduPersonPrimaryOrgUnitDN;
        if (empty($dn)) return null;

@@ -176,7 +194,7 @@ class People extends BasePeople
    public function getEntiteAffectation()
    {
        throw new \Exception('Méthode pas finie');
        $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure');
        $structure = $this->getLdapStructureService();
        $codes = $this->getNode()->getAttribute('supannEntiteAffectation');
        var_dump($codes);

@@ -193,7 +211,7 @@ class People extends BasePeople
    public function getEntiteAffectationPrincipale()
    {
        throw new \Exception('Méthode pas finie');
        $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure');
        $structure = $this->getLdapStructureService();

        $codes = [];
        $affectations = $this->getNode()->getAttribute('supannAffectation');
@@ -216,7 +234,7 @@ class People extends BasePeople
    public function getAffectationDescription()
    {
        throw new \Exception('Méthode pas finie');
        $structure = $this->getService()->getServiceLocator()->get('ldapServiceStructure');
        $structure = $this->getLdapStructureService();

        list($code, $description) = explode(';', $this->supannAffectation);
        $code = $this->supannAffectation;
Loading