Code

Added acls for printer glpi
[gosa.git] / plugins / admin / systems / class_goShareServer.inc
index 5bb45523c4e20647958acf6bdb44607ff7f75b5f..99c75c32624facd006789bb49f2e70fedc431f1d 100644 (file)
@@ -305,7 +305,6 @@ class goShareServer extends plugin{
 
     # add new mounts to the container
     foreach ($this->mounts_to_add as $entry) {
-
       $mount=$this->returnMountEntry($entry);
       $mountdn = "cn=".$mount["cn"].","."$mountsdn";
       $ldap->cd($mountdn);
@@ -374,6 +373,92 @@ class goShareServer extends plugin{
     }
   }
 
+
+  function addToMountList($entry) 
+  {
+    $key =  key($entry);
+    $type = $this->get_share_type($entry[$key]);
+    if (($type == "netatalk") || ($type == "NFS")) {
+      $this->mounts_to_add[$entry[$key]] = $entry[$key];
+      unset($this->mounts_to_remove[$entry[$key]]);
+    }
+  }
+
+  function deleteFromMountList($entry) 
+  {
+    $type = $this->get_share_type($entry);
+    if (($type == "netatalk") || ($type == "NFS")) {
+      $this->mounts_to_remove[$entry] = $entry;
+      unset($this->mounts_to_add[$entry]);
+    }
+  }
+
+  function get_share_type($share) 
+  {
+    $tmp = split("\|", $share);
+    return $tmp[2];
+  }
+
+  function returnMountEntry($entry)
+  {
+    $item = split("\|", $entry);
+    $name = $item[0];
+    $description = $item[1];
+    $type = $item[2];
+    $charset = $item[3];
+    $path = $item[4];
+    $options = $item[5];
+
+    switch ($type) {
+      case "netatalk" : {
+        $mount = array(
+            "mountDirectory" => "/Network/Servers/",
+            "mountOption" => array(
+              "net",
+              "url==afp://;AUTH=NO%20USER%20AUTHENT@".$this->cn."/$name/"
+              ),
+            "mountType" => "url",
+            "objectClass" => "mount",
+            "cn" => $this->cn .":/".$name
+            );
+        break;
+      }
+      case "NFS" : {
+        $mount = array(
+            "mountDirectory" => "/Network/Servers/",
+            "mountOption" => "net",
+            "mountType" => "nfs",
+            "objectClass" => "mount",
+            "cn" => $this->cn .":".$path
+            );
+        break;
+      }
+      default : {
+                  continue;
+                }
+    }
+    return $mount;
+  }
+
+
+  /* Return plugin informations for acl handling */
+  function plInfo()
+  {
+    return (array(
+          "plShortName"   => _("Shares"),
+          "plDescription" => _("Share service"),
+          "plSelfModify"  => FALSE,
+          "plDepends"     => array(),
+          "plPriority"    => 0,
+          "plSection"     => array("administration"),
+          "plCategory"    => array("server"),
+
+          "plProvidedAcls"=> array(
+            "goExportEntry"     =>_("Share entry"))
+          ));
+  }
+
+
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>