lib/Auth/Process/PerunIdentity.php
protected function getVosForRegistration($user)
    {
        $vos = array();
        $members = array();
        $vosIdForRegistration = array();
        $vosForRegistration = array();

        $vos = $this->getVosByFacilityVoShortNames();
        foreach ($vos as $vo) {
            Logger::debug("Vo:" . print_r($vo, true));
            try {
                $member = $this->rpcAdapter->getMemberByUser($user, $vo);
                Logger::debug("Member:" . print_r($member, true));
                array_push($members, $member);
            } catch (\Exception $exception) {
                array_push($vosForRegistration, $vo);
                Logger::warning("perun:PerunIdentity: " . $exception);
            }
        }

        foreach ($members as $member) {
            if ($member->getStatus() === Member::VALID ||
                $member->getStatus() === Member::EXPIRED) {
                array_push($vosIdForRegistration, $member->getVoId());
            }
        }

        foreach ($vos as $vo) {
            if (in_array($vo->getId(), $vosIdForRegistration)) {
                array_push($vosForRegistration, $vo);
            }
        }
        Logger::debug("VOs for registration:  " . print_r($vosForRegistration, true));
        return $vosForRegistration;
    }
protected function getVosForRegistration($user)
    {
        $vos = array();
        $members = array();
        $vosIdForRegistration = array();
        $vosForRegistration = array();

        $vos = $this->getVosByFacilityVoShortNames();
        foreach ($vos as $vo) {
            Logger::debug("Vo:" . print_r($vo, true));
            try {
                $member = $this->rpcAdapter->getMemberByUser($user, $vo);
                Logger::debug("Member:" . print_r($member, true));
                array_push($members, $member);
            } catch (\Exception $exception) {
                array_push($vosForRegistration, $vo);
                Logger::warning("perun:PerunIdentity: " . $exception);
            }
        }

        foreach ($members as $member) {
            if ($member->getStatus() === Member::VALID ||
                $member->getStatus() === Member::EXPIRED) {
                array_push($vosIdForRegistration, $member->getVoId());
            }
        }

        foreach ($vos as $vo) {
            if (in_array($vo->getId(), $vosIdForRegistration)) {
                array_push($vosForRegistration, $vo);
            }
        }
        Logger::debug("VOs for registration:  " . print_r($vosForRegistration, true));
        return $vosForRegistration;
    }
protected function getVosForRegistration ( $ user ) { $ vos = array ( ) ; $ members = array ( ) ; $ vosIdForRegistration = array ( ) ; $ vosForRegistration = array ( ) ; $ vos = $ this -> getVosByFacilityVoShortNames ( ) ; foreach ( $ vos as $ vo ) { Logger :: debug ( "Vo:" . print_r ( $ vo , true ) ) ; try { $ member = $ this -> rpcAdapter -> getMemberByUser ( $ user , $ vo ) ; Logger :: debug ( "Member:" . print_r ( $ member , true ) ) ; array_push ( $ members , $ member ) ; } catch ( \ Exception $ exception ) { array_push ( $ vosForRegistration , $ vo ) ; Logger :: warning ( "perun:PerunIdentity: " . $ exception ) ; } } foreach ( $ members as $ member ) { if ( $ member -> getStatus ( ) === Member :: VALID || $ member -> getStatus ( ) === Member :: EXPIRED ) { array_push ( $ vosIdForRegistration , $ member -> getVoId ( ) ) ; } } foreach ( $ vos as $ vo ) { if ( in_array ( $ vo -> getId ( ) , $ vosIdForRegistration ) ) { array_push ( $ vosForRegistration , $ vo ) ; } } Logger :: debug ( "VOs for registration:  " . print_r ( $ vosForRegistration , true ) ) ; return $ vosForRegistration ; }
Returns list of sspmod_perun_model_Vo to which the user may register
@param User $user
@return array of Vo
Returns list of sspmod_perun_model_Vo to which the user may register