Security/PostVoter.php
public function canEdit(GroupableInterface $post, TokenInterface $token): bool
    {
        $user = $token->getUser();
        if ($post->getAuthor() == $user->getUsername()) {
            return true;
        }

        foreach ($post->getGroups() as $group) {
            if ($this->decision_manager->decide($token, ['GROUP_ROLE_ADMIN'], $group)) {
                return true;
            }
        }

        return false;
    }
public function canEdit(GroupableInterface $post, TokenInterface $token): bool
    {
        $user = $token->getUser();
        if ($post->getAuthor() == $user->getUsername()) {
            return true;
        }

        foreach ($post->getGroups() as $group) {
            if ($this->decision_manager->decide($token, ['GROUP_ROLE_ADMIN'], $group)) {
                return true;
            }
        }

        return false;
    }
public function canEdit ( GroupableInterface $ post , TokenInterface $ token ) : bool { $ user = $ token -> getUser ( ) ; if ( $ post -> getAuthor ( ) == $ user -> getUsername ( ) ) { return true ; } foreach ( $ post -> getGroups ( ) as $ group ) { if ( $ this -> decision_manager -> decide ( $ token , [ 'GROUP_ROLE_ADMIN' ] , $ group ) ) { return true ; } } return false ; }
Allow authors to edit and delete their posts.

@param GroupableInterface $post  The post to vote on.
@param TokenInterface     $token The token to vote on.

@return bool
Allow authors to edit and delete their posts .