Пример #1
0
 /**
  * 
  * Resets any authentication data in the cache.
  * 
  * Typically used for idling, expiration, and logout.  Calls
  * [[php::session_regenerate_id() | ]] to clear previous session, if any
  * exists.
  * 
  * @param string $status A Solar_Auth status string; default is Solar_Auth::ANON.
  * 
  * @param array $info If status is Solar_Auth::VALID, populate properties with this
  * user data, with keys for 'handle', 'email', 'moniker', 'uri', and 
  * 'uid'.  If a key is empty or does not exist, its value is set to null.
  * 
  * @return void
  * 
  */
 public function reset($status = Solar_Auth::ANON, $info = array())
 {
     // baseline user information
     $base = array('handle' => null, 'moniker' => null, 'email' => null, 'uri' => null, 'uid' => null);
     // reset the status
     $this->status = strtoupper($status);
     // change properties
     if ($this->status == Solar_Auth::VALID) {
         // update the timers, leave user info alone
         $now = time();
         $this->initial = $now;
         $this->active = $now;
     } else {
         // clear the timers *and* the user info
         $this->initial = null;
         $this->active = null;
         $info = null;
     }
     // set the user-info properties
     $info = array_merge($base, (array) $info);
     $this->handle = $info['handle'];
     $this->moniker = $info['moniker'];
     $this->email = $info['email'];
     $this->uri = $info['uri'];
     $this->uid = $info['uid'];
     // reset the session id and delete previous session, but only
     // if a session is actually in place
     if (session_id() !== '' && !headers_sent()) {
         session_regenerate_id();
     }
     // cache any messages
     $this->_cache->save('status_text', $this->locale($this->status));
 }
Пример #2
0
 /**
  * 
  * Appends a single role to the existing list of roles.
  * 
  * @param string $val The role to append.
  * 
  * @return void
  * 
  */
 public function add($val)
 {
     $data = $this->getList();
     $data[] = $val;
     $this->_cache->save('list', $data);
 }
Пример #3
0
 /**
  * 
  * Appends a single role to the existing list of roles.
  * 
  * @param string $val The role to append.
  * 
  * @return void
  * 
  */
 public function add($val)
 {
     $data = $this->_cache->fetch('list', array());
     $data[] = $val;
     $this->_cache->save('list', $data);
 }