summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 605891b)
raw | patch | inline | side by side (parent: 605891b)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 28 Sep 2009 13:41:58 +0000 (13:41 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 28 Sep 2009 13:41:58 +0000 (13:41 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14375 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/opsi/admin/opsiLicenses/class_licenseUsageByHost.inc | patch | blob | history | |
gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc | patch | blob | history |
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_licenseUsageByHost.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_licenseUsageByHost.inc
index d2b0817ed53b2f35d00c836adbf9c417e3dc8886..60ba6d6f8e5587dba1e99536f81806a98b9875d4 100644 (file)
return;
}
$this->availableLicenses = array();
+
+ echo "We require Licenses here not Pools";
+
foreach($res as $pool){
$this->availableLicenses[] = $pool['cn'][0];
}
$del = array_diff($this->init_reservedLicenses, $this->reservedLicenses);
$add = array_diff($this->reservedLicenses, $this->init_reservedLicenses);
- foreach($del as $pool){
- $this->si->removeLicenseFromHost($pool, $this->cn);
+ foreach($del as $license){
+ $this->si->removeLicenseReservationFromHost($license, $this->cn);
if($this->si->is_error()){
msg_dialog::display(_("Error"),msgPool::siError($this->si->get_error()),ERROR_DIALOG);
}
}
- foreach($add as $pool){
- $this->si->addLicenseToHost($pool, $this->cn);
+ foreach($add as $license){
+ $this->si->reserverLicenseForHost($license, $this->cn);
if($this->si->is_error()){
msg_dialog::display(_("Error"),msgPool::siError($this->si->get_error()),ERROR_DIALOG);
}
diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenseHandler.inc
index 7efb01c4b29f9ca7ba08149fc492f3c9bcb27bc7..45a5bce36a520b9ce4620f6eebdc1794e9829186 100644 (file)
{
$data= array();
$res = $this->send_data("gosa_opsi_getLicensePools_listOfHashes",$this->target,$data,TRUE);
-
$items = array();
if(isset($res['XML'][0]['RESULT'][0]['HIT'])){
$items = $res['XML'][0]['RESULT'][0]['HIT'];
}
+ /* @brief Reserve a software license to a host
+ * @param softwareLicenseId
+ * @param hostId Something like client_1.intranet.mydomain.de
+ */
+ function reserverLicenseForHost($softwareLicenseId,$hostId)
+ {
+ $data= array();
+ $data['softwareLicenseId'] = htmlentities($softwareLicenseId);
+ $data['hostId'] = htmlentities($hostId);
+ $res = $this->send_data("gosa_opsi_boundHostToLicense",$this->target,$data,TRUE);
+ if(isset($res['XML'][0]['ANSWER_OPSI_BOUNDHOSTTOLICENSE'])){
+ return(TRUE);
+ }
+ return(FALSE);
+ }
+
+
+ /*
+ * @brief Remove software licnese reservation for a host.
+ * @param softwareLicenseId
+ * @param hostid Something like client_1.intranet.mydomain.de
+ */
+ function removeLicenseReservationFromHost($softwareLicenseId,$hostId)
+ {
+ $data= array();
+ $data['softwareLicenseId'] = htmlentities($softwareLicenseId);
+ $data['hostId'] = htmlentities($hostId);
+ $res = $this->send_data("gosa_opsi_unboundHostFromLicense",$this->target,$data,TRUE);
+ if(isset($res['XML'][0]['ANSWER_OPSI_UNBOUNDHOSTFROMLICENSE'])){
+ return(TRUE);
+ }
+ return(FALSE);
+ }
+
+
/*
* @brief Unassign a software license from a host.
* @param hostid Something like client_1.intranet.mydomain.de
return(FALSE);
}
+
/*
* @brief Removes a single license from a license pool
* Attention, the software license has to exists