Exemplo n.º 1
0
 /**
  * Try to connect the session handler.
  *
  * @param string $user_id     The user ID to connect with.
  * @param array  $credentials An array of login credentials. For Kolab,
  *                            this must contain a "password" entry.
  *
  * @return NULL
  *
  * @throws Horde_Kolab_Session_Exception If the connection failed.
  */
 public function connect($user_id = null, array $credentials = null)
 {
     $this->_data['user']['id'] = $user_id;
     if (isset($credentials['password'])) {
         $password = $credentials['password'];
     } else {
         $password = '';
     }
     try {
         $this->_server->connect($this->_data['user']['id'], $password);
         $user_object = $this->_server->objects->fetch();
     } catch (Horde_Kolab_Server_Exception_Bindfailed $e) {
         throw new Horde_Kolab_Session_Exception_Badlogin('Invalid credentials!', 0, $e);
     } catch (Horde_Kolab_Server_Exception $e) {
         throw new Horde_Kolab_Session_Exception('Login failed!', 0, $e);
     }
     $this->_initMail($user_object);
     $this->_initUid($user_object);
     $this->_initName($user_object);
     $this->_initImapServer($user_object);
     $this->_initFreebusyServer($user_object);
 }
Exemplo n.º 2
0
 /**
  * Connect to the server. Use this method if the user name you can provide
  * does not match a GUID. In this case it will be required to map this user
  * name first.
  *
  * @param string $user The user name.
  * @param string $pass The password.
  *
  * @return NULL.
  *
  * @throws Horde_Kolab_Server_Exception If the connection failed.
  */
 public function connect($user = null, $pass = null)
 {
     $this->_server->connect($user, $pass);
 }