/** * @expectedException RemoteAccessDeniedException */ function test_publicCallPluginDeny() { global $conf; $conf['useacl'] = 1; $remoteApi = new RemoteApi(); $remoteApi->call('plugin.testplugin.methodString'); }
/** * Logs the current command * * @param RemoteApi $client The connection resource * @param array $auth Array of authentication information (email, password) * @param string $command The command used to run this script. */ public static function log($client, $auth, $command) { try { $client->logCommand($auth[0], $auth[1], $command); } catch (Eventum_RPC_Exception $e) { self::quit($e->getMessage()); } }
/** * NOTE: this needs to be public for PHP 5.3 compatibility * * @param ReflectionMethod $method * @param array $params Method parameters in already decoded into PHP types * @param bool $public true if method should not be protected with login/password * @param array $pdesc Parameter descriptions * @return string */ public function handle($method, $params, $public, $pdesc) { // there's method to set this via $client->setAutoBase64(true); // but nothing at server side. where we actually need it $GLOBALS['XML_RPC_auto_base64'] = true; try { if (!$public) { list($email, $password) = $this->getAuthParams($params); if (!Auth::isCorrectPassword($email, $password)) { // FIXME: role is not checked here throw new RemoteApiException("Authentication failed for {$email}. Your login/password is invalid or you do not have the proper role."); } RemoteApi::createFakeCookie($email); } if ($pdesc) { $this->decodeParams($params, $pdesc); } $res = $method->invokeArgs($this->api, $params); } catch (Exception $e) { global $XML_RPC_erruser; $code = $e->getCode() ?: 1; $res = new XML_RPC_Response(0, $XML_RPC_erruser + $code, $e->getMessage()); } if (!$res instanceof XML_RPC_Response) { $res = new XML_RPC_Response(XML_RPC_Encode($res)); } return $res; }