From 4bfe26c50f6df5dd67003c76c2367016c72793ad Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Sun, 1 Feb 2009 12:27:44 -0500 Subject: [PATCH] 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? --- imp/lib/api.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) 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. -- 2.11.0