From: Michael J. Rubinsky Date: Sun, 1 Feb 2009 17:27:44 +0000 (-0500) Subject: The _imp_authenticate api method is required for authenticating via X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=4bfe26c50f6df5dd67003c76c2367016c72793ad;p=horde.git The _imp_authenticate api method is required for authenticating via any of Horde's rpc servers. Looks like it got dropped somewhere between the last commit in CVS and the import into git. Michael, I'm assuming this was not intended? --- diff --git a/imp/lib/api.php b/imp/lib/api.php index b5650e386..319cb3578 100644 --- a/imp/lib/api.php +++ b/imp/lib/api.php @@ -20,6 +20,12 @@ $_services['authCredentials'] = array( 'type' => '{urn:horde}hashHash' ); +$_services['authenticate'] = array( + 'args' => array('userID' => 'string', 'credentials' => '{urn:horde}hash', 'params' => '{urn:horde}hash'), + 'checkperms' => false, + 'type' => 'boolean' +); + $_services['compose'] = array( 'args' => array('args' => '{urn:horde}hash', 'extra' => '{urn:horde}hash'), 'type' => 'string' @@ -138,6 +144,31 @@ function _imp_authCredentials() } /** + * Tries to authenticate with the mail server and create a mail session. + * + * @param string $userID The username of the user. + * @param array $credentials Credentials of the user. Only allowed key: + * 'password'. + * @param array $params Additional parameters. Only allowed key: + * 'server'. + * + * @return boolean True on success, false on failure. + */ +function _imp_authenticate($userID, $credentials, $params = array()) +{ + $GLOBALS['authentication'] = 'none'; + $GLOBALS['noset_view'] = true; + require_once dirname(__FILE__) . '/base.php'; + require_once IMP_BASE . '/lib/Session.php'; + + $server_key = empty($params['server']) + ? IMP_Session::getAutoLoginServer() + : $params['server']; + + return IMP_Session::createSession($userID, $credentials['password'], $server_key); +} + +/** * Returns a compose window link. * * @param string|array $args List of arguments to pass to compose.php.