summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ed100cc)
raw | patch | inline | side by side (parent: ed100cc)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 3 Aug 2010 09:22:14 +0000 (09:22 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 3 Aug 2010 09:22:14 +0000 (09:22 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19351 594d385d-05f5-0310-b6e9-bd551577e9d8
index 4480396be833ada67f0b01f57873bf67cd10b708..8c49425ea74b440459a0e9550cd76a5ff82ddc4d 100644 (file)
}
- function getRpcHandle()
+ function getRpcHandle($url="", $user="", $pwd="", $digest = FALSE )
{
// Create jsonRPC handle on demand.
- if(!$this->jsonRPChandle){
- $this->jsonRPChandle = new jsonRPC($this);
+ if(!$this->jsonRPChandle || TRUE){
+ $this->jsonRPChandle = new jsonRPC($this, $url, $user, $pwd, $digest);
}
return($this->jsonRPChandle);
}
index d9084f61c0913dba6c4bbcefb8668f69ddc754dd..041babce57ca299927731c7ecc2919f8a21ff1be 100644 (file)
private $lastStats = array();
private $lastAction = "none";
- public function __construct($config)
+
+ private $url = "";
+ private $user = "";
+ private $password = "";
+
+ private $authModeDigest = FALSE;
+
+ public function __construct($config, $url = "", $user = "", $password = "", $digest = FALSE)
{
$this->config = $config;
$this->id = 0;
+
+ // Get connection data
+ $this->url = (!empty($url)) ? $url : $this->config->get_cfg_value('core','gosaRpcServer');
+ $this->user = (!empty($user)) ? $user : $this->config->get_cfg_value('core','gosaRpcUser');
+ $this->passwd = (!empty($password)) ? $password : $this->config->get_cfg_value('core','gosaRpcPassword');
+ $this->authModeDigest = $digest;
+
+ // Put some usefull info in the logs
+ DEBUG (DEBUG_RPC, __LINE__, __FUNCTION__, __FILE__,bold($this->url), "Initiated RPC ");
+ DEBUG (DEBUG_RPC, __LINE__, __FUNCTION__, __FILE__,bold($this->user), "RPC user: ");
+ DEBUG (DEBUG_RPC, __LINE__, __FUNCTION__, __FILE__,bold($this->passwd),"RPC password: ");
+ DEBUG (DEBUG_RPC, __LINE__, __FUNCTION__, __FILE__,bold($this->authModeDigest),"Digest Auth (0: No, 1: Yes): ");
+
$this->__login();
}
private function __login()
{
- // Get connection data
- $url = $this->config->get_cfg_value('core','gosaRpcServer');
- $user = $this->config->get_cfg_value('core','gosaRpcUser');
- $passwd = $this->config->get_cfg_value('core','gosaRpcPassword');
-
- DEBUG (DEBUG_RPC, __LINE__, __FUNCTION__, __FILE__,bold($url), "Initiated RPC ");
- DEBUG (DEBUG_RPC, __LINE__, __FUNCTION__, __FILE__,bold($user), "RPC user: ");
- DEBUG (DEBUG_RPC, __LINE__, __FUNCTION__, __FILE__,bold($passwd),"RPC password: ");
-
// Init Curl handler
- $this->curlHandler = curl_init($url);
+ $this->curlHandler = curl_init($this->url);
// Set curl options
- curl_setopt($this->curlHandler, CURLOPT_URL , $url);
- curl_setopt($this->curlHandler, CURLOPT_COOKIESESSION , TRUE);
- curl_setopt($this->curlHandler, CURLOPT_COOKIEFILE, 'cookiefile.txt');
- curl_setopt($this->curlHandler, CURLOPT_POST , TRUE);
- curl_setopt($this->curlHandler, CURLOPT_RETURNTRANSFER , TRUE);
- curl_setopt($this->curlHandler, CURLOPT_SSL_VERIFYPEER, TRUE);
- curl_setopt($this->curlHandler, CURLOPT_HTTPHEADER , array('Content-Type: application/json'));
+ curl_setopt($this->curlHandler, CURLOPT_URL , $this->url);
+ curl_setopt($this->curlHandler, CURLOPT_POST , TRUE);
+ curl_setopt($this->curlHandler, CURLOPT_RETURNTRANSFER ,TRUE);
+ curl_setopt($this->curlHandler, CURLOPT_HTTPHEADER , array('Content-Type: application/json'));
+ curl_setopt($this->curlHandler, CURLOPT_SSL_VERIFYPEER, FALSE);
// Try to login
- $this->login($user, $passwd);
-
+ if($this->authModeDigest){
+ curl_setopt($this->curlHandler, CURLOPT_USERPWD , "{$this->user}:{$this->passwd}");
+ curl_setopt($this->curlHandler, CURLOPT_HTTPAUTH , CURLAUTH_ANYSAFE);
+ }else{
+ curl_setopt($this->curlHandler, CURLOPT_COOKIESESSION , TRUE);
+ curl_setopt($this->curlHandler, CURLOPT_COOKIEFILE, 'cookiefile.txt');
+ $this->login($this->user, $this->passwd);
+ }
}
diff --git a/gosa-core/plugins/generic/dashBoard/dbChannelStatus/class_dbChannelStatus.inc b/gosa-core/plugins/generic/dashBoard/dbChannelStatus/class_dbChannelStatus.inc
index 86664bbb7dd3d04a32391434767945d3df5509c1..d3a5d5cbec747a2f6266425b08d7194f870aa556 100644 (file)
// First try to retrieve values via RPC
if ($this->config->get_cfg_value("core","gosaRpcServer") != ""){
-
$dump = stats::dumpTables();
- $rpc = $this->config->getRpcHandle();
- $hash = $rpc->updateInstanceStatus($dump);
+ $rpc = $this->config->getRpcHandle(
+ "http://10.3.64.59:4000",
+ "65717fe6-9e3e-11df-b010-5452005f1250",
+ "WyukwauWoid2",
+ TRUE);
+ $rpc->updateInstanceStatus($dump);
if(!$rpc->success()){
msg_dialog::display(_("Error"),msgPool::rpcError($rpc->get_error()),ERROR_DIALOG);
- return("");
}
}
}