1 <?php
3 class filterOpsiLicense {
5 static function query($base, $scope, $filter, $attributes, $category, $objectStorage= "")
6 {
7 $config= session::global_get('config');
8 $si = new opsiLicenceHandler($config);
9 $res = $si->listPools();
10 $result = array();
11 if($si->is_error() || !is_array($res)){
12 $this->init_successfull = FALSE;
13 msg_dialog::display(_("Error"),msgPool::siError($si->get_error()),ERROR_DIALOG);
14 return;
15 }else{
17 // Reset the list of licenses
18 foreach($res as $item){
20 // Fake an ldap entry, this enables ACL checks.
21 $entry['dn'] = "opsi:cn=".$item['cn'][0].",".$config->current['BASE'];
22 foreach($item as $name => $value){
23 $entry[] = $name;
24 $entry[$name] = $value;
25 }
26 $entry['count'] = count($item);
27 $result[] = $entry;
28 }
29 }
30 return(filterACL::unifyResult($result));
31 }
33 static function unifyResult($result)
34 {
35 $res=array();
36 foreach($result as $entry){
37 if(!isset($res[$entry['dn']])){
38 $res[$entry['dn']]=$entry;
39 }
40 }
41 return(array_values($res));
42 }
43 }
45 ?>