original_string: public function Start($UserID = FALSE, $SetIdentity = TRUE, $Persist = FALSE) {
        if (!C('Garden.Installed', FALSE)) return;
        // Retrieve the authenticated UserID from the Authenticator module.
        $UserModel = Gdn::Authenticator()->GetUserModel();
        $this->UserID = $UserID !== FALSE ? $UserID : Gdn::Authenticator()->GetIdentity();
        $this->User = FALSE;
  
        // Now retrieve user information
        if ($this->UserID > 0) {
           // Instantiate a UserModel to get session info
           $this->User = $UserModel->GetSession($this->UserID);
  
           if ($this->User) {
              if ($SetIdentity)
                 Gdn::Authenticator()->SetIdentity($this->UserID, $Persist);
              
              $UserModel->EventArguments['User'] =& $this->User;
              $UserModel->FireEvent('AfterGetSession');
  
              $this->_Permissions = Gdn_Format::Unserialize($this->User->Permissions);
              $this->_Preferences = Gdn_Format::Unserialize($this->User->Preferences);
              $this->_Attributes = Gdn_Format::Unserialize($this->User->Attributes);
              $this->_TransientKey = is_array($this->_Attributes) ? ArrayValue('TransientKey', $this->_Attributes) : FALSE;
  
              if ($this->_TransientKey === FALSE)
                 $this->_TransientKey = $UserModel->SetTransientKey($this->UserID);
              
              // Save any visit-level information.
              $UserModel->UpdateVisit($this->UserID);
  
           } else {
              $this->UserID = 0;
              $this->User = FALSE;
              if ($SetIdentity)
                 Gdn::Authenticator()->SetIdentity(NULL);
           }
        } else {
           // Grab the transient key from the cookie. This doesn't always get set but we'll try it here anyway.
           $this->_TransientKey = GetAppCookie('tk');
        }
        // Load guest permissions if necessary
        if ($this->UserID == 0)
           $this->_Permissions = Gdn_Format::Unserialize($UserModel->DefinePermissions(0));
     }
code: public function Start($UserID = FALSE, $SetIdentity = TRUE, $Persist = FALSE) {
        if (!C('Garden.Installed', FALSE)) return;
        // Retrieve the authenticated UserID from the Authenticator module.
        $UserModel = Gdn::Authenticator()->GetUserModel();
        $this->UserID = $UserID !== FALSE ? $UserID : Gdn::Authenticator()->GetIdentity();
        $this->User = FALSE;
  
        // Now retrieve user information
        if ($this->UserID > 0) {
           // Instantiate a UserModel to get session info
           $this->User = $UserModel->GetSession($this->UserID);
  
           if ($this->User) {
              if ($SetIdentity)
                 Gdn::Authenticator()->SetIdentity($this->UserID, $Persist);
              
              $UserModel->EventArguments['User'] =& $this->User;
              $UserModel->FireEvent('AfterGetSession');
  
              $this->_Permissions = Gdn_Format::Unserialize($this->User->Permissions);
              $this->_Preferences = Gdn_Format::Unserialize($this->User->Preferences);
              $this->_Attributes = Gdn_Format::Unserialize($this->User->Attributes);
              $this->_TransientKey = is_array($this->_Attributes) ? ArrayValue('TransientKey', $this->_Attributes) : FALSE;
  
              if ($this->_TransientKey === FALSE)
                 $this->_TransientKey = $UserModel->SetTransientKey($this->UserID);
              
              // Save any visit-level information.
              $UserModel->UpdateVisit($this->UserID);
  
           } else {
              $this->UserID = 0;
              $this->User = FALSE;
              if ($SetIdentity)
                 Gdn::Authenticator()->SetIdentity(NULL);
           }
        } else {
           // Grab the transient key from the cookie. This doesn't always get set but we'll try it here anyway.
           $this->_TransientKey = GetAppCookie('tk');
        }
        // Load guest permissions if necessary
        if ($this->UserID == 0)
           $this->_Permissions = Gdn_Format::Unserialize($UserModel->DefinePermissions(0));
     }
code_tokens: public function Start ( $ UserID = FALSE , $ SetIdentity = TRUE , $ Persist = FALSE ) { if ( ! C ( 'Garden.Installed' , FALSE ) ) return ; // Retrieve the authenticated UserID from the Authenticator module. $ UserModel = Gdn :: Authenticator ( ) -> GetUserModel ( ) ; $ this -> UserID = $ UserID !== FALSE ? $ UserID : Gdn :: Authenticator ( ) -> GetIdentity ( ) ; $ this -> User = FALSE ; // Now retrieve user information if ( $ this -> UserID > 0 ) { // Instantiate a UserModel to get session info $ this -> User = $ UserModel -> GetSession ( $ this -> UserID ) ; if ( $ this -> User ) { if ( $ SetIdentity ) Gdn :: Authenticator ( ) -> SetIdentity ( $ this -> UserID , $ Persist ) ; $ UserModel -> EventArguments [ 'User' ] = & $ this -> User ; $ UserModel -> FireEvent ( 'AfterGetSession' ) ; $ this -> _Permissions = Gdn_Format :: Unserialize ( $ this -> User -> Permissions ) ; $ this -> _Preferences = Gdn_Format :: Unserialize ( $ this -> User -> Preferences ) ; $ this -> _Attributes = Gdn_Format :: Unserialize ( $ this -> User -> Attributes ) ; $ this -> _TransientKey = is_array ( $ this -> _Attributes ) ? ArrayValue ( 'TransientKey' , $ this -> _Attributes ) : FALSE ; if ( $ this -> _TransientKey === FALSE ) $ this -> _TransientKey = $ UserModel -> SetTransientKey ( $ this -> UserID ) ; // Save any visit-level information. $ UserModel -> UpdateVisit ( $ this -> UserID ) ; } else { $ this -> UserID = 0 ; $ this -> User = FALSE ; if ( $ SetIdentity ) Gdn :: Authenticator ( ) -> SetIdentity ( NULL ) ; } } else { // Grab the transient key from the cookie. This doesn't always get set but we'll try it here anyway. $ this -> _TransientKey = GetAppCookie ( 'tk' ) ; } // Load guest permissions if necessary if ( $ this -> UserID == 0 ) $ this -> _Permissions = Gdn_Format :: Unserialize ( $ UserModel -> DefinePermissions ( 0 ) ) ; }
docstring: Authenticates the user with the provided Authenticator class.
  
  @param int $UserID The UserID to start the session with.
  @param bool $SetIdentity Whether or not to set the identity (cookie) or make this a one request session.
  @param bool $Persist If setting an identity, should we persist it beyond browser restart?
docstring_tokens: Authenticates the user with the provided Authenticator class .