core-bundle
                                
                                
                                
                                    core-bundle copied to clipboard
                            
                            
                            
                        Role Voter for closed user groups
this is somewhat similar to the state voter, but would be more explicit and straightforward to configure (or maybe its just some syntactic sugar around the state voter).
    RoleAccessVoter
    $role = $object->getRole();
    if (!$role) {
        return self::ACCESS_ABSTAIN;
    }
    return $context->isGranted($role) ? self::ACCESS_GRANTED :  self::ACCESS_DENIED;