Commit 5accddf2 authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Ajout d'une méthode (facultative) init aux assertions

parent 42b83cb0
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw
    {
        $this->setAcl($acl);
        $this->setRole($role);
        $this->init();
        switch (true) {
            case $this->detectPrivilege($resource):

@@ -92,6 +93,19 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw



    /**
     * @param string|ResourceInterface $resource
     * @param string                   $privilege
     *
     * @return bool
     */
    public function isAllowed($resource, $privilege = null)
    {
        return $this->getServiceAuthorize()->isAllowed($resource, $privilege);
    }



    /**
     * @return Acl
     */
@@ -190,6 +204,16 @@ abstract class AbstractAssertion implements AssertionInterface, ServiceLocatorAw



    /**
     * Ititialisation des paramètres de l'assertion (si nécessaire)
     */
    public function init()
    {

    }



    /**
     * @param string $controller
     * @param string $action