示例#1
0
 /**
  * Performs some checks if logging was requested.
  *
  * @param bool           $granted
  * @param EntryInterface $ace
  */
 public function logIfNeeded($granted, EntryInterface $ace)
 {
     if (!$ace instanceof AuditableEntryInterface) {
         return;
     }
     if ($granted && $ace->isAuditSuccess()) {
         $this->doLog($granted, $ace);
     } elseif (!$granted && $ace->isAuditFailure()) {
         $this->doLog($granted, $ace);
     }
 }
示例#2
0
文件: Entry.php 项目: naldz/cyberden
 /**
  * Transform a given ACL entry into a Entry model.
  *
  * The entry will not be persisted!
  *
  * @param \Symfony\Component\Security\Acl\Model\EntryInterface $aclEntry
  *
  * @return \Propel\Bundle\PropelBundle\Model\Acl\Entry
  */
 public static function fromAclEntry(EntryInterface $aclEntry)
 {
     $entry = new self();
     // Already persisted before?
     if ($aclEntry->getId()) {
         $entry->setId($aclEntry->getId());
     }
     $entry->setMask($aclEntry->getMask())->setGranting($aclEntry->isGranting())->setGrantingStrategy($aclEntry->getStrategy())->setSecurityIdentity(SecurityIdentity::fromAclIdentity($aclEntry->getSecurityIdentity()));
     if ($aclEntry instanceof FieldEntryInterface) {
         $entry->setFieldName($aclEntry->getField());
     }
     if ($aclEntry instanceof AuditableEntryInterface) {
         $entry->setAuditFailure($aclEntry->isAuditFailure())->setAuditSuccess($aclEntry->isAuditSuccess());
     }
     return $entry;
 }