/**
  * Filter by an ObjectIdentity object belonging to the given ACL related ObjectIdentity.
  *
  * @param \Symfony\Component\Security\Acl\Model\ObjectIdentityInterface $objectIdentity
  * @param \PropelPDO                                                    $con
  *
  * @return \Propel\Bundle\PropelAclBundle\Model\Acl\ObjectIdentityQuery $this
  */
 public function filterByAclObjectIdentity(ObjectIdentityInterface $objectIdentity, \PropelPDO $con = null)
 {
     /*
      * Not using a JOIN here, because the filter may be applied on 'findOneOrCreate',
      * which is currently (Propel 1.6.4-dev) not working.
      */
     $aclClass = AclClass::fromAclObjectIdentity($objectIdentity, $con);
     $this->filterByClassId($aclClass->getId())->filterByIdentifier($objectIdentity->getIdentifier());
     return $this;
 }
Ejemplo n.º 2
0
 public function testFromAclObjectIdentity()
 {
     $type = 'Merchant';
     $aclClass = AclClass::fromAclObjectIdentity(new ObjectIdentity(5, $type), $this->con);
     $this->assertInstanceOf('Propel\\Bundle\\PropelAclBundle\\Model\\Acl\\AclClass', $aclClass);
     $this->assertEquals($type, $aclClass->getType());
     $dbEntry = AclClassPeer::doSelectOne(new Criteria(), $this->con);
     $this->assertInstanceOf('Propel\\Bundle\\PropelAclBundle\\Model\\Acl\\AclClass', $dbEntry);
     $this->assertEquals($type, $dbEntry->getType());
     $this->assertEquals($dbEntry->getId(), $aclClass->getId());
 }
 public function testFilterByAclObjectIdentity()
 {
     $aclObj = new ObjectIdentity(1, 'Propel\\Bundle\\PropelAclBundle\\Tests\\Fixtures\\Model\\Book');
     $aclClass = AclClass::fromAclObjectIdentity($aclObj, $this->con);
     $this->assertInstanceOf('Propel\\Bundle\\PropelAclBundle\\Model\\Acl\\AclClass', $aclClass);
     // None given.
     $result = ObjectIdentityQuery::create()->filterByAclObjectIdentity($aclObj, $this->con)->find($this->con);
     $this->assertCount(0, $result);
     $this->createModelObjectIdentity(1);
     $result = ObjectIdentityQuery::create()->filterByAclObjectIdentity($aclObj, $this->con)->find($this->con);
     $this->assertCount(1, $result);
     $this->assertEquals($aclClass->getId(), $result->getFirst()->getClassId());
     $this->assertEquals(1, $result->getFirst()->getIdentifier());
     // Change the entity.
     $aclObj = new ObjectIdentity(2, 'Propel\\Bundle\\PropelAclBundle\\Tests\\Fixtures\\Model\\Book');
     $result = ObjectIdentityQuery::create()->filterByAclObjectIdentity($aclObj, $this->con)->find($this->con);
     $this->assertCount(0, $result);
 }
Ejemplo n.º 4
0
 protected function getAclClass()
 {
     return AclClass::fromAclObjectIdentity($this->getAclObjectIdentity(), $this->con);
 }