Horde_Kolab_Session_Base::connect PHP Method

connect() public method

Try to connect the session handler.
public connect ( string $user_id = null, array $credentials = null ) : null
$user_id string The user ID to connect with.
$credentials array An array of login credentials. For Kolab, this must contain a "password" entry.
return null
    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);
    }

Usage Example

Esempio n. 1
0
 public function testMethodIsvalidHasResultBooleanTrueIfTheMailOfTheCurrentUserMatchesTheCurrentUserOfTheSessionAndTheNewUserMatchesEitherTheCurrentUserMailAndUid()
 {
     $auth = '*****@*****.**';
     $this->user->expects($this->exactly(5))->method('getSingle')->will($this->returnValue('*****@*****.**'));
     $composite = $this->_getMockedComposite();
     $composite->objects->expects($this->once())->method('fetch')->will($this->returnValue($this->user));
     $session = new Horde_Kolab_Session_Base($composite, array());
     $session->connect('', array('password' => ''));
     $valid = new Horde_Kolab_Session_Valid_Base($session, $auth);
     $this->assertTrue($valid->validate('*****@*****.**'));
 }
All Usage Examples Of Horde_Kolab_Session_Base::connect