Example #1
0
 /**
  * @depends testToAclEntry
  */
 public function testToAclEntryFieldEntry()
 {
     $acl = $this->getMock('Propel\\PropelBundle\\Security\\Acl\\Domain\\AuditableAcl', array(), array(), '', false, false);
     $entry = $this->createModelEntry();
     $entry->setFieldName('name');
     $aclEntry = ModelEntry::toAclEntry($entry, $acl);
     $this->assertInstanceOf('Propel\\PropelBundle\\Security\\Acl\\Domain\\FieldEntry', $aclEntry);
 }
 /**
  * Update auditing on a single ACE.
  *
  * @throws \InvalidArgumentException
  *
  * @param array $list
  * @param int   $index
  * @param bool  $auditSuccess
  * @param bool  $auditFailure
  *
  * @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.');
     }
     $this->validateIndex($list, $index);
     $entry = ModelEntry::fromAclEntry($list[$index])->setAuditSuccess($auditSuccess)->setAuditFailure($auditFailure);
     $list[$index] = ModelEntry::toAclEntry($entry, $this);
     return $this;
 }
 /**
  * Update a single ACE of this ACL.
  *
  * @param array  $list
  * @param int    $index
  * @param int    $mask
  * @param string $strategy
  * @param string $field
  *
  * @return \Propel\PropelBundle\Security\Acl\Domain\MutableAcl $this
  */
 protected function updateAce(array &$list, $index, $mask, $strategy = null)
 {
     $this->validateIndex($list, $index);
     $entry = ModelEntry::fromAclEntry($list[$index]);
     // Apply updates
     $entry->setMask($mask);
     if (null !== $strategy) {
         $entry->setGrantingStrategy($strategy);
     }
     $list[$index] = ModelEntry::toAclEntry($entry, $this);
     return $this;
 }