public function validateZone(CNabuSiteTarget $nb_site_target)
    {
        $nb_engine = CNabuEngine::getEngine();

        if (!(($nb_site = $nb_site_target->getSite()) instanceof CNabuSite)) {
            throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
        }

        $this->zone = ($this->nb_user !== null ? 'P' : 'O');
        $nb_engine->traceLog("Request Zone", ($this->zone === 'P' ? 'Private' : 'Public'));

        $site_target_zone = $nb_site_target->getZone();
        $nb_engine->traceLog(
                "Page Zone",
                ($site_target_zone === 'P' ? 'Private' : ($site_target_zone === 'O' ? 'Public' : 'Both'))
        );

        $retval = ($site_target_zone === 'B') ||
                  ($site_target_zone !== null && $site_target_zone === $this->zone);

        if ($retval && $this->zone === 'P' && $nb_site->getRequirePoliciesAfterLogin() === 'T') {
            if ($this->nb_user->getPoliciesAccepted() === 'T') {
                $nb_engine->traceLog('Policies', 'Accepted');
            } else {
                $nb_engine->traceLog('Policies', 'Not accepted');
                if ($nb_site_target->getIgnorePolicies() === 'F' &&
                    ($link = $nb_site->getPoliciesTargetLink())->isLinkable() &&
                    !($link->matchTarget($nb_site_target))
                ) {
                    throw new ENabuRedirectionException(428, new CNabuHTTPRedirection(428, $link->getBestQualifiedURL()));
                }
            }
        }

        return $retval;
    }
public function validateZone(CNabuSiteTarget $nb_site_target)
    {
        $nb_engine = CNabuEngine::getEngine();

        if (!(($nb_site = $nb_site_target->getSite()) instanceof CNabuSite)) {
            throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
        }

        $this->zone = ($this->nb_user !== null ? 'P' : 'O');
        $nb_engine->traceLog("Request Zone", ($this->zone === 'P' ? 'Private' : 'Public'));

        $site_target_zone = $nb_site_target->getZone();
        $nb_engine->traceLog(
                "Page Zone",
                ($site_target_zone === 'P' ? 'Private' : ($site_target_zone === 'O' ? 'Public' : 'Both'))
        );

        $retval = ($site_target_zone === 'B') ||
                  ($site_target_zone !== null && $site_target_zone === $this->zone);

        if ($retval && $this->zone === 'P' && $nb_site->getRequirePoliciesAfterLogin() === 'T') {
            if ($this->nb_user->getPoliciesAccepted() === 'T') {
                $nb_engine->traceLog('Policies', 'Accepted');
            } else {
                $nb_engine->traceLog('Policies', 'Not accepted');
                if ($nb_site_target->getIgnorePolicies() === 'F' &&
                    ($link = $nb_site->getPoliciesTargetLink())->isLinkable() &&
                    !($link->matchTarget($nb_site_target))
                ) {
                    throw new ENabuRedirectionException(428, new CNabuHTTPRedirection(428, $link->getBestQualifiedURL()));
                }
            }
        }

        return $retval;
    }
public function validateZone ( CNabuSiteTarget $ nb_site_target ) { $ nb_engine = CNabuEngine :: getEngine ( ) ; if ( ! ( ( $ nb_site = $ nb_site_target -> getSite ( ) ) instanceof CNabuSite ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_SITE_NOT_FOUND ) ; } $ this -> zone = ( $ this -> nb_user !== null ? 'P' : 'O' ) ; $ nb_engine -> traceLog ( "Request Zone" , ( $ this -> zone === 'P' ? 'Private' : 'Public' ) ) ; $ site_target_zone = $ nb_site_target -> getZone ( ) ; $ nb_engine -> traceLog ( "Page Zone" , ( $ site_target_zone === 'P' ? 'Private' : ( $ site_target_zone === 'O' ? 'Public' : 'Both' ) ) ) ; $ retval = ( $ site_target_zone === 'B' ) || ( $ site_target_zone !== null && $ site_target_zone === $ this -> zone ) ; if ( $ retval && $ this -> zone === 'P' && $ nb_site -> getRequirePoliciesAfterLogin ( ) === 'T' ) { if ( $ this -> nb_user -> getPoliciesAccepted ( ) === 'T' ) { $ nb_engine -> traceLog ( 'Policies' , 'Accepted' ) ; } else { $ nb_engine -> traceLog ( 'Policies' , 'Not accepted' ) ; if ( $ nb_site_target -> getIgnorePolicies ( ) === 'F' && ( $ link = $ nb_site -> getPoliciesTargetLink ( ) ) -> isLinkable ( ) && ! ( $ link -> matchTarget ( $ nb_site_target ) ) ) { throw new ENabuRedirectionException ( 428 , new CNabuHTTPRedirection ( 428 , $ link -> getBestQualifiedURL ( ) ) ) ; } } } return $ retval ; }
Validates if the zone is allowed for current user.
@param CNabuSiteTarget $nb_site_target Site Target to grant zone access.
@return bool Return true if the zone is allowed for requested Site Target.
Validates if the zone is allowed for current user .