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); }
protected function checkAccess($grantees, AclTargetIdentity &$target, $permissions, $fallbackVote, &$queue, &$visisted) { if ($this->hasBeenVisited($target, $visited)) { return Voter::ACCESS_ABSTAIN; } $this->markAsVisited($target, $visited); if (!$this->isACLEmpty($grantees, $target)) { return parent::isGranted($grantees, $target, $permissions, $fallbackVote); } if (null !== $target->getObjectIdentifier()) { $queue[] = null === $target->getFieldName() ? $this->targetFactory->createClassIdentity($target->getClassName()) : $this->targetFactory->createClassFieldIdentity($target->getClassName(), $target->getFieldName()); } if (null !== $target->getFieldName()) { $queue[] = null !== $target->getObjectIdentifier() ? $this->targetFactory->createObjectIdentity(array($target->getClassName(), $target->getObjectIdentifier())) : $this->targetFactory->createClassIdentity($target->getClassName()); } if (null === $target->getObjectIdentifier() && false !== ($class = get_parent_class($target->getClassName()))) { $queue[] = null === $target->getFieldName() ? $this->targetFactory->createClassIdentity($class) : $this->targetFactory->createClassFieldIdentity($class, $target->getFieldName()); } return Voter::ACCESS_ABSTAIN; }