/** * {@inheritdoc} */ public function vote(TokenInterface $token, $object, array $attributes) { $this->securityToken = $token; $this->object = $object instanceof FieldVote ? $object->getDomainObject() : $object; list($this->object, $group) = $this->separateAclGroupFromObject($this->object); try { $this->extension = $this->extensionSelector->select($this->object); } catch (InvalidDomainObjectException $e) { return self::ACCESS_ABSTAIN; } // replace empty permissions with default ones $attributesCount = count($attributes); for ($i = 0; $i < $attributesCount; $i++) { if (empty($attributes[$i])) { $attributes[$i] = $this->extension->getDefaultPermission(); } } //check acl group $result = $this->checkAclGroup($group); if ($result !== self::ACCESS_DENIED) { $result = parent::vote($token, $this->object, $attributes); //check organization context $result = $this->checkOrganizationContext($result); } $this->extension = null; $this->object = null; $this->securityToken = null; $this->triggeredMask = null; if ($this->oneShotIsGrantedObserver) { $this->oneShotIsGrantedObserver = null; } return $result; }
/** * {@inheritdoc} */ public function vote(TokenInterface $token, $object, array $attributes) { $this->securityToken = $token; $this->object = $object instanceof FieldVote ? $object->getDomainObject() : $object; $this->extension = $this->extensionSelector->select($object); // replace empty permissions with default ones for ($i = 0; $i < count($attributes); $i++) { if (empty($attributes[$i])) { $attributes[$i] = $this->extension->getDefaultPermission(); } } $result = parent::vote($token, $object, $attributes); $this->extension = null; $this->object = null; $this->securityToken = null; return $result; }