summaryrefslogtreecommitdiffstats
path: root/Acl
diff options
context:
space:
mode:
Diffstat (limited to 'Acl')
-rw-r--r--Acl/Dbal/AclProvider.php44
-rw-r--r--Acl/Dbal/MutableAclProvider.php3
-rw-r--r--Acl/Domain/Acl.php1
-rw-r--r--Acl/Domain/AclCollectionCache.php10
-rw-r--r--Acl/Domain/DoctrineAclCache.php2
-rw-r--r--Acl/Domain/ObjectIdentity.php6
-rw-r--r--Acl/Domain/PermissionGrantingStrategy.php22
-rw-r--r--Acl/Domain/UserSecurityIdentity.php6
-rw-r--r--Acl/Model/AclCacheInterface.php12
-rw-r--r--Acl/Model/AclInterface.php20
-rw-r--r--Acl/Model/AclProviderInterface.php23
-rw-r--r--Acl/Model/AuditLoggerInterface.php2
-rw-r--r--Acl/Model/AuditableAclInterface.php8
-rw-r--r--Acl/Model/AuditableEntryInterface.php4
-rw-r--r--Acl/Model/DomainObjectInterface.php2
-rw-r--r--Acl/Model/EntryInterface.php12
-rw-r--r--Acl/Model/FieldEntryInterface.php2
-rw-r--r--Acl/Model/MutableAclInterface.php31
-rw-r--r--Acl/Model/MutableAclProviderInterface.php6
-rw-r--r--Acl/Model/ObjectIdentityInterface.php6
-rw-r--r--Acl/Model/ObjectIdentityRetrievalStrategyInterface.php2
-rw-r--r--Acl/Model/PermissionGrantingStrategyInterface.php4
-rw-r--r--Acl/Model/SecurityIdentityInterface.php2
-rw-r--r--Acl/Model/SecurityIdentityRetrievalStrategyInterface.php5
-rw-r--r--Acl/Permission/MaskBuilder.php10
-rw-r--r--Acl/Permission/PermissionMapInterface.php4
-rw-r--r--Acl/Resources/bin/generateSql.php9
-rw-r--r--Acl/Voter/AclVoter.php2
28 files changed, 154 insertions, 106 deletions
diff --git a/Acl/Dbal/AclProvider.php b/Acl/Dbal/AclProvider.php
index 8413843..6f47231 100644
--- a/Acl/Dbal/AclProvider.php
+++ b/Acl/Dbal/AclProvider.php
@@ -258,16 +258,40 @@ SELECTCLAUSE;
WHERE (
SELECTCLAUSE;
- $where = '(o.object_identifier = %s AND c.class_type = %s)';
- for ($i=0,$c=count($batch); $i<$c; $i++) {
+ $types = array();
+ $count = count($batch);
+ for ($i = 0; $i < $count; $i++) {
+ if (!isset($types[$batch[$i]->getType()])) {
+ $types[$batch[$i]->getType()] = true;
+ if ($count > 1) {
+ break;
+ }
+ }
+ }
+
+ if (1 === count($types)) {
+ $ids = array();
+ for ($i = 0; $i < $count; $i++) {
+ $ids[] = $this->connection->quote($batch[$i]->getIdentifier());
+ }
+
$sql .= sprintf(
- $where,
- $this->connection->quote($batch[$i]->getIdentifier()),
- $this->connection->quote($batch[$i]->getType())
+ '(o.object_identifier IN (%s) AND c.class_type = %s)',
+ implode(',', $ids),
+ $this->connection->quote($batch[0]->getType())
);
-
- if ($i+1 < $c) {
- $sql .= ' OR ';
+ } else {
+ $where = '(o.object_identifier = %s AND c.class_type = %s)';
+ for ($i = 0; $i < $count; $i++) {
+ $sql .= sprintf(
+ $where,
+ $this->connection->quote($batch[$i]->getIdentifier()),
+ $this->connection->quote($batch[$i]->getType())
+ );
+
+ if ($i+1 < $count) {
+ $sql .= ' OR ';
+ }
}
}
@@ -339,7 +363,7 @@ QUERY;
* @param ObjectIdentityInterface $oid
* @return integer
*/
- protected final function retrieveObjectIdentityPrimaryKey(ObjectIdentityInterface $oid)
+ final protected function retrieveObjectIdentityPrimaryKey(ObjectIdentityInterface $oid)
{
return $this->connection->executeQuery($this->getSelectObjectIdentityIdSql($oid))->fetchColumn();
}
@@ -417,6 +441,8 @@ QUERY;
* @param array $oidLookup
*
* @return \SplObjectStorage mapping object identities to ACL instances
+ *
+ * @throws AclNotFoundException
*/
private function lookupObjectIdentities(array $batch, array $sids, array $oidLookup)
{
diff --git a/Acl/Dbal/MutableAclProvider.php b/Acl/Dbal/MutableAclProvider.php
index 0d46f3a..0ac4fa7 100644
--- a/Acl/Dbal/MutableAclProvider.php
+++ b/Acl/Dbal/MutableAclProvider.php
@@ -17,7 +17,6 @@ use Symfony\Component\Security\Acl\Domain\RoleSecurityIdentity;
use Symfony\Component\Security\Acl\Domain\UserSecurityIdentity;
use Symfony\Component\Security\Acl\Exception\AclAlreadyExistsException;
use Symfony\Component\Security\Acl\Exception\ConcurrentModificationException;
-use Symfony\Component\Security\Acl\Exception\Exception;
use Symfony\Component\Security\Acl\Model\AclCacheInterface;
use Symfony\Component\Security\Acl\Model\AclInterface;
use Symfony\Component\Security\Acl\Model\EntryInterface;
@@ -148,6 +147,8 @@ class MutableAclProvider extends AclProvider implements MutableAclProviderInterf
* @param string $propertyName
* @param mixed $oldValue
* @param mixed $newValue
+ *
+ * @throws \InvalidArgumentException
*/
public function propertyChanged($sender, $propertyName, $oldValue, $newValue)
{
diff --git a/Acl/Domain/Acl.php b/Acl/Domain/Acl.php
index 6d53131..4665c0e 100644
--- a/Acl/Domain/Acl.php
+++ b/Acl/Domain/Acl.php
@@ -19,7 +19,6 @@ use Symfony\Component\Security\Acl\Model\ObjectIdentityInterface;
use Symfony\Component\Security\Acl\Model\PermissionGrantingStrategyInterface;
use Symfony\Component\Security\Acl\Model\SecurityIdentityInterface;
-
/**
* An ACL implementation.
*
diff --git a/Acl/Domain/AclCollectionCache.php b/Acl/Domain/AclCollectionCache.php
index be082c1..d3a4b37 100644
--- a/Acl/Domain/AclCollectionCache.php
+++ b/Acl/Domain/AclCollectionCache.php
@@ -29,9 +29,9 @@ class AclCollectionCache
/**
* Constructor.
*
- * @param AclProviderInterface $aclProvider
- * @param ObjectIdentityRetrievalStrategy $oidRetrievalStrategy
- * @param SecurityIdentityRetrievalStrategy $sidRetrievalStrategy
+ * @param AclProviderInterface $aclProvider
+ * @param ObjectIdentityRetrievalStrategyInterface $oidRetrievalStrategy
+ * @param SecurityIdentityRetrievalStrategyInterface $sidRetrievalStrategy
*/
public function __construct(AclProviderInterface $aclProvider, ObjectIdentityRetrievalStrategyInterface $oidRetrievalStrategy, SecurityIdentityRetrievalStrategyInterface $sidRetrievalStrategy)
{
@@ -44,8 +44,8 @@ class AclCollectionCache
* Batch loads ACLs for an entire collection; thus, it reduces the number
* of required queries considerably.
*
- * @param mixed $collection anything that can be passed to foreach()
- * @param array $tokens an array of TokenInterface implementations
+ * @param mixed $collection anything that can be passed to foreach()
+ * @param TokenInterface[] $tokens an array of TokenInterface implementations
*/
public function cache($collection, array $tokens = array())
{
diff --git a/Acl/Domain/DoctrineAclCache.php b/Acl/Domain/DoctrineAclCache.php
index 731f98c..bfc5452 100644
--- a/Acl/Domain/DoctrineAclCache.php
+++ b/Acl/Domain/DoctrineAclCache.php
@@ -36,6 +36,8 @@ class DoctrineAclCache implements AclCacheInterface
* @param Cache $cache
* @param PermissionGrantingStrategyInterface $permissionGrantingStrategy
* @param string $prefix
+ *
+ * @throws \InvalidArgumentException
*/
public function __construct(Cache $cache, PermissionGrantingStrategyInterface $permissionGrantingStrategy, $prefix = self::PREFIX)
{
diff --git a/Acl/Domain/ObjectIdentity.php b/Acl/Domain/ObjectIdentity.php
index e37e82b..d7d5f84 100644
--- a/Acl/Domain/ObjectIdentity.php
+++ b/Acl/Domain/ObjectIdentity.php
@@ -31,6 +31,8 @@ final class ObjectIdentity implements ObjectIdentityInterface
*
* @param string $identifier
* @param string $type
+ *
+ * @throws \InvalidArgumentException
*/
public function __construct($identifier, $type)
{
@@ -49,10 +51,10 @@ final class ObjectIdentity implements ObjectIdentityInterface
* Constructs an ObjectIdentity for the given domain object
*
* @param object $domainObject
- * @throws \InvalidArgumentException
+ * @throws InvalidDomainObjectException
* @return ObjectIdentity
*/
- static public function fromDomainObject($domainObject)
+ public static function fromDomainObject($domainObject)
{
if (!is_object($domainObject)) {
throw new InvalidDomainObjectException('$domainObject must be an object.');
diff --git a/Acl/Domain/PermissionGrantingStrategy.php b/Acl/Domain/PermissionGrantingStrategy.php
index c34db2a..d505843 100644
--- a/Acl/Domain/PermissionGrantingStrategy.php
+++ b/Acl/Domain/PermissionGrantingStrategy.php
@@ -121,17 +121,18 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface
* permission/identity combination.
*
* This process is repeated until either a granting ACE is found, or no
- * permission/identity combinations are left. In the latter case, we will
- * call this method on the parent ACL if it exists, and isEntriesInheriting
- * is true. Otherwise, we will either throw an NoAceFoundException, or deny
- * access finally.
+ * permission/identity combinations are left. Finally, we will either throw
+ * an NoAceFoundException, or deny access.
+ *
+ * @param AclInterface $acl
+ * @param EntryInterface[] $aces An array of ACE to check against
+ * @param array $masks An array of permission masks
+ * @param SecurityIdentityInterface[] $sids An array of SecurityIdentityInterface implementations
+ * @param Boolean $administrativeMode True turns off audit logging
*
- * @param AclInterface $acl
- * @param array $aces An array of ACE to check against
- * @param array $masks An array of permission masks
- * @param array $sids An array of SecurityIdentityInterface implementations
- * @param Boolean $administrativeMode True turns off audit logging
* @return Boolean true, or false; either granting, or denying access respectively.
+ *
+ * @throws NoAceFoundException
*/
private function hasSufficientPermissions(AclInterface $acl, array $aces, array $masks, array $sids, $administrativeMode)
{
@@ -189,7 +190,10 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface
*
* @param integer $requiredMask
* @param EntryInterface $ace
+ *
* @return Boolean
+ *
+ * @throws \RuntimeException if the ACE strategy is not supported
*/
private function isAceApplicable($requiredMask, EntryInterface $ace)
{
diff --git a/Acl/Domain/UserSecurityIdentity.php b/Acl/Domain/UserSecurityIdentity.php
index 040e43b..3166a1a 100644
--- a/Acl/Domain/UserSecurityIdentity.php
+++ b/Acl/Domain/UserSecurityIdentity.php
@@ -31,6 +31,8 @@ final class UserSecurityIdentity implements SecurityIdentityInterface
*
* @param string $username the username representation
* @param string $class the user's fully qualified class name
+ *
+ * @throws \InvalidArgumentException
*/
public function __construct($username, $class)
{
@@ -51,7 +53,7 @@ final class UserSecurityIdentity implements SecurityIdentityInterface
* @param UserInterface $user
* @return UserSecurityIdentity
*/
- static public function fromAccount(UserInterface $user)
+ public static function fromAccount(UserInterface $user)
{
return new self($user->getUsername(), ClassUtils::getRealClass($user));
}
@@ -62,7 +64,7 @@ final class UserSecurityIdentity implements SecurityIdentityInterface
* @param TokenInterface $token
* @return UserSecurityIdentity
*/
- static public function fromToken(TokenInterface $token)
+ public static function fromToken(TokenInterface $token)
{
$user = $token->getUser();
diff --git a/Acl/Model/AclCacheInterface.php b/Acl/Model/AclCacheInterface.php
index dd515ce..ea9604e 100644
--- a/Acl/Model/AclCacheInterface.php
+++ b/Acl/Model/AclCacheInterface.php
@@ -23,7 +23,7 @@ interface AclCacheInterface
*
* @param string $primaryKey a serialized primary key
*/
- function evictFromCacheById($primaryKey);
+ public function evictFromCacheById($primaryKey);
/**
* Removes an ACL from the cache
@@ -32,7 +32,7 @@ interface AclCacheInterface
*
* @param ObjectIdentityInterface $oid
*/
- function evictFromCacheByIdentity(ObjectIdentityInterface $oid);
+ public function evictFromCacheByIdentity(ObjectIdentityInterface $oid);
/**
* Retrieves an ACL for the given object identity primary key from the cache
@@ -40,7 +40,7 @@ interface AclCacheInterface
* @param integer $primaryKey
* @return AclInterface
*/
- function getFromCacheById($primaryKey);
+ public function getFromCacheById($primaryKey);
/**
* Retrieves an ACL for the given object identity from the cache
@@ -48,17 +48,17 @@ interface AclCacheInterface
* @param ObjectIdentityInterface $oid
* @return AclInterface
*/
- function getFromCacheByIdentity(ObjectIdentityInterface $oid);
+ public function getFromCacheByIdentity(ObjectIdentityInterface $oid);
/**
* Stores a new ACL in the cache
*
* @param AclInterface $acl
*/
- function putInCache(AclInterface $acl);
+ public function putInCache(AclInterface $acl);
/**
* Removes all ACLs from the cache
*/
- function clearCache();
+ public function clearCache();
}
diff --git a/Acl/Model/AclInterface.php b/Acl/Model/AclInterface.php
index 9094560..fffe591 100644
--- a/Acl/Model/AclInterface.php
+++ b/Acl/Model/AclInterface.php
@@ -28,7 +28,7 @@ interface AclInterface extends \Serializable
*
* @return array
*/
- function getClassAces();
+ public function getClassAces();
/**
* Returns all class-field-based ACEs associated with this ACL
@@ -36,14 +36,14 @@ interface AclInterface extends \Serializable
* @param string $field
* @return array
*/
- function getClassFieldAces($field);
+ public function getClassFieldAces($field);
/**
* Returns all object-based ACEs associated with this ACL
*
* @return array
*/
- function getObjectAces();
+ public function getObjectAces();
/**
* Returns all object-field-based ACEs associated with this ACL
@@ -51,28 +51,28 @@ interface AclInterface extends \Serializable
* @param string $field
* @return array
*/
- function getObjectFieldAces($field);
+ public function getObjectFieldAces($field);
/**
* Returns the object identity associated with this ACL
*
* @return ObjectIdentityInterface
*/
- function getObjectIdentity();
+ public function getObjectIdentity();
/**
* Returns the parent ACL, or null if there is none.
*
* @return AclInterface|null
*/
- function getParentAcl();
+ public function getParentAcl();
/**
* Whether this ACL is inheriting ACEs from a parent ACL.
*
* @return Boolean
*/
- function isEntriesInheriting();
+ public function isEntriesInheriting();
/**
* Determines whether field access is granted
@@ -83,7 +83,7 @@ interface AclInterface extends \Serializable
* @param Boolean $administrativeMode
* @return Boolean
*/
- function isFieldGranted($field, array $masks, array $securityIdentities, $administrativeMode = false);
+ public function isFieldGranted($field, array $masks, array $securityIdentities, $administrativeMode = false);
/**
* Determines whether access is granted
@@ -94,7 +94,7 @@ interface AclInterface extends \Serializable
* @param Boolean $administrativeMode
* @return Boolean
*/
- function isGranted(array $masks, array $securityIdentities, $administrativeMode = false);
+ public function isGranted(array $masks, array $securityIdentities, $administrativeMode = false);
/**
* Whether the ACL has loaded ACEs for all of the passed security identities
@@ -102,5 +102,5 @@ interface AclInterface extends \Serializable
* @param mixed $securityIdentities an implementation of SecurityIdentityInterface, or an array thereof
* @return Boolean
*/
- function isSidLoaded($securityIdentities);
+ public function isSidLoaded($securityIdentities);
}
diff --git a/Acl/Model/AclProviderInterface.php b/Acl/Model/AclProviderInterface.php
index 2f878e1..4be49bf 100644
--- a/Acl/Model/AclProviderInterface.php
+++ b/Acl/Model/AclProviderInterface.php
@@ -23,27 +23,32 @@ interface AclProviderInterface
*
* @param ObjectIdentityInterface $parentOid
* @param Boolean $directChildrenOnly
+ *
* @return array returns an array of child 'ObjectIdentity's
*/
- function findChildren(ObjectIdentityInterface $parentOid, $directChildrenOnly = false);
+ public function findChildren(ObjectIdentityInterface $parentOid, $directChildrenOnly = false);
/**
* Returns the ACL that belongs to the given object identity
*
- * @throws AclNotFoundException when there is no ACL
- * @param ObjectIdentityInterface $oid
- * @param array $sids
+ * @param ObjectIdentityInterface $oid
+ * @param SecurityIdentityInterface[] $sids
+ *
* @return AclInterface
+ *
+ * @throws AclNotFoundException when there is no ACL
*/
- function findAcl(ObjectIdentityInterface $oid, array $sids = array());
+ public function findAcl(ObjectIdentityInterface $oid, array $sids = array());
/**
* Returns the ACLs that belong to the given object identities
*
- * @throws AclNotFoundException when we cannot find an ACL for all identities
- * @param array $oids an array of ObjectIdentityInterface implementations
- * @param array $sids an array of SecurityIdentityInterface implementations
+ * @param ObjectIdentityInterface[] $oids an array of ObjectIdentityInterface implementations
+ * @param SecurityIdentityInterface[] $sids an array of SecurityIdentityInterface implementations
+ *
* @return \SplObjectStorage mapping the passed object identities to ACLs
+ *
+ * @throws AclNotFoundException when we cannot find an ACL for all identities
*/
- function findAcls(array $oids, array $sids = array());
+ public function findAcls(array $oids, array $sids = array());
}
diff --git a/Acl/Model/AuditLoggerInterface.php b/Acl/Model/AuditLoggerInterface.php
index 7cab6f1..09bcbb8 100644
--- a/Acl/Model/AuditLoggerInterface.php
+++ b/Acl/Model/AuditLoggerInterface.php
@@ -25,5 +25,5 @@ interface AuditLoggerInterface
* @param Boolean $granted
* @param EntryInterface $ace
*/
- function logIfNeeded($granted, EntryInterface $ace);
+ public function logIfNeeded($granted, EntryInterface $ace);
}
diff --git a/Acl/Model/AuditableAclInterface.php b/Acl/Model/AuditableAclInterface.php
index 5da593e..14b4c04 100644
--- a/Acl/Model/AuditableAclInterface.php
+++ b/Acl/Model/AuditableAclInterface.php
@@ -25,7 +25,7 @@ interface AuditableAclInterface extends MutableAclInterface
* @param Boolean $auditSuccess
* @param Boolean $auditFailure
*/
- function updateClassAuditing($index, $auditSuccess, $auditFailure);
+ public function updateClassAuditing($index, $auditSuccess, $auditFailure);
/**
* Updates auditing for class-field-based ACE
@@ -35,7 +35,7 @@ interface AuditableAclInterface extends MutableAclInterface
* @param Boolean $auditSuccess
* @param Boolean $auditFailure
*/
- function updateClassFieldAuditing($index, $field, $auditSuccess, $auditFailure);
+ public function updateClassFieldAuditing($index, $field, $auditSuccess, $auditFailure);
/**
* Updates auditing for object-based ACE
@@ -44,7 +44,7 @@ interface AuditableAclInterface extends MutableAclInterface
* @param Boolean $auditSuccess
* @param Boolean $auditFailure
*/
- function updateObjectAuditing($index, $auditSuccess, $auditFailure);
+ public function updateObjectAuditing($index, $auditSuccess, $auditFailure);
/**
* Updates auditing for object-field-based ACE
@@ -54,5 +54,5 @@ interface AuditableAclInterface extends MutableAclInterface
* @param Boolean $auditSuccess
* @param Boolean $auditFailure
*/
- function updateObjectFieldAuditing($index, $field, $auditSuccess, $auditFailure);
+ public function updateObjectFieldAuditing($index, $field, $auditSuccess, $auditFailure);
}
diff --git a/Acl/Model/AuditableEntryInterface.php b/Acl/Model/AuditableEntryInterface.php
index 40c4484..e957965 100644
--- a/Acl/Model/AuditableEntryInterface.php
+++ b/Acl/Model/AuditableEntryInterface.php
@@ -23,12 +23,12 @@ interface AuditableEntryInterface extends EntryInterface
*
* @return Boolean
*/
- function isAuditFailure();
+ public function isAuditFailure();
/**
* Whether auditing for successful denies is turned on
*
* @return Boolean
*/
- function isAuditSuccess();
+ public function isAuditSuccess();
}
diff --git a/Acl/Model/DomainObjectInterface.php b/Acl/Model/DomainObjectInterface.php
index 50bc4c3..195cb4e 100644
--- a/Acl/Model/DomainObjectInterface.php
+++ b/Acl/Model/DomainObjectInterface.php
@@ -25,5 +25,5 @@ interface DomainObjectInterface
*
* @return string
*/
- function getObjectIdentifier();
+ public function getObjectIdentifier();
}
diff --git a/Acl/Model/EntryInterface.php b/Acl/Model/EntryInterface.php
index 6fe0dc8..98b754c 100644
--- a/Acl/Model/EntryInterface.php
+++ b/Acl/Model/EntryInterface.php
@@ -26,40 +26,40 @@ interface EntryInterface extends \Serializable
*
* @return AclInterface
*/
- function getAcl();
+ public function getAcl();
/**
* The primary key of this ACE
*
* @return integer
*/
- function getId();
+ public function getId();
/**
* The permission mask of this ACE
*
* @return integer
*/
- function getMask();
+ public function getMask();
/**
* The security identity associated with this ACE
*
* @return SecurityIdentityInterface
*/
- function getSecurityIdentity();
+ public function getSecurityIdentity();
/**
* The strategy for comparing masks
*
* @return string
*/
- function getStrategy();
+ public function getStrategy();
/**
* Returns whether this ACE is granting, or denying
*
* @return Boolean
*/
- function isGranting();
+ public function isGranting();
}
diff --git a/Acl/Model/FieldEntryInterface.php b/Acl/Model/FieldEntryInterface.php
index a35ddb4..8382ae1 100644
--- a/Acl/Model/FieldEntryInterface.php
+++ b/Acl/Model/FieldEntryInterface.php
@@ -23,5 +23,5 @@ interface FieldEntryInterface extends EntryInterface
*
* @return string
*/
- function getField();
+ public function getField();
}
diff --git a/Acl/Model/MutableAclInterface.php b/Acl/Model/MutableAclInterface.php
index f84e817..365a779 100644
--- a/Acl/Model/MutableAclInterface.php
+++ b/Acl/Model/MutableAclInterface.php
@@ -26,7 +26,7 @@ interface MutableAclInterface extends AclInterface
*
* @param integer $index
*/
- function deleteClassAce($index);
+ public function deleteClassAce($index);
/**
* Deletes a class-field-based ACE
@@ -34,14 +34,14 @@ interface MutableAclInterface extends AclInterface
* @param integer $index
* @param string $field
*/
- function deleteClassFieldAce($index, $field);
+ public function deleteClassFieldAce($index, $field);
/**
* Deletes an object-based ACE
*
* @param integer $index
*/
- function deleteObjectAce($index);
+ public function deleteObjectAce($index);
/**
* Deletes an object-field-based ACE
@@ -49,14 +49,14 @@ interface MutableAclInterface extends AclInterface
* @param integer $index
* @param string $field
*/
- function deleteObjectFieldAce($index, $field);
+ public function deleteObjectFieldAce($index, $field);
/**
* Returns the primary key of this ACL
*
* @return integer
*/
- function getId();
+ public function getId();
/**
* Inserts a class-based ACE
@@ -67,7 +67,7 @@ interface MutableAclInterface extends AclInterface
* @param Boolean $granting
* @param string $strategy
*/
- function insertClassAce(SecurityIdentityInterface $sid, $mask, $index = 0, $granting = true, $strategy = null);
+ public function insertClassAce(SecurityIdentityInterface $sid, $mask, $index = 0, $granting = true, $strategy = null);
/**
* Inserts a class-field-based ACE
@@ -79,7 +79,7 @@ interface MutableAclInterface extends AclInterface
* @param Boolean $granting
* @param string $strategy
*/
- function insertClassFieldAce($field, SecurityIdentityInterface $sid, $mask, $index = 0, $granting = true, $strategy = null);
+ public function insertClassFieldAce($field, SecurityIdentityInterface $sid, $mask, $index = 0, $granting = true, $strategy = null);
/**
* Inserts an object-based ACE
@@ -90,7 +90,7 @@ interface MutableAclInterface extends AclInterface
* @param Boolean $granting
* @param string $strategy
*/
- function insertObjectAce(SecurityIdentityInterface $sid, $mask, $index = 0, $granting = true, $strategy = null);
+ public function insertObjectAce(SecurityIdentityInterface $sid, $mask, $index = 0, $granting = true, $strategy = null);
/**
* Inserts an object-field-based ACE
@@ -102,22 +102,21 @@ interface MutableAclInterface extends AclInterface
* @param Boolean $granting
* @param string $strategy
*/
- function insertObjectFieldAce($field, SecurityIdentityInterface $sid, $mask, $index = 0, $granting = true, $strategy = null);
+ public function insertObjectFieldAce($field, SecurityIdentityInterface $sid, $mask, $index = 0, $granting = true, $strategy = null);
/**
* Sets whether entries are inherited
*
* @param Boolean $boolean
*/
- function setEntriesInheriting($boolean);
+ public function setEntriesInheriting($boolean);
/**
* Sets the parent ACL
*
* @param AclInterface|null $acl
- * @return void
*/
- function setParentAcl(AclInterface $acl = null);
+ public function setParentAcl(AclInterface $acl = null);
/**
* Updates a class-based ACE
@@ -126,7 +125,7 @@ interface MutableAclInterface extends AclInterface
* @param integer $mask
* @param string $strategy if null the strategy should not be changed
*/
- function updateClassAce($index, $mask, $strategy = null);
+ public function updateClassAce($index, $mask, $strategy = null);
/**
* Updates a class-field-based ACE
@@ -136,7 +135,7 @@ interface MutableAclInterface extends AclInterface
* @param integer $mask
* @param string $strategy if null the strategy should not be changed
*/
- function updateClassFieldAce($index, $field, $mask, $strategy = null);
+ public function updateClassFieldAce($index, $field, $mask, $strategy = null);
/**
* Updates an object-based ACE
@@ -145,7 +144,7 @@ interface MutableAclInterface extends AclInterface
* @param integer $mask
* @param string $strategy if null the strategy should not be changed
*/
- function updateObjectAce($index, $mask, $strategy = null);
+ public function updateObjectAce($index, $mask, $strategy = null);
/**
* Updates an object-field-based ACE
@@ -155,5 +154,5 @@ interface MutableAclInterface extends AclInterface
* @param integer $mask
* @param string $strategy if null the strategy should not be changed
*/
- function updateObjectFieldAce($index, $field, $mask, $strategy = null);
+ public function updateObjectFieldAce($index, $field, $mask, $strategy = null);
}
diff --git a/Acl/Model/MutableAclProviderInterface.php b/Acl/Model/MutableAclProviderInterface.php
index 04cf237..cb34b72 100644
--- a/Acl/Model/MutableAclProviderInterface.php
+++ b/Acl/Model/MutableAclProviderInterface.php
@@ -26,7 +26,7 @@ interface MutableAclProviderInterface extends AclProviderInterface
* @param ObjectIdentityInterface $oid
* @return MutableAclInterface
*/
- function createAcl(ObjectIdentityInterface $oid);
+ public function createAcl(ObjectIdentityInterface $oid);
/**
* Deletes the ACL for a given object identity.
@@ -36,7 +36,7 @@ interface MutableAclProviderInterface extends AclProviderInterface
*
* @param ObjectIdentityInterface $oid
*/
- function deleteAcl(ObjectIdentityInterface $oid);
+ public function deleteAcl(ObjectIdentityInterface $oid);
/**
* Persists any changes which were made to the ACL, or any associated
@@ -46,5 +46,5 @@ interface MutableAclProviderInterface extends AclProviderInterface
*
* @param MutableAclInterface $acl
*/
- function updateAcl(MutableAclInterface $acl);
+ public function updateAcl(MutableAclInterface $acl);
}
diff --git a/Acl/Model/ObjectIdentityInterface.php b/Acl/Model/ObjectIdentityInterface.php
index 7e892bf..8ad0eba 100644
--- a/Acl/Model/ObjectIdentityInterface.php
+++ b/Acl/Model/ObjectIdentityInterface.php
@@ -30,7 +30,7 @@ interface ObjectIdentityInterface
* @param ObjectIdentityInterface $identity
* @return Boolean
*/
- function equals(ObjectIdentityInterface $identity);
+ public function equals(ObjectIdentityInterface $identity);
/**
* Obtains a unique identifier for this object. The identifier must not be
@@ -38,12 +38,12 @@ interface ObjectIdentityInterface
*
* @return string cannot return null
*/
- function getIdentifier();
+ public function getIdentifier();
/**
* Returns a type for the domain object. Typically, this is the PHP class name.
*
* @return string cannot return null
*/
- function getType();
+ public function getType();
}
diff --git a/Acl/Model/ObjectIdentityRetrievalStrategyInterface.php b/Acl/Model/ObjectIdentityRetrievalStrategyInterface.php
index e53c3da..b0f7f78 100644
--- a/Acl/Model/ObjectIdentityRetrievalStrategyInterface.php
+++ b/Acl/Model/ObjectIdentityRetrievalStrategyInterface.php
@@ -24,5 +24,5 @@ interface ObjectIdentityRetrievalStrategyInterface
* @param object $domainObject
* @return ObjectIdentityInterface
*/
- function getObjectIdentity($domainObject);
+ public function getObjectIdentity($domainObject);
}
diff --git a/Acl/Model/PermissionGrantingStrategyInterface.php b/Acl/Model/PermissionGrantingStrategyInterface.php
index 7afdfac..7f8f81b 100644
--- a/Acl/Model/PermissionGrantingStrategyInterface.php
+++ b/Acl/Model/PermissionGrantingStrategyInterface.php
@@ -27,7 +27,7 @@ interface PermissionGrantingStrategyInterface
* @param Boolean $administrativeMode
* @return Boolean
*/
- function isGranted(AclInterface $acl, array $masks, array $sids, $administrativeMode = false);
+ public function isGranted(AclInterface $acl, array $masks, array $sids, $administrativeMode = false);
/**
* Determines whether access to a domain object's field is to be granted
@@ -40,5 +40,5 @@ interface PermissionGrantingStrategyInterface
*
* @return Boolean
*/
- function isFieldGranted(AclInterface $acl, $field, array $masks, array $sids, $administrativeMode = false);
+ public function isFieldGranted(AclInterface $acl, $field, array $masks, array $sids, $administrativeMode = false);
}
diff --git a/Acl/Model/SecurityIdentityInterface.php b/Acl/Model/SecurityIdentityInterface.php
index 5bf6189..0a24a54 100644
--- a/Acl/Model/SecurityIdentityInterface.php
+++ b/Acl/Model/SecurityIdentityInterface.php
@@ -26,5 +26,5 @@ interface SecurityIdentityInterface
*
* @param SecurityIdentityInterface $identity
*/
- function equals(SecurityIdentityInterface $identity);
+ public function equals(SecurityIdentityInterface $identity);
}
diff --git a/Acl/Model/SecurityIdentityRetrievalStrategyInterface.php b/Acl/Model/SecurityIdentityRetrievalStrategyInterface.php
index 3bbbaa4..5bb7915 100644
--- a/Acl/Model/SecurityIdentityRetrievalStrategyInterface.php
+++ b/Acl/Model/SecurityIdentityRetrievalStrategyInterface.php
@@ -28,7 +28,8 @@ interface SecurityIdentityRetrievalStrategyInterface
* least specific.
*
* @param TokenInterface $token
- * @return array of SecurityIdentityInterface implementations
+ *
+ * @return SecurityIdentityInterface[] An array of SecurityIdentityInterface implementations
*/
- function getSecurityIdentities(TokenInterface $token);
+ public function getSecurityIdentities(TokenInterface $token);
}
diff --git a/Acl/Permission/MaskBuilder.php b/Acl/Permission/MaskBuilder.php
index 6921558..017e7c0 100644
--- a/Acl/Permission/MaskBuilder.php
+++ b/Acl/Permission/MaskBuilder.php
@@ -73,6 +73,8 @@ class MaskBuilder
* Constructor
*
* @param integer $mask optional; defaults to 0
+ *
+ * @throws \InvalidArgumentException
*/
public function __construct($mask = 0)
{
@@ -87,7 +89,10 @@ class MaskBuilder
* Adds a mask to the permission
*
* @param mixed $mask
+ *
* @return MaskBuilder
+ *
+ * @throws \InvalidArgumentException
*/
public function add($mask)
{
@@ -140,7 +145,10 @@ class MaskBuilder
* Removes a mask from the permission
*
* @param mixed $mask
+ *
* @return MaskBuilder
+ *
+ * @throws \InvalidArgumentException
*/
public function remove($mask)
{
@@ -175,7 +183,7 @@ class MaskBuilder
* @throws \RuntimeException
* @return string
*/
- static public function getCode($mask)
+ public static function getCode($mask)
{
if (!is_int($mask)) {
throw new \InvalidArgumentException('$mask must be an integer.');
diff --git a/Acl/Permission/PermissionMapInterface.php b/Acl/Permission/PermissionMapInterface.php
index c2e49d5..44c15cc 100644
--- a/Acl/Permission/PermissionMapInterface.php
+++ b/Acl/Permission/PermissionMapInterface.php
@@ -28,7 +28,7 @@ interface PermissionMapInterface
* @param object $object
* @return array may return null if permission/object combination is not supported
*/
- function getMasks($permission, $object);
+ public function getMasks($permission, $object);
/**
* Whether this map contains the given permission
@@ -36,5 +36,5 @@ interface PermissionMapInterface
* @param string $permission
* @return Boolean
*/
- function contains($permission);
+ public function contains($permission);
}
diff --git a/Acl/Resources/bin/generateSql.php b/Acl/Resources/bin/generateSql.php
index 25ded7a..4a5ca05 100644
--- a/Acl/Resources/bin/generateSql.php
+++ b/Acl/Resources/bin/generateSql.php
@@ -9,14 +9,14 @@
* file that was distributed with this source code.
*/
-require_once __DIR__.'/../../../../ClassLoader/UniversalClassLoader.php';
+require_once __DIR__.'/../../../../ClassLoader/ClassLoader.php';
-use Symfony\Component\ClassLoader\UniversalClassLoader;
+use Symfony\Component\ClassLoader\ClassLoader;
use Symfony\Component\Finder\Finder;
use Symfony\Component\Security\Acl\Dbal\Schema;
-$loader = new UniversalClassLoader();
-$loader->registerNamespaces(array(
+$loader = new ClassLoader();
+$loader->addPrefixes(array(
'Symfony' => __DIR__.'/../../../../../..',
'Doctrine\\Common' => __DIR__.'/../../../../../../../vendor/doctrine-common/lib',
'Doctrine\\DBAL\\Migrations' => __DIR__.'/../../../../../../../vendor/doctrine-migrations/lib',
@@ -25,7 +25,6 @@ $loader->registerNamespaces(array(
));
$loader->register();
-
$schema = new Schema(array(
'class_table_name' => 'acl_classes',
'entry_table_name' => 'acl_entries',
diff --git a/Acl/Voter/AclVoter.php b/Acl/Voter/AclVoter.php
index 456c434..5e9aee6 100644
--- a/Acl/Voter/AclVoter.php
+++ b/Acl/Voter/AclVoter.php
@@ -11,7 +11,7 @@
namespace Symfony\Component\Security\Acl\Voter;
-use Symfony\Component\HttpKernel\Log\LoggerInterface;
+use Psr\Log\LoggerInterface;
use Symfony\Component\Security\Acl\Exception\NoAceFoundException;
use Symfony\Component\Security\Acl\Exception\AclNotFoundException;
use Symfony\Component\Security\Acl\Model\AclProviderInterface;