protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
    {
        if ($this->isSuperAdmin($token)) {
            return true;
        }

        if (ContributionActionInterface::READ == $attribute) {
            return true;
        }

        $actionMapping = array(
            ContributionActionInterface::TRASH_RESTORE => ContributionRoleInterface::TRASH_RESTORER,
            ContributionActionInterface::TRASH_PURGE   => ContributionRoleInterface::TRASH_SUPRESSOR
        );

        return $this->hasRole($token, $actionMapping[$attribute]);
    }
protected function voteOnAttribute($attribute, $subject, TokenInterface $token)
    {
        if ($this->isSuperAdmin($token)) {
            return true;
        }

        if (ContributionActionInterface::READ == $attribute) {
            return true;
        }

        $actionMapping = array(
            ContributionActionInterface::TRASH_RESTORE => ContributionRoleInterface::TRASH_RESTORER,
            ContributionActionInterface::TRASH_PURGE   => ContributionRoleInterface::TRASH_SUPRESSOR
        );

        return $this->hasRole($token, $actionMapping[$attribute]);
    }
protected function voteOnAttribute ( $ attribute , $ subject , TokenInterface $ token ) { if ( $ this -> isSuperAdmin ( $ token ) ) { return true ; } if ( ContributionActionInterface :: READ == $ attribute ) { return true ; } $ actionMapping = array ( ContributionActionInterface :: TRASH_RESTORE => ContributionRoleInterface :: TRASH_RESTORER , ContributionActionInterface :: TRASH_PURGE => ContributionRoleInterface :: TRASH_SUPRESSOR ) ; return $ this -> hasRole ( $ token , $ actionMapping [ $ attribute ] ) ; }
Everyone can read the trash item
but you can only purge or restore items with the matching role

@param string         $attribute
@param mixed          $subject
@param TokenInterface $token

@return bool
Everyone can read the trash item but you can only purge or restore items with the matching role