public function acceptPolicies(bool $save = true)
    {
        $nb_site = $this->nb_application->getHTTPServer()->getSite();
        if ($nb_site === null || !($nb_site instanceof CNabuSite)) {
            throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
        }

        if ($this->isUserLogged()) {
            $this->nb_user->setPoliciesAccepted('T');
            $this->nb_user->setPoliciesDatetime(date('Y-m-d H:i:s', time()));

            if ($nb_site->getEnableSessionStrictPolicies() === 'T') {
                session_regenerate_id(true);
            }

            if ($save &&
                $this->nb_user->save() &&
                strlen($url = $nb_site->getLoginRedirectionTargetLink($this->nb_site_role)->getBestQualifiedURL()) > 0
            ) {

                $after_login = $url . "?logged";
                throw new ENabuRedirectionException(301, new CNabuHTTPRedirection(301, $url));
            }
        }
    }
public function acceptPolicies(bool $save = true)
    {
        $nb_site = $this->nb_application->getHTTPServer()->getSite();
        if ($nb_site === null || !($nb_site instanceof CNabuSite)) {
            throw new ENabuCoreException(ENabuCoreException::ERROR_SITE_NOT_FOUND);
        }

        if ($this->isUserLogged()) {
            $this->nb_user->setPoliciesAccepted('T');
            $this->nb_user->setPoliciesDatetime(date('Y-m-d H:i:s', time()));

            if ($nb_site->getEnableSessionStrictPolicies() === 'T') {
                session_regenerate_id(true);
            }

            if ($save &&
                $this->nb_user->save() &&
                strlen($url = $nb_site->getLoginRedirectionTargetLink($this->nb_site_role)->getBestQualifiedURL()) > 0
            ) {

                $after_login = $url . "?logged";
                throw new ENabuRedirectionException(301, new CNabuHTTPRedirection(301, $url));
            }
        }
    }
public function acceptPolicies ( bool $ save = true ) { $ nb_site = $ this -> nb_application -> getHTTPServer ( ) -> getSite ( ) ; if ( $ nb_site === null || ! ( $ nb_site instanceof CNabuSite ) ) { throw new ENabuCoreException ( ENabuCoreException :: ERROR_SITE_NOT_FOUND ) ; } if ( $ this -> isUserLogged ( ) ) { $ this -> nb_user -> setPoliciesAccepted ( 'T' ) ; $ this -> nb_user -> setPoliciesDatetime ( date ( 'Y-m-d H:i:s' , time ( ) ) ) ; if ( $ nb_site -> getEnableSessionStrictPolicies ( ) === 'T' ) { session_regenerate_id ( true ) ; } if ( $ save && $ this -> nb_user -> save ( ) && strlen ( $ url = $ nb_site -> getLoginRedirectionTargetLink ( $ this -> nb_site_role ) -> getBestQualifiedURL ( ) ) > 0 ) { $ after_login = $ url . "?logged" ; throw new ENabuRedirectionException ( 301 , new CNabuHTTPRedirection ( 301 , $ url ) ) ; } } }
Call this method when a User accept the Policies of the Site. In consequence the lock for policies
in all Targets is ignored.
@param bool $save If true, the instance is updated in the storage synchronously. If false, then the instance
is updated internally but changes will not be valid in other instances of the same object or in future requests.
To have changes applied permanently when $save if false, you need to call the save method after this call.
Call this method when a User accept the Policies of the Site . In consequence the lock for policies in all Targets is ignored .