From a7ade1d5230aa11b461a798930ce2ae458bc0f8c Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 22 Sep 2009 12:22:48 +0000 Subject: [PATCH] Updated licenses git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14309 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../opsiLicenses/class_divListLicenses.inc | 6 +++-- .../opsiLicenses/class_opsiLicenseHandler.inc | 24 ++++++++++++++++++- .../admin/opsiLicenses/class_opsiLicenses.inc | 11 ++++++++- .../opsi/admin/opsiLicenses/remove.tpl | 18 ++++++++++++++ 4 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 gosa-plugins/opsi/admin/opsiLicenses/remove.tpl diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_divListLicenses.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_divListLicenses.inc index 67657a641..02e70d91f 100644 --- a/gosa-plugins/opsi/admin/opsiLicenses/class_divListLicenses.inc +++ b/gosa-plugins/opsi/admin/opsiLicenses/class_divListLicenses.inc @@ -142,13 +142,13 @@ class divListLicense extends MultiSelectWindow // Assigning licenses foreach($list as $key => $val){ - + // Get object permissions $acl = $ui->get_permissions($val['dn'],"opsi/licenseGeneric"); $acl_all= $ui->has_complete_category_acls($val['dn'],"opsi"); // Create edit and remove icon buttons - $actions.= ""; if(preg_match("/d/",$acl)){ @@ -160,6 +160,7 @@ class divListLicense extends MultiSelectWindow title='".msgPool::permDelete()."'>"; } + // Append license descriptio, if available $title = "title='".preg_replace('/ /', ' ', LDAP::fix($val['dn']))."'"; if(!isset($val['description'][0])){ @@ -167,6 +168,7 @@ class divListLicense extends MultiSelectWindow }else{ $desc = " - [ ".$val['description'][0]." ]"; } + $display = $val['cn'][0].$desc; // Append the entry to the divlist $field0 = array("string" => "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']; + $data =array(); + foreach($items as $item){ + $entry = array(); + foreach( + array( + "DESCRIPTION" => "description", + "LICENSEPOOLID" => "cn", + "PRODUCTIDS" => "productId", + "WINDOWSSOFTWAREIDS"=> "softwareId") as $source => $dest){ + + if(isset($item[$source])){ + $entry[$dest] = array('count' => 0); + foreach($item[$source] as $obj){ + $entry[$dest][] = $obj['VALUE']; + } + $entry[$dest]['count'] = (count($entry[$dest]) -1 ); + } + } + $data[] =$entry; + } + return($data); } - return($items); + return(FALSE); } diff --git a/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenses.inc b/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenses.inc index 9112b1e3f..631b132e1 100644 --- a/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenses.inc +++ b/gosa-plugins/opsi/admin/opsiLicenses/class_opsiLicenses.inc @@ -281,8 +281,17 @@ class opsiLicenses extends plugin $base = $this->DivListLicenses->selectedBase; $Regex = $this->DivListLicenses->Regex; - // Search and fetch all matching license objects. + $si = new opsiLicenceHandler($this->config); + $res = $si->listPools(); + + // Reset the list of licenses $this->licenses = array(); + foreach($res as $item){ + + // Fake an ldap entry, this enables ACL checks. + $item['dn'] = "opsi:cn=".$item['cn'][0].",".$this->config->current['BASE']; + $this->licenses[] = $item; + } } diff --git a/gosa-plugins/opsi/admin/opsiLicenses/remove.tpl b/gosa-plugins/opsi/admin/opsiLicenses/remove.tpl new file mode 100644 index 000000000..76cf28860 --- /dev/null +++ b/gosa-plugins/opsi/admin/opsiLicenses/remove.tpl @@ -0,0 +1,18 @@ +
+  {t}Warning{/t} +
+ +

+ {$info} + {t}Please double check if you really want to do this since there is no way for GOsa to get your data back.{/t} +

+

+ {t}So - if you're sure - press 'Delete' to continue or 'Cancel' to abort.{/t} +

+ +

+ +   + +

+ -- 2.30.2