/**
  * Get / Set the user agent
  *
  * @param string $userAgent Set the user agent
  * @return string Current user agent
  */
 public static function userAgent($userAgent = null)
 {
     if ($userAgent) {
         self::$_userAgent = $userAgent;
     }
     if (empty(self::$_userAgent)) {
         CakeSession::init(self::$path);
     }
     return self::$_userAgent;
 }
Пример #2
0
 /**
  * @return void
  */
 public function testAuthorizeFor_Admin()
 {
     // can see link to the project for system admin.
     CakeSession::id('testsess');
     CakeSession::init();
     CakeSession::write('user_id', 1);
     $project = ClassRegistry::init('Project')->findById(1);
     $result = $this->Candy->authorize_for(array('controller' => 'members', 'action' => 'edit'), $project);
     $this->assertTrue($result);
 }
Пример #3
0
     * @param mixed $id The key of the value to read
     * @return mixed The value of the key or false if it does not exist
     */
    public function read($id);
    /**
     * Helper function called on write for sessions.
     *
     * @param integer $id ID that uniquely identifies session in database
     * @param mixed $data The value of the data to be saved.
     * @return boolean True for successful write, false otherwise.
     */
    public function write($id, $data);
    /**
     * Method called on the destruction of a session.
     *
     * @param integer $id ID that uniquely identifies session in database
     * @return boolean True for successful delete, false otherwise.
     */
    public function destroy($id);
    /**
     * Run the Garbage collection on the session storage.  This method should vacuum all
     * expired or dead sessions.
     *
     * @param integer $expires Timestamp (defaults to current time)
     * @return boolean Success
     */
    public function gc($expires = null);
}
// Initialize the session
CakeSession::init();
Пример #4
0
 /**
  * Get / Set the user agent
  *
  * @param string|null $userAgent Set the user agent
  *
  * @return string Current user agent.
  */
 public static function userAgent($userAgent = NULL)
 {
     if ($userAgent) {
         static::$_userAgent = $userAgent;
     }
     if (empty(static::$_userAgent)) {
         CakeSession::init(static::$path);
     }
     return static::$_userAgent;
 }