apply code conventions (static public and phpDoc)
This commit is contained in:
parent
af1053e149
commit
e73bc1098b
|
@ -10,8 +10,6 @@
|
|||
|
||||
namespace Propel\PropelBundle\Model\Acl;
|
||||
|
||||
use PropelPDO;
|
||||
|
||||
use Propel\PropelBundle\Model\Acl\om\BaseAclClass;
|
||||
|
||||
use Symfony\Component\Security\Acl\Model\ObjectIdentityInterface;
|
||||
|
@ -23,12 +21,12 @@ class AclClass extends BaseAclClass
|
|||
*
|
||||
* If none can be found, a new one will be saved.
|
||||
*
|
||||
* @param ObjectIdentityInterface $objectIdentity
|
||||
* @param PropelPDO $con
|
||||
* @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity
|
||||
* @param \PropelPDO $con
|
||||
*
|
||||
* @return AclClass
|
||||
* @return \Propel\PropelBundle\Model\Acl\AclClass
|
||||
*/
|
||||
public static function fromAclObjectIdentity(ObjectIdentityInterface $objectIdentity, PropelPDO $con = null)
|
||||
static public function fromAclObjectIdentity(ObjectIdentityInterface $objectIdentity, \PropelPDO $con = null)
|
||||
{
|
||||
$obj = AclClassQuery::create()
|
||||
->filterByType($objectIdentity->getType())
|
||||
|
|
|
@ -27,11 +27,11 @@ class Entry extends BaseEntry
|
|||
*
|
||||
* The entry will not be persisted!
|
||||
*
|
||||
* @param EntryInterface $aclEntry
|
||||
* @param \Symfony\Component\Security\Acl\Model\EntryInterface $aclEntry
|
||||
*
|
||||
* @return Entry
|
||||
* @return \Propel\PropelBundle\Model\Acl\Entry
|
||||
*/
|
||||
public static function fromAclEntry(EntryInterface $aclEntry)
|
||||
static public function fromAclEntry(EntryInterface $aclEntry)
|
||||
{
|
||||
$entry = new self();
|
||||
|
||||
|
@ -64,12 +64,12 @@ class Entry extends BaseEntry
|
|||
/**
|
||||
* Transform a given model entry into an ACL related Entry (ACE).
|
||||
*
|
||||
* @param Entry $modelEntry
|
||||
* @param AclInterface $acl
|
||||
* @param \Propel\PropelBundle\Model\Acl\Entry $modelEntry
|
||||
* @param \Symfony\Component\Security\Acl\Model\AclInterface $acl
|
||||
*
|
||||
* @return EntryInterface
|
||||
* @return \Symfony\Component\Security\Acl\Model\EntryInterface
|
||||
*/
|
||||
public static function toAclEntry(Entry $modelEntry, AclInterface $acl)
|
||||
static public function toAclEntry(Entry $modelEntry, AclInterface $acl)
|
||||
{
|
||||
if (null === $modelEntry->getFieldName()) {
|
||||
return new AclEntry($modelEntry, $acl);
|
||||
|
|
|
@ -10,11 +10,6 @@
|
|||
|
||||
namespace Propel\PropelBundle\Model\Acl;
|
||||
|
||||
use Criteria;
|
||||
use PropelPDO;
|
||||
use PropelCollection;
|
||||
use InvalidArgumentException;
|
||||
|
||||
use Propel\PropelBundle\Model\Acl\om\BaseEntryQuery;
|
||||
use Propel\PropelBundle\Model\Acl\EntryPeer;
|
||||
|
||||
|
@ -28,13 +23,13 @@ class EntryQuery extends BaseEntryQuery
|
|||
*
|
||||
* @see find()
|
||||
*
|
||||
* @param ObjectIdentityInterface $objectIdentity A list of ObjectIdentityInterface to retrieve the ACL for.
|
||||
* @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity An ACL related ObjectIdentity.
|
||||
* @param array $securityIdentities A list of SecurityIdentity to filter by.
|
||||
* @param PropelPDO $con
|
||||
* @param \PropelPDO $con
|
||||
*
|
||||
* @return PropelCollection
|
||||
* @return \PropelCollection
|
||||
*/
|
||||
public function findByAclIdentity(ObjectIdentityInterface $objectIdentity, array $securityIdentities = array(), PropelPDO $con = null)
|
||||
public function findByAclIdentity(ObjectIdentityInterface $objectIdentity, array $securityIdentities = array(), \PropelPDO $con = null)
|
||||
{
|
||||
$securityIds = array();
|
||||
foreach ($securityIdentities as $eachIdentity) {
|
||||
|
@ -45,7 +40,7 @@ class EntryQuery extends BaseEntryQuery
|
|||
$errorMessage = sprintf('The list of security identities contains at least one invalid entry "%s". Please provide objects of classes implementing "Symfony\Component\Security\Acl\Model\SecurityIdentityInterface" only.', $eachIdentity);
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException($errorMessage);
|
||||
throw new \InvalidArgumentException($errorMessage);
|
||||
}
|
||||
|
||||
if ($securityIdentity = SecurityIdentity::fromAclIdentity($eachIdentity)) {
|
||||
|
@ -54,12 +49,12 @@ class EntryQuery extends BaseEntryQuery
|
|||
}
|
||||
|
||||
$this
|
||||
->useAclClassQuery(null, Criteria::INNER_JOIN)
|
||||
->useAclClassQuery(null, \Criteria::INNER_JOIN)
|
||||
->filterByType((string) $objectIdentity->getType())
|
||||
->endUse()
|
||||
->leftJoinObjectIdentity()
|
||||
->add(ObjectIdentityPeer::OBJECT_IDENTIFIER, (string) $objectIdentity->getIdentifier(), Criteria::EQUAL)
|
||||
->addOr(EntryPeer::OBJECT_IDENTITY_ID, null, Criteria::ISNULL)
|
||||
->add(ObjectIdentityPeer::OBJECT_IDENTIFIER, (string) $objectIdentity->getIdentifier(), \Criteria::EQUAL)
|
||||
->addOr(EntryPeer::OBJECT_IDENTITY_ID, null, \Criteria::ISNULL)
|
||||
;
|
||||
|
||||
if (!empty($securityIdentities)) {
|
||||
|
|
|
@ -10,14 +10,11 @@
|
|||
|
||||
namespace Propel\PropelBundle\Model\Acl;
|
||||
|
||||
use Criteria;
|
||||
use PropelPDO;
|
||||
|
||||
use Propel\PropelBundle\Model\Acl\om\BaseObjectIdentity;
|
||||
|
||||
class ObjectIdentity extends BaseObjectIdentity
|
||||
{
|
||||
public function preInsert(PropelPDO $con = null)
|
||||
public function preInsert(\PropelPDO $con = null)
|
||||
{
|
||||
// Compatibility with default implementation.
|
||||
$ancestor = new ObjectIdentityAncestor();
|
||||
|
@ -33,7 +30,7 @@ class ObjectIdentity extends BaseObjectIdentity
|
|||
return true;
|
||||
}
|
||||
|
||||
public function preUpdate(PropelPDO $con = null)
|
||||
public function preUpdate(\PropelPDO $con = null)
|
||||
{
|
||||
if ($this->isColumnModified(ObjectIdentityPeer::PARENT_OBJECT_IDENTITY_ID)) {
|
||||
$this->updateAncestorsTree($con);
|
||||
|
@ -42,7 +39,7 @@ class ObjectIdentity extends BaseObjectIdentity
|
|||
return true;
|
||||
}
|
||||
|
||||
public function preDelete(PropelPDO $con = null)
|
||||
public function preDelete(\PropelPDO $con = null)
|
||||
{
|
||||
$objIds = array($this->getId());
|
||||
|
||||
|
@ -56,7 +53,7 @@ class ObjectIdentity extends BaseObjectIdentity
|
|||
|
||||
// Manually delete those for DBAdapter not capable of cascading the DELETE.
|
||||
ObjectIdentityAncestorQuery::create()
|
||||
->filterByObjectIdentityId($objIds, Criteria::IN)
|
||||
->filterByObjectIdentityId($objIds, \Criteria::IN)
|
||||
->delete($con)
|
||||
;
|
||||
|
||||
|
@ -66,11 +63,11 @@ class ObjectIdentity extends BaseObjectIdentity
|
|||
/**
|
||||
* Update all ancestor entries to reflect changes on this instance.
|
||||
*
|
||||
* @param PropelPDO $con
|
||||
* @param \PropelPDO $con
|
||||
*
|
||||
* @return ObjectIdentity $this
|
||||
* @return \Propel\PropelBundle\Model\Acl\ObjectIdentity $this
|
||||
*/
|
||||
protected function updateAncestorsTree(PropelPDO $con = null)
|
||||
protected function updateAncestorsTree(\PropelPDO $con = null)
|
||||
{
|
||||
$con->beginTransaction();
|
||||
|
||||
|
@ -87,13 +84,13 @@ class ObjectIdentity extends BaseObjectIdentity
|
|||
*/
|
||||
$query = ObjectIdentityAncestorQuery::create()
|
||||
->filterByObjectIdentityId($eachChild->getId())
|
||||
->filterByObjectIdentityRelatedByAncestorId($oldAncestors, Criteria::IN)
|
||||
->filterByObjectIdentityRelatedByAncestorId($oldAncestors, \Criteria::IN)
|
||||
;
|
||||
|
||||
if ($eachChild->getId() !== $this->getId()) {
|
||||
$query->filterByAncestorId(array($eachChild->getId(), $this->getId()), Criteria::NOT_IN);
|
||||
$query->filterByAncestorId(array($eachChild->getId(), $this->getId()), \Criteria::NOT_IN);
|
||||
} else {
|
||||
$query->filterByAncestorId($this->getId(), Criteria::NOT_EQUAL);
|
||||
$query->filterByAncestorId($this->getId(), \Criteria::NOT_EQUAL);
|
||||
}
|
||||
|
||||
$query->delete($con);
|
||||
|
|
|
@ -10,10 +10,6 @@
|
|||
|
||||
namespace Propel\PropelBundle\Model\Acl;
|
||||
|
||||
use Criteria;
|
||||
use PropelPDO;
|
||||
use PropelCollection;
|
||||
|
||||
use Propel\PropelBundle\Model\Acl\ObjectIdentity;
|
||||
use Propel\PropelBundle\Model\Acl\om\BaseObjectIdentityQuery;
|
||||
|
||||
|
@ -24,12 +20,12 @@ class ObjectIdentityQuery extends BaseObjectIdentityQuery
|
|||
/**
|
||||
* Filter by an ObjectIdentity object belonging to the given ACL related ObjectIdentity.
|
||||
*
|
||||
* @param ObjectIdentityInterface $objectIdentity
|
||||
* @param PropelPDO $con
|
||||
* @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity
|
||||
* @param \PropelPDO $con
|
||||
*
|
||||
* @return ObjectIdentityQuery $this
|
||||
* @return \Propel\PropelBundle\Model\Acl\ObjectIdentityQuery $this
|
||||
*/
|
||||
public function filterByAclObjectIdentity(ObjectIdentityInterface $objectIdentity, PropelPDO $con = null)
|
||||
public function filterByAclObjectIdentity(ObjectIdentityInterface $objectIdentity, \PropelPDO $con = null)
|
||||
{
|
||||
/*
|
||||
* Not using a JOIN here, because the filter may be applied on 'findOneOrCreate',
|
||||
|
@ -47,12 +43,12 @@ class ObjectIdentityQuery extends BaseObjectIdentityQuery
|
|||
/**
|
||||
* Return an ObjectIdentity object belonging to the given ACL related ObjectIdentity.
|
||||
*
|
||||
* @param ObjectIdentityInterface $objectIdentity
|
||||
* @param PropelPDO $con
|
||||
* @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity
|
||||
* @param \PropelPDO $con
|
||||
*
|
||||
* @return ObjectIdentity
|
||||
* @return \Propel\PropelBundle\Model\Acl\ObjectIdentity
|
||||
*/
|
||||
public function findOneByAclObjectIdentity(ObjectIdentityInterface $objectIdentity, PropelPDO $con = null)
|
||||
public function findOneByAclObjectIdentity(ObjectIdentityInterface $objectIdentity, \PropelPDO $con = null)
|
||||
{
|
||||
return $this
|
||||
->filterByAclObjectIdentity($objectIdentity, $con)
|
||||
|
@ -63,12 +59,12 @@ class ObjectIdentityQuery extends BaseObjectIdentityQuery
|
|||
/**
|
||||
* Return all children of the given object identity.
|
||||
*
|
||||
* @param ObjectIdentity $objectIdentity
|
||||
* @param PropelPDO $con
|
||||
* @param \Propel\PropelBundle\Model\Acl\ObjectIdentity $objectIdentity
|
||||
* @param \PropelPDO $con
|
||||
*
|
||||
* @return PropelCollection
|
||||
* @return \PropelObjectCollection
|
||||
*/
|
||||
public function findChildren(ObjectIdentity $objectIdentity, PropelPDO $con = null)
|
||||
public function findChildren(ObjectIdentity $objectIdentity, \PropelPDO $con = null)
|
||||
{
|
||||
return $this
|
||||
->filterByObjectIdentityRelatedByParentObjectIdentityId($objectIdentity)
|
||||
|
@ -79,17 +75,17 @@ class ObjectIdentityQuery extends BaseObjectIdentityQuery
|
|||
/**
|
||||
* Return all children and grand-children of the given object identity.
|
||||
*
|
||||
* @param ObjectIdentity $objectIdentity
|
||||
* @param PropelPDO $con
|
||||
* @param \Propel\PropelBundle\Model\Acl\ObjectIdentity $objectIdentity
|
||||
* @param \PropelPDO $con
|
||||
*
|
||||
* @return PropelCollection
|
||||
* @return \PropelObjectCollection
|
||||
*/
|
||||
public function findGrandChildren(ObjectIdentity $objectIdentity, PropelPDO $con = null)
|
||||
public function findGrandChildren(ObjectIdentity $objectIdentity, \PropelPDO $con = null)
|
||||
{
|
||||
return $this
|
||||
->useObjectIdentityAncestorRelatedByObjectIdentityIdQuery()
|
||||
->filterByObjectIdentityRelatedByAncestorId($objectIdentity)
|
||||
->filterByObjectIdentityRelatedByObjectIdentityId($objectIdentity, Criteria::NOT_EQUAL)
|
||||
->filterByObjectIdentityRelatedByObjectIdentityId($objectIdentity, \Criteria::NOT_EQUAL)
|
||||
->endUse()
|
||||
->find($con)
|
||||
;
|
||||
|
@ -99,16 +95,16 @@ class ObjectIdentityQuery extends BaseObjectIdentityQuery
|
|||
* Return all ancestors of the given object identity.
|
||||
*
|
||||
* @param ObjectIdentity $objectIdentity
|
||||
* @param PropelPDO $con
|
||||
* @param \PropelPDO $con
|
||||
*
|
||||
* @return PropelCollection
|
||||
* @return \PropelObjectCollection
|
||||
*/
|
||||
public function findAncestors(ObjectIdentity $objectIdentity, PropelPDO $con = null)
|
||||
public function findAncestors(ObjectIdentity $objectIdentity, \PropelPDO $con = null)
|
||||
{
|
||||
return $this
|
||||
->useObjectIdentityAncestorRelatedByAncestorIdQuery()
|
||||
->filterByObjectIdentityRelatedByObjectIdentityId($objectIdentity)
|
||||
->filterByObjectIdentityRelatedByAncestorId($objectIdentity, Criteria::NOT_EQUAL)
|
||||
->filterByObjectIdentityRelatedByAncestorId($objectIdentity, \Criteria::NOT_EQUAL)
|
||||
->endUse()
|
||||
->find($con)
|
||||
;
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
|
||||
namespace Propel\PropelBundle\Model\Acl;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use PropelPDO;
|
||||
|
||||
use Propel\PropelBundle\Model\Acl\om\BaseSecurityIdentity;
|
||||
|
||||
use Symfony\Component\Security\Acl\Domain\RoleSecurityIdentity;
|
||||
|
@ -24,17 +21,17 @@ class SecurityIdentity extends BaseSecurityIdentity
|
|||
/**
|
||||
* Transform a given mode security identity into an ACL related SecurityIdentity.
|
||||
*
|
||||
* @param SecurityIdentity $securityIdentity
|
||||
* @param \Propel\PropelBundle\Model\Acl\SecurityIdentity $securityIdentity
|
||||
*
|
||||
* @return SecurityIdentityInterface
|
||||
* @return \Symfony\Component\Security\Acl\Model\SecurityIdentityInterface
|
||||
*/
|
||||
public static function toAclIdentity(SecurityIdentity $securityIdentity)
|
||||
static public function toAclIdentity(SecurityIdentity $securityIdentity)
|
||||
{
|
||||
$identifier = $securityIdentity->getIdentifier();
|
||||
|
||||
if ($securityIdentity->getUsername()) {
|
||||
if (false === strpos($identifier, '-')) {
|
||||
throw new InvalidArgumentException('The given identifier does not resolve to a UserSecurityIdentity.');
|
||||
throw new \InvalidArgumentException('The given identifier does not resolve to a UserSecurityIdentity.');
|
||||
}
|
||||
|
||||
list($class, $username) = explode('-', $identifier);
|
||||
|
@ -46,7 +43,7 @@ class SecurityIdentity extends BaseSecurityIdentity
|
|||
return new RoleSecurityIdentity($identifier);
|
||||
}
|
||||
|
||||
throw new InvalidArgumentException('The security identity does not resolve to either UserSecurityIdentity or RoleSecurityIdentity.');
|
||||
throw new \InvalidArgumentException('The security identity does not resolve to either UserSecurityIdentity or RoleSecurityIdentity.');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -56,12 +53,12 @@ class SecurityIdentity extends BaseSecurityIdentity
|
|||
*
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @param SecurityIdentityInterface $aclIdentity
|
||||
* @param PropelPDO $con
|
||||
* @param \Symfony\Component\Security\Acl\Model\SecurityIdentityInterface $aclIdentity
|
||||
* @param \PropelPDO $con
|
||||
*
|
||||
* @return SecurityIdentity
|
||||
* @return \Propel\PropelBundle\Model\Acl\SecurityIdentity
|
||||
*/
|
||||
public static function fromAclIdentity(SecurityIdentityInterface $aclIdentity, PropelPDO $con = null)
|
||||
static public function fromAclIdentity(SecurityIdentityInterface $aclIdentity, \PropelPDO $con = null)
|
||||
{
|
||||
if ($aclIdentity instanceof UserSecurityIdentity) {
|
||||
$identifier = $aclIdentity->getClass().'-'.$aclIdentity->getUsername();
|
||||
|
@ -70,7 +67,7 @@ class SecurityIdentity extends BaseSecurityIdentity
|
|||
$identifier = $aclIdentity->getRole();
|
||||
$username = false;
|
||||
} else {
|
||||
throw new InvalidArgumentException('The ACL identity must either be an instance of UserSecurityIdentity or RoleSecurityIdentity.');
|
||||
throw new \InvalidArgumentException('The ACL identity must either be an instance of UserSecurityIdentity or RoleSecurityIdentity.');
|
||||
}
|
||||
|
||||
$obj = SecurityIdentityQuery::create()
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
|
||||
namespace Propel\PropelBundle\Security\Acl;
|
||||
|
||||
use PropelPDO;
|
||||
use PropelCollection;
|
||||
|
||||
use Propel\PropelBundle\Model\Acl\EntryQuery;
|
||||
use Propel\PropelBundle\Model\Acl\ObjectIdentityQuery;
|
||||
use Propel\PropelBundle\Model\Acl\SecurityIdentity;
|
||||
|
@ -49,11 +46,11 @@ class AclProvider implements AclProviderInterface
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param PermissionGrantingStrategyInterface $permissionGrantingStrategy
|
||||
* @param PropelPDO $con
|
||||
* @param AclCacheInterface $cache
|
||||
* @param \Symfony\Component\Security\Acl\Model\PermissionGrantingStrategyInterface $permissionGrantingStrategy
|
||||
* @param \PropelPDO $con
|
||||
* @param \Symfony\Component\Security\Acl\Model\AclCacheInterface $cache
|
||||
*/
|
||||
public function __construct(PermissionGrantingStrategyInterface $permissionGrantingStrategy, PropelPDO $connection = null, AclCacheInterface $cache = null)
|
||||
public function __construct(PermissionGrantingStrategyInterface $permissionGrantingStrategy, \PropelPDO $connection = null, AclCacheInterface $cache = null)
|
||||
{
|
||||
$this->permissionGrantingStrategy = $permissionGrantingStrategy;
|
||||
$this->connection = $connection;
|
||||
|
@ -63,8 +60,8 @@ class AclProvider implements AclProviderInterface
|
|||
/**
|
||||
* Retrieves all child object identities from the database.
|
||||
*
|
||||
* @param ObjectIdentityInterface $parentObjectIdentity
|
||||
* @param boolean $directChildrenOnly
|
||||
* @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $parentObjectIdentity
|
||||
* @param bool $directChildrenOnly
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
@ -92,12 +89,12 @@ class AclProvider implements AclProviderInterface
|
|||
/**
|
||||
* Returns the ACL that belongs to the given object identity
|
||||
*
|
||||
* @throws AclNotFoundException
|
||||
* @throws \Symfony\Component\Security\Acl\Exception\AclNotFoundException
|
||||
*
|
||||
* @param ObjectIdentityInterface $objectIdentity
|
||||
* @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity
|
||||
* @param array $securityIdentities
|
||||
*
|
||||
* @return AclInterface
|
||||
* @return \Symfony\Component\Security\Acl\Model\AclInterface
|
||||
*/
|
||||
public function findAcl(ObjectIdentityInterface $objectIdentity, array $securityIdentities = array())
|
||||
{
|
||||
|
@ -145,7 +142,7 @@ class AclProvider implements AclProviderInterface
|
|||
/**
|
||||
* Returns the ACLs that belong to the given object identities
|
||||
*
|
||||
* @throws AclNotFoundException When at least one object identity is missing its ACL.
|
||||
* @throws \Symfony\Component\Security\Acl\Exception\AclNotFoundException When at least one object identity is missing its ACL.
|
||||
*
|
||||
* @param array $objectIdentities an array of ObjectIdentityInterface implementations
|
||||
* @param array $securityIdentities an array of SecurityIdentityInterface implementations
|
||||
|
@ -165,15 +162,15 @@ class AclProvider implements AclProviderInterface
|
|||
/**
|
||||
* Create an ACL.
|
||||
*
|
||||
* @param PropelCollection $collection
|
||||
* @param ObjectIdentityInterface $objectIdentity
|
||||
* @param \PropelCollection $collection
|
||||
* @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity
|
||||
* @param array $loadedSecurityIdentities
|
||||
* @param AclInterface $parentAcl
|
||||
* @param \Symfony\Component\Security\Acl\Model\AclInterface $parentAcl
|
||||
* @param bool $inherited
|
||||
*
|
||||
* @return Acl
|
||||
* @return \Propel\PropelBundle\Security\Acl\Domain\Acl
|
||||
*/
|
||||
protected function getAcl(PropelCollection $collection, ObjectIdentityInterface $objectIdentity, array $loadedSecurityIdentities = array(), AclInterface $parentAcl = null, $inherited = true)
|
||||
protected function getAcl(\PropelCollection $collection, ObjectIdentityInterface $objectIdentity, array $loadedSecurityIdentities = array(), AclInterface $parentAcl = null, $inherited = true)
|
||||
{
|
||||
return new Acl($collection, $objectIdentity, $this->permissionGrantingStrategy, $loadedSecurityIdentities, $parentAcl, $inherited);
|
||||
}
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
|
||||
namespace Propel\PropelBundle\Security\Acl;
|
||||
|
||||
use PropelPDO;
|
||||
use PropelCollection;
|
||||
|
||||
use Propel\PropelBundle\Security\Acl\Domain\AuditableAcl;
|
||||
|
||||
use Symfony\Component\Security\Acl\Model\AclInterface;
|
||||
|
@ -26,15 +23,15 @@ class AuditableAclProvider extends MutableAclProvider
|
|||
/**
|
||||
* Get an ACL for this provider.
|
||||
*
|
||||
* @param PropelCollection $collection
|
||||
* @param ObjectIdentityInterface $objectIdentity
|
||||
* @param \PropelCollection $collection
|
||||
* @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity
|
||||
* @param array $loadedSecurityIdentities
|
||||
* @param AclInterface $parentAcl
|
||||
* @param \Symfony\Component\Security\Acl\Model\AclInterface $parentAcl
|
||||
* @param bool $inherited
|
||||
*
|
||||
* @return AuditableAcl
|
||||
* @return \Propel\PropelBundle\Security\Acl\Domain\AuditableAcl
|
||||
*/
|
||||
protected function getAcl(PropelCollection $collection, ObjectIdentityInterface $objectIdentity, array $loadedSecurityIdentities = array(), AclInterface $parentAcl = null, $inherited = true)
|
||||
protected function getAcl(\PropelCollection $collection, ObjectIdentityInterface $objectIdentity, array $loadedSecurityIdentities = array(), AclInterface $parentAcl = null, $inherited = true)
|
||||
{
|
||||
return new AuditableAcl($collection, $objectIdentity, $this->permissionGrantingStrategy, $loadedSecurityIdentities, $parentAcl, $inherited, $this->connection);
|
||||
}
|
||||
|
|
|
@ -10,9 +10,6 @@
|
|||
|
||||
namespace Propel\PropelBundle\Security\Acl\Domain;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use PropelCollection;
|
||||
|
||||
use Propel\PropelBundle\Model\Acl\SecurityIdentity;
|
||||
|
||||
use Symfony\Component\Security\Acl\Exception\Exception as AclException;
|
||||
|
@ -54,14 +51,14 @@ class Acl implements AclInterface
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param PropelCollection $entries
|
||||
* @param ObjectIdentityInterface $objectIdentity
|
||||
* @param PermissionGrantingStrategyInterface $permissionGrantingStrategy
|
||||
* @param \PropelCollection $entries
|
||||
* @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity
|
||||
* @param \Symfony\Component\Security\Acl\Model\PermissionGrantingStrategyInterface $permissionGrantingStrategy
|
||||
* @param array $loadedSecurityIdentities
|
||||
* @param AclInterface $parentAcl
|
||||
* @param boolean $inherited
|
||||
* @param \Symfony\Component\Security\Acl\Model\AclInterface $parentAcl
|
||||
* @param bool $inherited
|
||||
*/
|
||||
public function __construct(PropelCollection $entries, ObjectIdentityInterface $objectIdentity, PermissionGrantingStrategyInterface $permissionGrantingStrategy, array $loadedSecurityIdentities = array(), AclInterface $parentAcl = null, $inherited = true)
|
||||
public function __construct(\PropelCollection $entries, ObjectIdentityInterface $objectIdentity, PermissionGrantingStrategyInterface $permissionGrantingStrategy, array $loadedSecurityIdentities = array(), AclInterface $parentAcl = null, $inherited = true)
|
||||
{
|
||||
if ($entries->getModel() !== $this->model) {
|
||||
throw new AclException(sprintf('The given collection does not contain models of class "%s" but of class "%s".', $this->model, $entries->getModel()));
|
||||
|
@ -151,7 +148,7 @@ class Acl implements AclInterface
|
|||
/**
|
||||
* Returns the object identity associated with this ACL
|
||||
*
|
||||
* @return ObjectIdentityInterface
|
||||
* @return \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface
|
||||
*/
|
||||
public function getObjectIdentity()
|
||||
{
|
||||
|
@ -161,7 +158,7 @@ class Acl implements AclInterface
|
|||
/**
|
||||
* Returns the parent ACL, or null if there is none.
|
||||
*
|
||||
* @return AclInterface|null
|
||||
* @return \Symfony\Component\Security\Acl\Model\AclInterface|null
|
||||
*/
|
||||
public function getParentAcl()
|
||||
{
|
||||
|
@ -171,7 +168,7 @@ class Acl implements AclInterface
|
|||
/**
|
||||
* Whether this ACL is inheriting ACEs from a parent ACL.
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isEntriesInheriting()
|
||||
{
|
||||
|
@ -184,9 +181,9 @@ class Acl implements AclInterface
|
|||
* @param string $field
|
||||
* @param array $masks
|
||||
* @param array $securityIdentities
|
||||
* @param boolean $administrativeMode
|
||||
* @param bool $administrativeMode
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isFieldGranted($field, array $masks, array $securityIdentities, $administrativeMode = false)
|
||||
{
|
||||
|
@ -196,13 +193,13 @@ class Acl implements AclInterface
|
|||
/**
|
||||
* Determines whether access is granted
|
||||
*
|
||||
* @throws NoAceFoundException when no ACE was applicable for this request
|
||||
* @throws \Symfony\Component\Security\Acl\Exception\NoAceFoundException when no ACE was applicable for this request
|
||||
*
|
||||
* @param array $masks
|
||||
* @param array $securityIdentities
|
||||
* @param boolean $administrativeMode
|
||||
* @param bool $administrativeMode
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isGranted(array $masks, array $securityIdentities, $administrativeMode = false)
|
||||
{
|
||||
|
@ -212,11 +209,11 @@ class Acl implements AclInterface
|
|||
/**
|
||||
* Whether the ACL has loaded ACEs for all of the passed security identities
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @param mixed $securityIdentities an implementation of SecurityIdentityInterface, or an array thereof
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isSidLoaded($securityIdentities)
|
||||
{
|
||||
|
@ -228,7 +225,7 @@ class Acl implements AclInterface
|
|||
|
||||
foreach ($securityIdentities as $eachSecurityIdentity) {
|
||||
if (!$eachSecurityIdentity instanceof SecurityIdentityInterface) {
|
||||
throw new InvalidArgumentException('At least one entry of the given list is not implementing the "SecurityIdentityInterface".');
|
||||
throw new \InvalidArgumentException('At least one entry of the given list is not implementing the "SecurityIdentityInterface".');
|
||||
}
|
||||
|
||||
$modelIdentity = SecurityIdentity::fromAclIdentity($eachSecurityIdentity);
|
||||
|
@ -309,7 +306,7 @@ class Acl implements AclInterface
|
|||
*
|
||||
* @param string $field
|
||||
*
|
||||
* @return MutableAcl $this
|
||||
* @return \Propel\PropelBundle\Security\Acl\Domain\Acl $this
|
||||
*/
|
||||
protected function updateFields($field)
|
||||
{
|
||||
|
|
|
@ -10,11 +10,6 @@
|
|||
|
||||
namespace Propel\PropelBundle\Security\Acl\Domain;
|
||||
|
||||
use InvalidArgumentException;
|
||||
|
||||
use PropelPDO;
|
||||
use PropelCollection;
|
||||
|
||||
use Propel\PropelBundle\Model\Acl\Entry as ModelEntry;
|
||||
|
||||
use Symfony\Component\Security\Acl\Model\AclInterface;
|
||||
|
@ -83,19 +78,19 @@ class AuditableAcl extends MutableAcl implements AuditableAclInterface
|
|||
/**
|
||||
* Update auditing on a single ACE.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @param array $list
|
||||
* @param int $index
|
||||
* @param bool $auditSuccess
|
||||
* @param bool $auditFailure
|
||||
*
|
||||
* @return AuditableAcl $this
|
||||
* @return \Propel\PropelBundle\Security\Acl\Domain\AuditableAcl $this
|
||||
*/
|
||||
protected function updateAuditing(array &$list, $index, $auditSuccess, $auditFailure)
|
||||
{
|
||||
if (!is_bool($auditSuccess) or !is_bool($auditFailure)) {
|
||||
throw new InvalidArgumentException('The given auditing flags are invalid. Please provide boolean only.');
|
||||
throw new \InvalidArgumentException('The given auditing flags are invalid. Please provide boolean only.');
|
||||
}
|
||||
|
||||
$this->validateIndex($list, $index);
|
||||
|
|
|
@ -22,7 +22,7 @@ use Symfony\Component\Security\Acl\Model\SecurityIdentityInterface;
|
|||
*
|
||||
* The entry is only used to grab a "snapshot" of its data as an EntryInterface is immutable!
|
||||
*
|
||||
* @see Symfony\Component\Security\Acl\Model\EntryInterface
|
||||
* @see \Symfony\Component\Security\Acl\Model\EntryInterface
|
||||
*
|
||||
* @author Toni Uebernickel <tuebernickel@gmail.com>
|
||||
*/
|
||||
|
@ -41,8 +41,8 @@ class Entry implements AuditableEntryInterface
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ModelEntry $entry
|
||||
* @param AclInterface $acl
|
||||
* @param \Propel\PropelBundle\Model\Acl\Entry $entry
|
||||
* @param \Symfony\Component\Security\Acl\Model\AclInterface $acl
|
||||
*/
|
||||
public function __construct(ModelEntry $entry, AclInterface $acl)
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ class Entry implements AuditableEntryInterface
|
|||
/**
|
||||
* The ACL this ACE is associated with.
|
||||
*
|
||||
* @return AclInterface
|
||||
* @return \Symfony\Component\Security\Acl\Model\AclInterface
|
||||
*/
|
||||
public function getAcl()
|
||||
{
|
||||
|
@ -123,7 +123,7 @@ class Entry implements AuditableEntryInterface
|
|||
/**
|
||||
* The security identity associated with this ACE
|
||||
*
|
||||
* @return SecurityIdentityInterface
|
||||
* @return \Symfony\Component\Security\Acl\Model\SecurityIdentityInterface
|
||||
*/
|
||||
public function getSecurityIdentity()
|
||||
{
|
||||
|
@ -163,7 +163,7 @@ class Entry implements AuditableEntryInterface
|
|||
/**
|
||||
* Returns whether this ACE is granting, or denying
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isGranting()
|
||||
{
|
||||
|
@ -173,7 +173,7 @@ class Entry implements AuditableEntryInterface
|
|||
/**
|
||||
* Whether auditing for successful grants is turned on
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isAuditFailure()
|
||||
{
|
||||
|
@ -183,7 +183,7 @@ class Entry implements AuditableEntryInterface
|
|||
/**
|
||||
* Whether auditing for successful denies is turned on
|
||||
*
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isAuditSuccess()
|
||||
{
|
||||
|
|
|
@ -14,14 +14,13 @@ use Propel\PropelBundle\Model\Acl\Entry as ModelEntry;
|
|||
|
||||
use Symfony\Component\Security\Acl\Model\AclInterface;
|
||||
use Symfony\Component\Security\Acl\Model\FieldEntryInterface;
|
||||
use Symfony\Component\Security\Acl\Model\SecurityIdentityInterface;
|
||||
|
||||
/**
|
||||
* An ACE implementation retrieving data from a given Propel\PropelBundle\Model\Acl\Entry.
|
||||
* An ACE implementation retrieving data from a given \Propel\PropelBundle\Model\Acl\Entry.
|
||||
*
|
||||
* The entry is only used to grab a "snapshot" of its data as an EntryInterface is immutable!
|
||||
* The entry is only used to grab a "snapshot" of its data as an \Symfony\Component\Security\Acl\Model\EntryInterface is immutable!
|
||||
*
|
||||
* @see Symfony\Component\Security\Acl\Model\EntryInterface
|
||||
* @see \Symfony\Component\Security\Acl\Model\EntryInterface
|
||||
*
|
||||
* @author Toni Uebernickel <tuebernickel@gmail.com>
|
||||
*/
|
||||
|
@ -32,8 +31,8 @@ class FieldEntry extends Entry implements FieldEntryInterface
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param ModelEntry $entry
|
||||
* @param AclInterface $acl
|
||||
* @param \Propel\PropelBundle\Model\Acl\Entry $entry
|
||||
* @param \Symfony\Component\Security\Acl\Model\AclInterface $acl
|
||||
*/
|
||||
public function __construct(ModelEntry $entry, AclInterface $acl)
|
||||
{
|
||||
|
|
|
@ -10,11 +10,6 @@
|
|||
|
||||
namespace Propel\PropelBundle\Security\Acl\Domain;
|
||||
|
||||
use PropelPDO;
|
||||
use PropelCollection;
|
||||
use OutOfBoundsException;
|
||||
use InvalidArgumentException;
|
||||
|
||||
use Propel\PropelBundle\Model\Acl\Entry as ModelEntry;
|
||||
use Propel\PropelBundle\Model\Acl\SecurityIdentity;
|
||||
use Propel\PropelBundle\Model\Acl\ObjectIdentity;
|
||||
|
@ -46,38 +41,38 @@ class MutableAcl extends Acl implements MutableAclInterface
|
|||
/**
|
||||
* A list of all ACL entries from the database.
|
||||
*
|
||||
* Contains instances of Propel\PropelBundle\Model\Acl\Entry.
|
||||
* Contains instances of \Propel\PropelBundle\Model\Acl\Entry.
|
||||
*
|
||||
* @var PropelCollection
|
||||
* @var \PropelCollection
|
||||
*/
|
||||
protected $entries;
|
||||
|
||||
/**
|
||||
* A reference to the ObjectIdentity this ACL is mapped to.
|
||||
*
|
||||
* @var ObjectIdentity
|
||||
* @var \Propel\PropelBundle\Model\Acl\ObjectIdentity
|
||||
*/
|
||||
protected $modelObjectIdentity;
|
||||
|
||||
/**
|
||||
* A connection to be used for all changes on the ACL.
|
||||
*
|
||||
* @var PropelPDO
|
||||
* @var \PropelPDO
|
||||
*/
|
||||
protected $con;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param PropelCollection $entries
|
||||
* @param ObjectIdentityInterface $objectIdentity
|
||||
* @param PermissionGrantingStrategyInterface $permissionGrantingStrategy
|
||||
* @param \PropelCollection $entries
|
||||
* @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity
|
||||
* @param \Symfony\Component\Security\Acl\Model\PermissionGrantingStrategyInterface $permissionGrantingStrategy
|
||||
* @param array $loadedSecurityIdentities
|
||||
* @param AclInterface $parentAcl
|
||||
* @param boolean $inherited
|
||||
* @param PropelPDO $con
|
||||
* @param \Symfony\Component\Security\Acl\Model\AclInterface $parentAcl
|
||||
* @param bool $inherited
|
||||
* @param \PropelPDO $con
|
||||
*/
|
||||
public function __construct(PropelCollection $entries, ObjectIdentityInterface $objectIdentity, PermissionGrantingStrategyInterface $permissionGrantingStrategy, array $loadedSecurityIdentities = array(), AclInterface $parentAcl = null, $inherited = true, PropelPDO $con = null)
|
||||
public function __construct(\PropelCollection $entries, ObjectIdentityInterface $objectIdentity, PermissionGrantingStrategyInterface $permissionGrantingStrategy, array $loadedSecurityIdentities = array(), AclInterface $parentAcl = null, $inherited = true, \PropelPDO $con = null)
|
||||
{
|
||||
parent::__construct($entries, $objectIdentity, $permissionGrantingStrategy, $loadedSecurityIdentities, $parentAcl, $inherited);
|
||||
|
||||
|
@ -110,7 +105,7 @@ class MutableAcl extends Acl implements MutableAclInterface
|
|||
/**
|
||||
* Sets whether entries are inherited
|
||||
*
|
||||
* @param boolean $boolean
|
||||
* @param bool $boolean
|
||||
*/
|
||||
public function setEntriesInheriting($boolean)
|
||||
{
|
||||
|
@ -120,7 +115,7 @@ class MutableAcl extends Acl implements MutableAclInterface
|
|||
/**
|
||||
* Sets the parent ACL
|
||||
*
|
||||
* @param AclInterface|null $acl
|
||||
* @param \Symfony\Component\Security\Acl\Model\AclInterface|null $acl
|
||||
*/
|
||||
public function setParentAcl(AclInterface $acl = null)
|
||||
{
|
||||
|
@ -178,10 +173,10 @@ class MutableAcl extends Acl implements MutableAclInterface
|
|||
/**
|
||||
* Inserts a class-based ACE
|
||||
*
|
||||
* @param SecurityIdentityInterface $securityIdentity
|
||||
* @param \Symfony\Component\Security\Acl\Model\SecurityIdentityInterface $securityIdentity
|
||||
* @param integer $mask
|
||||
* @param integer $index
|
||||
* @param boolean $granting
|
||||
* @param bool $granting
|
||||
* @param string $strategy
|
||||
*/
|
||||
public function insertClassAce(SecurityIdentityInterface $securityIdentity, $mask, $index = 0, $granting = true, $strategy = null)
|
||||
|
@ -193,7 +188,7 @@ class MutableAcl extends Acl implements MutableAclInterface
|
|||
* Inserts a class-field-based ACE
|
||||
*
|
||||
* @param string $field
|
||||
* @param SecurityIdentityInterface $securityIdentity
|
||||
* @param \Symfony\Component\Security\Acl\Model\SecurityIdentityInterface $securityIdentity
|
||||
* @param integer $mask
|
||||
* @param integer $index
|
||||
* @param boolean $granting
|
||||
|
@ -211,7 +206,7 @@ class MutableAcl extends Acl implements MutableAclInterface
|
|||
/**
|
||||
* Inserts an object-based ACE
|
||||
*
|
||||
* @param SecurityIdentityInterface $securityIdentity
|
||||
* @param \Symfony\Component\Security\Acl\Model\SecurityIdentityInterface $securityIdentity
|
||||
* @param integer $mask
|
||||
* @param integer $index
|
||||
* @param boolean $granting
|
||||
|
@ -226,7 +221,7 @@ class MutableAcl extends Acl implements MutableAclInterface
|
|||
* Inserts an object-field-based ACE
|
||||
*
|
||||
* @param string $field
|
||||
* @param SecurityIdentityInterface $securityIdentity
|
||||
* @param \Symfony\Component\Security\Acl\Model\SecurityIdentityInterface $securityIdentity
|
||||
* @param integer $mask
|
||||
* @param integer $index
|
||||
* @param boolean $granting
|
||||
|
@ -356,9 +351,9 @@ class MutableAcl extends Acl implements MutableAclInterface
|
|||
*
|
||||
* @param array $list
|
||||
* @param int $index
|
||||
* @param Entry $entry
|
||||
* @param \Propel\PropelBundle\Model\Acl\Entry\Entry $entry
|
||||
*
|
||||
* @return MutableAcl $this
|
||||
* @return \Propel\PropelBundle\Security\Acl\Domain\MutableAcl $this
|
||||
*/
|
||||
protected function insertToList(array &$list, $index, Entry $entry)
|
||||
{
|
||||
|
@ -386,7 +381,7 @@ class MutableAcl extends Acl implements MutableAclInterface
|
|||
* @param string $strategy
|
||||
* @param string $field
|
||||
*
|
||||
* @return MutableAcl $this
|
||||
* @return \Propel\PropelBundle\Security\Acl\Domain\MutableAcl $this
|
||||
*/
|
||||
protected function updateAce(array &$list, $index, $mask, $strategy = null)
|
||||
{
|
||||
|
@ -413,7 +408,7 @@ class MutableAcl extends Acl implements MutableAclInterface
|
|||
* @param array $list
|
||||
* @param $index
|
||||
*
|
||||
* @return MutableAcl $this
|
||||
* @return \Propel\PropelBundle\Security\Acl\Domain\MutableAcl $this
|
||||
*/
|
||||
protected function deleteIndex(array &$list, $index)
|
||||
{
|
||||
|
@ -427,18 +422,18 @@ class MutableAcl extends Acl implements MutableAclInterface
|
|||
/**
|
||||
* Validate the index on the given list of ACEs.
|
||||
*
|
||||
* @throws OutOfBoundsException
|
||||
* @throws \OutOfBoundsException
|
||||
*
|
||||
* @param array $list
|
||||
* @param int $index
|
||||
*
|
||||
* @return MutableAcl $this
|
||||
* @return \Propel\PropelBundle\Security\Acl\Domain\MutableAcl $this
|
||||
*/
|
||||
protected function isWithinBounds(array &$list, $index)
|
||||
{
|
||||
// No count()-1, the count is one ahead of index, and could create the next valid entry!
|
||||
if ($index < 0 or $index > count($list)) {
|
||||
throw new OutOfBoundsException(sprintf('The index must be in the interval [0, %d].', count($list)));
|
||||
throw new \OutOfBoundsException(sprintf('The index must be in the interval [0, %d].', count($list)));
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@ -447,17 +442,17 @@ class MutableAcl extends Acl implements MutableAclInterface
|
|||
/**
|
||||
* Check the index for existence in the given list.
|
||||
*
|
||||
* @throws OutOfBoundsException
|
||||
* @throws \OutOfBoundsException
|
||||
*
|
||||
* @param array $list
|
||||
* @param $index
|
||||
*
|
||||
* @return MutableAcl $this
|
||||
* @return \Propel\PropelBundle\Security\Acl\Domain\MutableAcl $this
|
||||
*/
|
||||
protected function validateIndex(array &$list, $index)
|
||||
{
|
||||
if (!isset($list[$index])) {
|
||||
throw new OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
|
||||
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@ -466,17 +461,17 @@ class MutableAcl extends Acl implements MutableAclInterface
|
|||
/**
|
||||
* Validate the given field to be present.
|
||||
*
|
||||
* @throws InvalidArgumentException
|
||||
* @throws \InvalidArgumentException
|
||||
*
|
||||
* @param array $list
|
||||
* @param string $field
|
||||
*
|
||||
* @return MutableAcl $this
|
||||
* @return \Propel\PropelBundle\Security\Acl\Domain\MutableAcl $this
|
||||
*/
|
||||
protected function validateField(array &$list, $field)
|
||||
{
|
||||
if (!isset($list[$field])) {
|
||||
throw new InvalidArgumentException(sprintf('The given field "%s" does not exist.', $field));
|
||||
throw new \InvalidArgumentException(sprintf('The given field "%s" does not exist.', $field));
|
||||
}
|
||||
|
||||
return $this;
|
||||
|
@ -488,7 +483,7 @@ class MutableAcl extends Acl implements MutableAclInterface
|
|||
* @param array $list
|
||||
* @param int $index The right boundary to which the list is valid.
|
||||
*
|
||||
* @return MutableAcl $this
|
||||
* @return \Propel\PropelBundle\Security\Acl\Domain\MutableAcl $this
|
||||
*/
|
||||
protected function reorderList(array &$list, $index)
|
||||
{
|
||||
|
@ -505,17 +500,17 @@ class MutableAcl extends Acl implements MutableAclInterface
|
|||
*
|
||||
* @param int $mask
|
||||
* @param int $index
|
||||
* @param SecurityIdentityInterface $securityIdentity
|
||||
* @param \Symfony\Component\Security\Acl\Model\SecurityIdentityInterface $securityIdentity
|
||||
* @param string $strategy
|
||||
* @param bool $granting
|
||||
* @param string $field
|
||||
*
|
||||
* @return Entry|FieldEntry
|
||||
* @return \Propel\PropelBundle\Security\Acl\Domain\Entry|\Propel\PropelBundle\Security\Acl\Domain\FieldEntry
|
||||
*/
|
||||
protected function createAce($mask, $index, SecurityIdentityInterface $securityIdentity, $strategy = null, $granting = true, $field = null)
|
||||
{
|
||||
if (!is_int($mask)) {
|
||||
throw new InvalidArgumentException('The given mask is not valid. Please provide an integer.');
|
||||
throw new \InvalidArgumentException('The given mask is not valid. Please provide an integer.');
|
||||
}
|
||||
|
||||
// Compatibility with default implementation
|
||||
|
|
|
@ -10,14 +10,6 @@
|
|||
|
||||
namespace Propel\PropelBundle\Security\Acl;
|
||||
|
||||
use Exception;
|
||||
use InvalidArgumentException;
|
||||
|
||||
use Criteria;
|
||||
use Propel;
|
||||
use PropelPDO;
|
||||
use PropelCollection;
|
||||
|
||||
use Propel\PropelBundle\Model\Acl\Entry as ModelEntry;
|
||||
use Propel\PropelBundle\Model\Acl\EntryPeer;
|
||||
use Propel\PropelBundle\Model\Acl\EntryQuery;
|
||||
|
@ -56,15 +48,15 @@ class MutableAclProvider extends AclProvider implements MutableAclProviderInterf
|
|||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param PermissionGrantingStrategyInterface $permissionGrantingStrategy
|
||||
* @param PropelPDO $connection
|
||||
* @param AclCacheInterface $cache
|
||||
* @param \Symfony\Component\Security\Acl\Model\PermissionGrantingStrategyInterface $permissionGrantingStrategy
|
||||
* @param \PropelPDO $connection
|
||||
* @param \Symfony\Component\Security\Acl\Model\AclCacheInterface $cache
|
||||
*/
|
||||
public function __construct(PermissionGrantingStrategyInterface $permissionGrantingStrategy, PropelPDO $connection = null, AclCacheInterface $cache = null)
|
||||
public function __construct(PermissionGrantingStrategyInterface $permissionGrantingStrategy, \PropelPDO $connection = null, AclCacheInterface $cache = null)
|
||||
{
|
||||
// @codeCoverageIgnoreStart
|
||||
if (null === $connection) {
|
||||
$connection = Propel::getConnection(EntryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
|
||||
$connection = \Propel::getConnection(EntryPeer::DATABASE_NAME, \Propel::CONNECTION_WRITE);
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
|
@ -74,11 +66,11 @@ class MutableAclProvider extends AclProvider implements MutableAclProviderInterf
|
|||
/**
|
||||
* Creates a new ACL for the given object identity.
|
||||
*
|
||||
* @throws AclAlreadyExistsException When there already is an ACL for the given object identity.
|
||||
* @throws \Symfony\Component\Security\Acl\Exception\AclAlreadyExistsException When there already is an ACL for the given object identity.
|
||||
*
|
||||
* @param ObjectIdentityInterface $objectIdentity
|
||||
* @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity
|
||||
*
|
||||
* @return MutableAclInterface
|
||||
* @return \Propel\PropelBundle\Security\Acl\Domain\MutableAcl
|
||||
*/
|
||||
public function createAcl(ObjectIdentityInterface $objectIdentity)
|
||||
{
|
||||
|
@ -106,9 +98,9 @@ class MutableAclProvider extends AclProvider implements MutableAclProviderInterf
|
|||
* This will automatically trigger a delete for any child ACLs. If you don't
|
||||
* want child ACLs to be deleted, you will have to set their parent ACL to null.
|
||||
*
|
||||
* @throws AclException
|
||||
* @throws \Symfony\Component\Security\Acl\Exception\Exception
|
||||
*
|
||||
* @param ObjectIdentityInterface $objectIdentity
|
||||
* @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
|
@ -153,16 +145,16 @@ class MutableAclProvider extends AclProvider implements MutableAclProviderInterf
|
|||
*
|
||||
* Changes to parent ACLs are not persisted.
|
||||
*
|
||||
* @throws AclException
|
||||
* @throws \Symfony\Component\Security\Acl\Exception\Exception
|
||||
*
|
||||
* @param MutableAclInterface $acl
|
||||
* @param \Symfony\Component\Security\Acl\Model\MutableAclInterface $acl
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function updateAcl(MutableAclInterface $acl)
|
||||
{
|
||||
if (!$acl instanceof Acl) {
|
||||
throw new InvalidArgumentException('The given ACL is not tracked by this provider. Please provide Propel\PropelBundle\Security\Acl\Domain\Acl only.');
|
||||
throw new \InvalidArgumentException('The given ACL is not tracked by this provider. Please provide \Propel\PropelBundle\Security\Acl\Domain\Acl only.');
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -218,7 +210,7 @@ class MutableAclProvider extends AclProvider implements MutableAclProviderInterf
|
|||
* Persist the given ACEs.
|
||||
*
|
||||
* @param array $accessControlEntries
|
||||
* @param ObjectIdentity $objectIdentity
|
||||
* @param \Propel\PropelBundle\Model\Acl\ObjectIdentity $objectIdentity
|
||||
* @param bool $object
|
||||
*
|
||||
* @return array The IDs of the persisted ACEs.
|
||||
|
@ -272,9 +264,9 @@ class MutableAclProvider extends AclProvider implements MutableAclProviderInterf
|
|||
*
|
||||
* If none is given, null is returned.
|
||||
*
|
||||
* @param EntryInterface $ace
|
||||
* @param \Symfony\Component\Security\Acl\Model\EntryInterface $ace
|
||||
*
|
||||
* @return ModelEntry|null
|
||||
* @return \Propel\PropelBundle\Model\Acl\Entry|null
|
||||
*/
|
||||
protected function getPersistedAce(EntryInterface $ace, ObjectIdentity $objectIdentity, $object = false)
|
||||
{
|
||||
|
@ -298,13 +290,13 @@ class MutableAclProvider extends AclProvider implements MutableAclProviderInterf
|
|||
if (true === $object) {
|
||||
$ukQuery->filterByObjectIdentity($objectIdentity);
|
||||
} else {
|
||||
$ukQuery->filterByObjectIdentityId(null, Criteria::ISNULL);
|
||||
$ukQuery->filterByObjectIdentityId(null, \Criteria::ISNULL);
|
||||
}
|
||||
|
||||
if ($ace instanceof FieldEntryInterface) {
|
||||
$ukQuery->filterByFieldName($ace->getField());
|
||||
} else {
|
||||
$ukQuery->filterByFieldName(null, Criteria::ISNULL);
|
||||
$ukQuery->filterByFieldName(null, \Criteria::ISNULL);
|
||||
}
|
||||
|
||||
return $ukQuery->findOne($this->connection);
|
||||
|
@ -313,15 +305,15 @@ class MutableAclProvider extends AclProvider implements MutableAclProviderInterf
|
|||
/**
|
||||
* Get an ACL for this provider.
|
||||
*
|
||||
* @param PropelCollection $collection
|
||||
* @param ObjectIdentityInterface $objectIdentity
|
||||
* @param \PropelCollection $collection
|
||||
* @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity
|
||||
* @param array $loadedSecurityIdentities
|
||||
* @param AclInterface $parentAcl
|
||||
* @param \Symfony\Component\Security\Acl\Model\AclInterface $parentAcl
|
||||
* @param bool $inherited
|
||||
*
|
||||
* @return MutableAcl
|
||||
* @return \Propel\PropelBundle\Security\Acl\Domain\MutableAcl
|
||||
*/
|
||||
protected function getAcl(PropelCollection $collection, ObjectIdentityInterface $objectIdentity, array $loadedSecurityIdentities = array(), AclInterface $parentAcl = null, $inherited = true)
|
||||
protected function getAcl(\PropelCollection $collection, ObjectIdentityInterface $objectIdentity, array $loadedSecurityIdentities = array(), AclInterface $parentAcl = null, $inherited = true)
|
||||
{
|
||||
return new MutableAcl($collection, $objectIdentity, $this->permissionGrantingStrategy, $loadedSecurityIdentities, $parentAcl, $inherited, $this->connection);
|
||||
}
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
namespace Propel\PropelBundle\Tests;
|
||||
|
||||
use PropelQuickBuilder;
|
||||
|
||||
use Propel\PropelBundle\Model\Acl\AclClass;
|
||||
use Propel\PropelBundle\Model\Acl\Entry;
|
||||
use Propel\PropelBundle\Model\Acl\ObjectIdentity as ModelObjectIdentity;
|
||||
|
@ -39,7 +37,7 @@ class AclTestCase extends TestCase
|
|||
|
||||
$schema = file_get_contents(__DIR__.'/../Resources/config/acl_schema.xml');
|
||||
|
||||
$builder = new PropelQuickBuilder();
|
||||
$builder = new \PropelQuickBuilder();
|
||||
$builder->setSchema($schema);
|
||||
if (!class_exists('Propel\PropelBundle\Model\Acl\map\AclClassTableMap')) {
|
||||
$builder->setClassTargets(array('tablemap', 'peer', 'object', 'query'));
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
namespace Propel\PropelBundle\Tests\Security\Acl\Domain;
|
||||
|
||||
use PropelCollection;
|
||||
|
||||
use Propel\PropelBundle\Model\Acl\Entry;
|
||||
use Propel\PropelBundle\Model\Acl\SecurityIdentity;
|
||||
|
||||
|
@ -28,7 +26,7 @@ class AclTest extends AclTestCase
|
|||
{
|
||||
public function testConstructorInvalidCollection()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\AclClass');
|
||||
|
||||
$this->setExpectedException('Symfony\Component\Security\Acl\Exception\Exception');
|
||||
|
@ -37,7 +35,7 @@ class AclTest extends AclTestCase
|
|||
|
||||
public function testConstructorEmptyCollection()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
|
||||
$aclObj = $this->getAclObjectIdentity();
|
||||
|
@ -56,7 +54,7 @@ class AclTest extends AclTestCase
|
|||
*/
|
||||
public function testConstructorWithAces()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
|
||||
$obj = $this->createModelObjectIdentity(1);
|
||||
|
@ -125,7 +123,7 @@ class AclTest extends AclTestCase
|
|||
|
||||
public function testIsSidLoadedNoneLoaded()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
$acl = new Acl($collection, $this->getAclObjectIdentity(), new PermissionGrantingStrategy());
|
||||
|
||||
|
@ -134,7 +132,7 @@ class AclTest extends AclTestCase
|
|||
|
||||
public function testIsSidLoadedInvalid()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
|
||||
$aclObj = $this->getAclObjectIdentity();
|
||||
|
@ -146,7 +144,7 @@ class AclTest extends AclTestCase
|
|||
|
||||
public function testIsGrantedNoAces()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
|
||||
$acl = new Acl($collection, $this->getAclObjectIdentity(), new PermissionGrantingStrategy());
|
||||
|
@ -157,7 +155,7 @@ class AclTest extends AclTestCase
|
|||
|
||||
public function testIsGrantedNoMatchingSecurityIdentity()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
|
||||
$entry = $this->createEntry();
|
||||
|
@ -175,7 +173,7 @@ class AclTest extends AclTestCase
|
|||
|
||||
public function testIsFieldGrantedNoAces()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
|
||||
$acl = new Acl($collection, $this->getAclObjectIdentity(), new PermissionGrantingStrategy());
|
||||
|
@ -186,7 +184,7 @@ class AclTest extends AclTestCase
|
|||
|
||||
public function testSerializeUnserialize()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
|
||||
$entry = $this->createEntry();
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
namespace Propel\PropelBundle\Tests\Security\Acl\Domain;
|
||||
|
||||
use PropelCollection;
|
||||
|
||||
use Propel\PropelBundle\Model\Acl\Entry;
|
||||
use Propel\PropelBundle\Model\Acl\SecurityIdentity;
|
||||
|
||||
|
@ -28,7 +26,7 @@ class AuditableAclTest extends AclTestCase
|
|||
{
|
||||
public function testUpdateAuditingInvalidIndex()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
|
||||
$acl = new AuditableAcl($collection, $this->getAclObjectIdentity(), new PermissionGrantingStrategy());
|
||||
|
@ -39,7 +37,7 @@ class AuditableAclTest extends AclTestCase
|
|||
|
||||
public function testUpdateAuditingInvalidField()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
|
||||
$obj = $this->createModelObjectIdentity(1);
|
||||
|
@ -59,7 +57,7 @@ class AuditableAclTest extends AclTestCase
|
|||
|
||||
public function testUpdateAuditingInvalidFlag()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
|
||||
$obj = $this->createModelObjectIdentity(1);
|
||||
|
@ -78,7 +76,7 @@ class AuditableAclTest extends AclTestCase
|
|||
|
||||
public function testUpdateObjectAuditing()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
|
||||
$obj = $this->createModelObjectIdentity(1);
|
||||
|
@ -120,7 +118,7 @@ class AuditableAclTest extends AclTestCase
|
|||
*/
|
||||
public function testUpdateObjectFieldAuditing()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
|
||||
$obj = $this->createModelObjectIdentity(1);
|
||||
|
@ -154,7 +152,7 @@ class AuditableAclTest extends AclTestCase
|
|||
*/
|
||||
public function testUpdateClassAuditing()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
|
||||
$entry = $this->createEntry();
|
||||
|
@ -185,7 +183,7 @@ class AuditableAclTest extends AclTestCase
|
|||
*/
|
||||
public function testUpdateClassFieldAuditing()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
|
||||
$entry = $this->createEntry();
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
namespace Propel\PropelBundle\Tests\Security\Acl\Domain;
|
||||
|
||||
use PropelCollection;
|
||||
|
||||
use Propel\PropelBundle\Model\Acl\Entry as ModelEntry;
|
||||
use Propel\PropelBundle\Model\Acl\SecurityIdentity;
|
||||
|
||||
|
@ -29,7 +27,7 @@ class EntryTest extends AclTestCase
|
|||
{
|
||||
public function testConstruct()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
$acl = new Acl($collection, $this->getAclObjectIdentity(), new PermissionGrantingStrategy());
|
||||
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
namespace Propel\PropelBundle\Tests\Security\Acl\Domain;
|
||||
|
||||
use PropelCollection;
|
||||
|
||||
use Propel\PropelBundle\Model\Acl\Entry as ModelEntry;
|
||||
use Propel\PropelBundle\Model\Acl\SecurityIdentity;
|
||||
|
||||
|
@ -29,7 +27,7 @@ class FieldEntryTest extends AclTestCase
|
|||
{
|
||||
public function testConstruct()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
$acl = new Acl($collection, $this->getAclObjectIdentity(), new PermissionGrantingStrategy());
|
||||
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
namespace Propel\PropelBundle\Tests\Security\Acl\Domain;
|
||||
|
||||
use PropelCollection;
|
||||
|
||||
use Propel\PropelBundle\Model\Acl\Entry;
|
||||
use Propel\PropelBundle\Model\Acl\SecurityIdentity;
|
||||
|
||||
|
@ -29,7 +27,7 @@ class MutableAclTest extends AclTestCase
|
|||
{
|
||||
public function testConstructorInvalidCollection()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\AclClass');
|
||||
|
||||
$this->setExpectedException('Symfony\Component\Security\Acl\Exception\Exception');
|
||||
|
@ -227,7 +225,7 @@ class MutableAclTest extends AclTestCase
|
|||
*/
|
||||
public function testUpdatePersistedAceKeepsId()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
|
||||
$entry = $this->createEntry();
|
||||
|
@ -248,7 +246,7 @@ class MutableAclTest extends AclTestCase
|
|||
|
||||
public function testSerializeUnserialize()
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
|
||||
$entry = $this->createEntry();
|
||||
|
@ -270,7 +268,7 @@ class MutableAclTest extends AclTestCase
|
|||
|
||||
protected function createEmptyAcl($identifier = 1, array $securityIdentities = array(), AclInterface $parentAcl = null, $inherited = null)
|
||||
{
|
||||
$collection = new PropelCollection();
|
||||
$collection = new \PropelCollection();
|
||||
$collection->setModel('Propel\PropelBundle\Model\Acl\Entry');
|
||||
|
||||
return new MutableAcl($collection, $this->getAclObjectIdentity($identifier), new PermissionGrantingStrategy(), $securityIdentities, $parentAcl, $inherited, $this->con);
|
||||
|
|
|
@ -10,8 +10,6 @@
|
|||
|
||||
namespace Propel\PropelBundle\Tests\Security\Acl;
|
||||
|
||||
use Criteria;
|
||||
|
||||
use Propel\PropelBundle\Model\Acl\EntryQuery;
|
||||
use Propel\PropelBundle\Model\Acl\ObjectIdentityQuery;
|
||||
|
||||
|
@ -100,7 +98,7 @@ class MutableAclProviderTest extends AclTestCase
|
|||
$acl->setParentAcl($parentAcl);
|
||||
$this->getAclProvider()->updateAcl($acl);
|
||||
|
||||
$entries = ObjectIdentityQuery::create()->orderById(Criteria::ASC)->find($this->con);
|
||||
$entries = ObjectIdentityQuery::create()->orderById(\Criteria::ASC)->find($this->con);
|
||||
$this->assertCount(2, $entries);
|
||||
$this->assertNull($entries[0]->getParentObjectIdentityId());
|
||||
$this->assertEquals($entries[0]->getId(), $entries[1]->getParentObjectIdentityId());
|
||||
|
@ -149,7 +147,7 @@ class MutableAclProviderTest extends AclTestCase
|
|||
|
||||
$this->getAclProvider()->updateAcl($acl);
|
||||
|
||||
$entries = EntryQuery::create()->orderByMask(Criteria::ASC)->find($this->con);
|
||||
$entries = EntryQuery::create()->orderByMask(\Criteria::ASC)->find($this->con);
|
||||
$this->assertCount(3, $entries);
|
||||
|
||||
$slugAce = $entries[0];
|
||||
|
|
Loading…
Reference in a new issue