Code

Only show date selector while dates are writeable
[gosa.git] / gosa-plugins / opsi / admin / opsiLicenses / class_licenseUsage.inc
index fda4c732c2abd5bcd4ddd9f104aaa2cf1f301581..972a7dece765dc8119ea115ac3b7c69af7baad4e 100644 (file)
@@ -44,7 +44,7 @@ class licenseUsage extends plugin
     }
 
     // Extract pool name out of the fake dn.
-#    $this->init();
+    $this->init();
   }
 
   
@@ -58,6 +58,7 @@ class licenseUsage extends plugin
       $res = $this->si->getLicenseUsage("", $this->cn);
       if($this->si->is_error()){
         $this->init_successfull = FALSE;
+        msg_dialog::display(_("Error"),msgPool::siError($this->si->get_error()),ERROR_DIALOG);
         return;
       }
 
@@ -79,14 +80,17 @@ class licenseUsage extends plugin
     
     // Create usage list
     $list = new divSelectBox("licenseUsage");
-    foreach($this->licenseUses as $license){
-
-      $f1 = array("string" => $license['hostId'][0]);
-      $f2 = array("string" => $license['licenseKey'][0]);
-      $f3 = array("string" => $license['licensePoolId'][0]);
-      $f4 = array("string" => $license['softwareLicenseId'][0],
-                  "attach" => "style='border-right:0px;'");
-      $list->addEntry(array($f1,$f2,$f3,$f4));
+    $ui = get_userinfo();
+    $readable = $ui->get_permissions($this->config->current['BASE'], "opsi/licenseUsage","");
+    if($readable) {
+      foreach($this->licenseUses as $license){
+        $f1 = array("string" => $license['hostId'][0]);
+        $f2 = array("string" => $license['licenseKey'][0]);
+        $f3 = array("string" => $license['licensePoolId'][0]);
+        $f4 = array("string" => $license['softwareLicenseId'][0],
+            "attach" => "style='border-right:0px;'");
+        $list->addEntry(array($f1,$f2,$f3,$f4));
+      } 
     } 
 
     $smarty = get_smarty();
@@ -128,51 +132,21 @@ class licenseUsage extends plugin
 
   /* Saves object modifications
    */  
-  function save()
-  {
-    plugin::save();
-
-    // Send modify/add events
-    $mode = "modify";
-    if($this->orig_dn == "new"){
-      $mode = "add";
-    }
-
-    $this->si->createPool($this->cn, $this->description,$this->productIds,$this->softwareIds);#
-    if($this->si->is_error()){
-      msg_dialog::display(_("Error"),msgPool::siError($this->si->get_error()),ERROR_DIALOG);
-    }else{
-      $this->handle_post_events($mode);
-    }
-
-    // Log action
-    if($mode == "modify"){
-      new log("modify","users/".get_class($this),$this->dn,array_keys($this->attrs),$this->si->get_error());
-    }else{
-      new log("create","users/".get_class($this),$this->dn,array_keys($this->attrs),$this->si->get_error());
-    }
-
-    return 0;
-  }
-
+  function save() { }
   function remove_from_parent(){ return; }
 
  
   static function plInfo()
   {
     return (array(
-          "plShortName"   => _("Usage"),
+          "plShortName"   => _("License usage"),
           "plDescription" => _("License usage"),
           "plSelfModify"  => FALSE,
           "plDepends"     => array(),
-          "plPriority"    => 1,
+          "plPriority"    => 11,
           "plSection"     => array("administration"),
           "plCategory"    => array("opsi"),
-          "plProvidedAcls"=> array(
-            "cn"                => _("Name"),
-            "description" => _("Description"))
-          ));
+          "plProvidedAcls"=> array()));
   }
 }