public function getReachableCenters(User $user, Role $role, Scope $scope = null)
    {
        $centers = array();
        
        foreach ($user->getGroupCenters() as $groupCenter){
            $permissionGroup = $groupCenter->getPermissionsGroup();
            //iterate on roleScopes
            foreach($permissionGroup->getRoleScopes() as $roleScope) {
                //check that the role is in the reachable roles
                if ($this->isRoleReached($role, 
                      new Role($roleScope->getRole()))) {
                    if ($scope === null) {
                        $centers[] = $groupCenter->getCenter();
                        break 1;
                    } else {
                        if ($scope->getId() == $roleScope->getScope()->getId()){
                            $centers[] = $groupCenter->getCenter();
                            break 1;
                        }      
                    }
                }
            }
            
        }
        
        return $centers;
    }
public function getReachableCenters(User $user, Role $role, Scope $scope = null)
    {
        $centers = array();
        
        foreach ($user->getGroupCenters() as $groupCenter){
            $permissionGroup = $groupCenter->getPermissionsGroup();
            //iterate on roleScopes
            foreach($permissionGroup->getRoleScopes() as $roleScope) {
                //check that the role is in the reachable roles
                if ($this->isRoleReached($role, 
                      new Role($roleScope->getRole()))) {
                    if ($scope === null) {
                        $centers[] = $groupCenter->getCenter();
                        break 1;
                    } else {
                        if ($scope->getId() == $roleScope->getScope()->getId()){
                            $centers[] = $groupCenter->getCenter();
                            break 1;
                        }      
                    }
                }
            }
            
        }
        
        return $centers;
    }
public function getReachableCenters ( User $ user , Role $ role , Scope $ scope = null ) { $ centers = array ( ) ; foreach ( $ user -> getGroupCenters ( ) as $ groupCenter ) { $ permissionGroup = $ groupCenter -> getPermissionsGroup ( ) ; //iterate on roleScopes foreach ( $ permissionGroup -> getRoleScopes ( ) as $ roleScope ) { //check that the role is in the reachable roles if ( $ this -> isRoleReached ( $ role , new Role ( $ roleScope -> getRole ( ) ) ) ) { if ( $ scope === null ) { $ centers [ ] = $ groupCenter -> getCenter ( ) ; break 1 ; } else { if ( $ scope -> getId ( ) == $ roleScope -> getScope ( ) -> getId ( ) ) { $ centers [ ] = $ groupCenter -> getCenter ( ) ; break 1 ; } } } } } return $ centers ; }
Get reachable Centers for the given user, role,
and optionnaly Scope

@param User $user
@param Role $role
@param null|Scope $scope
@return Center[]
Get reachable Centers for the given user role and optionnaly Scope