Commit 5accddf2 authored by Laurent Lécluse's avatar Laurent Lécluse
Browse files

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

parent 42b83cb0
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment