public function isGranted($grantees, AclTargetIdentity $target, $permissions, $fallbackVote = Voter::ACCESS_DENIED) { if (null === $target->getFieldName()) { return parent::isGranted($grantees, $target, $permissions, $fallbackVote); } if ($this->isACLEmpty($grantees, $target)) { $target = null !== $target->getObjectIdentifier() ? $this->targetFactory->createObjectIdentity(array($target->getClassName(), $target->getObjectIdentifier())) : $this->targetFactory->createClassIdentity($target->getClassName()); } if ($this->isACLEmpty($grantees, $target)) { return $fallbackVote; } return parent::isGranted($grantees, $target, $permissions, $fallbackVote); }
public function isGranted($grantees, AclTargetIdentity $target, $permissions, $fallbackVote = Voter::ACCESS_DENIED) { if (null !== $target->getObjectIdentifier()) { return parent::isGranted($grantees, $target, $permissions, $fallbackVote); } $factoryMethod = null === $target->getFieldName() ? 'createClassIdentity' : 'createClassFieldIdentity'; $class = null; while ($this->isACLEmpty($grantees, $target) && false !== ($class = get_parent_class($target->getClassName()))) { $target = $this->targetFactory->{$factoryMethod}($class, $target->getFieldName()); } if (false === $class) { return $fallbackVote; } return parent::isGranted($grantees, $target, $permissions, $fallbackVote); }
public function equals(AclTargetIdentityInterface $identity) { return $identity->getClassName() === $this->getClassName() && $identity->getObjectIdentifier() === $this->getObjectIdentifier() && $identity->getFieldName() === $this->getFieldName(); }
protected function hasBeenVisited(AclTargetIdentity $target, array &$visited) { return isset($visited[$this->getKeyForIdentityPart($target->getClassName())][$this->getKeyForIdentityPart($target->getObjectIdentifier())][$this->getKeyForIdentityPart($target->getFieldName())]); }