src/SimpleUser/EditUserVoter.php
public function vote(TokenInterface $token, $object, array $attributes)
    {
        $user = $token->getUser();

        foreach ($attributes as $attribute) {
            if (!$this->supportsAttribute($attribute)) {
                continue;
            }

            if ($this->hasRole($token, 'ROLE_ADMIN')) {
                return VoterInterface::ACCESS_GRANTED;
            }

            if ($attribute == 'EDIT_USER') {
                $user2 = $object;
                return $this->usersHaveSameId($user, $user2) ? VoterInterface::ACCESS_GRANTED : VoterInterface::ACCESS_DENIED;
            }

            if ($attribute == 'EDIT_USER_ID') {
                $id = $object;
                return $this->hasUserId($user, $id) ? VoterInterface::ACCESS_GRANTED : VoterInterface::ACCESS_DENIED;
            }
        }

        return VoterInterface::ACCESS_ABSTAIN;
    }
public function vote(TokenInterface $token, $object, array $attributes)
    {
        $user = $token->getUser();

        foreach ($attributes as $attribute) {
            if (!$this->supportsAttribute($attribute)) {
                continue;
            }

            if ($this->hasRole($token, 'ROLE_ADMIN')) {
                return VoterInterface::ACCESS_GRANTED;
            }

            if ($attribute == 'EDIT_USER') {
                $user2 = $object;
                return $this->usersHaveSameId($user, $user2) ? VoterInterface::ACCESS_GRANTED : VoterInterface::ACCESS_DENIED;
            }

            if ($attribute == 'EDIT_USER_ID') {
                $id = $object;
                return $this->hasUserId($user, $id) ? VoterInterface::ACCESS_GRANTED : VoterInterface::ACCESS_DENIED;
            }
        }

        return VoterInterface::ACCESS_ABSTAIN;
    }
Returns the vote for the given parameters.

This method must return one of the following constants:
ACCESS_GRANTED, ACCESS_DENIED, or ACCESS_ABSTAIN.

@param TokenInterface $token      A TokenInterface instance
@param object $object     The object to secure
@param array $attributes An array of attributes associated with the method being invoked

@return integer either ACCESS_GRANTED, ACCESS_ABSTAIN, or ACCESS_DENIED