Commit 4ff9f7b4 authored by David Surville's avatar David Surville
Browse files

[Fix] Suppression Périmètre "Structure" pour test

parent e01d2629
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ abstract class AbstractPerimetreAssertion extends AbstractAssertion
            });
    }

    protected function assertPerimetre(string $type, $resource) : bool
    public final function assertPerimetre(string $type, $resource) : bool
    {
        /** @var UserInterface $user */
        $user = $this->serviceUserContext->getDbUser();
@@ -178,4 +178,13 @@ abstract class AbstractPerimetreAssertion extends AbstractAssertion
    {
        return true;
    }

    /**
     * @param PerimetreInterface $perimetre
     * @return bool
     */
    protected function assertPerimetreOther(PerimetreInterface $perimetre) : bool
    {
        return true;
    }
}
 No newline at end of file
+0 −49
Original line number Diff line number Diff line
<?php

namespace UnicaenPrivilege\Assertion\Perimetre;

use UnicaenPrivilege\Assertion\Perimetre\AbstractPerimetreAssertion;
use UnicaenPrivilege\Entity\Db\PerimetreCategorie;
use UnicaenPrivilege\Entity\Db\PerimetreInterface;
use Zend\Permissions\Acl\Resource\ResourceInterface;

class StructurePerimetreAssertion extends AbstractPerimetreAssertion
{
    protected function getPerimetres() : array
    {
        return [PerimetreCategorie::STRUCTURE];
    }

    protected function getMode(): string
    {
        return parent::MODE_ALL;
    }

    protected function assertPerimetreController(PerimetreInterface $perimetre) : bool
    {
        switch ($perimetre->getCategorie()->getCode()) {
            case 'structure':
                switch ($perimetre->getCode()) {
                    case 'all':
                        return true;
                    case 'c68':
                    default:
                        return false;
                }
        }
    }

    protected function assertPerimetreEntity(PerimetreInterface $perimetre, ResourceInterface $resource) : bool
    {
        switch ($perimetre->getCategorie()->getCode()) {
            case 'structure':
                switch ($perimetre->getCode()) {
                    case 'all':
                        return true;
                    case 'c68':
                    default:
                        return false;
                }
        }
    }
}
 No newline at end of file
+1 −4
Original line number Diff line number Diff line
@@ -2,7 +2,4 @@

namespace UnicaenPrivilege\Entity\Db;

class PerimetreCategorie extends AbstractPerimetreCategorie
{
    const STRUCTURE = 'structure';
}
 No newline at end of file
class PerimetreCategorie extends AbstractPerimetreCategorie {}
 No newline at end of file