summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Schmitt <schmittjoh@gmail.com>2011-04-20 22:35:17 +0200
committerJohannes Schmitt <schmittjoh@gmail.com>2011-04-20 22:35:17 +0200
commit86898e86e1f299df97c06caded3e04939908a436 (patch)
treedaaa2bd8cade4c7e60556f3db689db6ec3dae1cb
parent270d0c2494a7db946fcbb1a834d9cedee07d0a95 (diff)
downloadsymfony-security-86898e86e1f299df97c06caded3e04939908a436.zip
symfony-security-86898e86e1f299df97c06caded3e04939908a436.tar.gz
symfony-security-86898e86e1f299df97c06caded3e04939908a436.tar.bz2
[Security/Acl] some misc fixes
-rw-r--r--Acl/Domain/PermissionGrantingStrategy.php22
-rw-r--r--Acl/Exception/NoAceFoundException.php4
2 files changed, 11 insertions, 15 deletions
diff --git a/Acl/Domain/PermissionGrantingStrategy.php b/Acl/Domain/PermissionGrantingStrategy.php
index 8bee157..37bbe4e 100644
--- a/Acl/Domain/PermissionGrantingStrategy.php
+++ b/Acl/Domain/PermissionGrantingStrategy.php
@@ -30,16 +30,8 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface
const ALL = 'all';
const ANY = 'any';
- private static $noAceException;
private $auditLogger;
- public function __construct()
- {
- if (null === static::$noAceException) {
- static::$noAceException = new NoAceFoundException('No ACE.');
- }
- }
-
/**
* Sets the audit logger
*
@@ -61,7 +53,7 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface
$aces = $acl->getObjectAces();
if (!$aces) {
- throw static::$noAceException;
+ throw new NoAceFoundException();
}
return $this->hasSufficientPermissions($acl, $aces, $masks, $sids, $administrativeMode);
@@ -69,7 +61,7 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface
$aces = $acl->getClassAces();
if (!$aces) {
- throw static::$noAceException;
+ throw $noObjectAce;
}
return $this->hasSufficientPermissions($acl, $aces, $masks, $sids, $administrativeMode);
@@ -79,7 +71,7 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface
return $parentAcl->isGranted($masks, $sids, $administrativeMode);
}
- throw new NoAceFoundException('No applicable ACE was found.');
+ throw $noClassAce;
}
}
@@ -92,14 +84,14 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface
try {
$aces = $acl->getObjectFieldAces($field);
if (!$aces) {
- throw static::$noAceException;
+ throw new NoAceFoundException();
}
return $this->hasSufficientPermissions($acl, $aces, $masks, $sids, $administrativeMode);
} catch (NoAceFoundException $noObjectAces) {
$aces = $acl->getClassFieldAces($field);
if (!$aces) {
- throw static::$noAceException;
+ throw $noObjectAces;
}
return $this->hasSufficientPermissions($acl, $aces, $masks, $sids, $administrativeMode);
@@ -109,7 +101,7 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface
return $parentAcl->isFieldGranted($field, $masks, $sids, $administrativeMode);
}
- throw new NoAceFoundException('No applicable ACE was found.');
+ throw $noClassAces;
}
}
@@ -177,7 +169,7 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface
return false;
}
- throw static::$noAceException;
+ throw new NoAceFoundException();
}
/**
diff --git a/Acl/Exception/NoAceFoundException.php b/Acl/Exception/NoAceFoundException.php
index 0ecad61..994efc0 100644
--- a/Acl/Exception/NoAceFoundException.php
+++ b/Acl/Exception/NoAceFoundException.php
@@ -19,4 +19,8 @@ namespace Symfony\Component\Security\Acl\Exception;
*/
class NoAceFoundException extends Exception
{
+ public function __construct()
+ {
+ parent::__construct('No applicable ACE was found.');
+ }
} \ No newline at end of file