Code

When removing the File service or inidividual shares, honour the
authorwolffc <wolffc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 16 Sep 2010 14:46:04 +0000 (14:46 +0000)
committerwolffc <wolffc@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 16 Sep 2010 14:46:04 +0000 (14:46 +0000)
gosaUnitTag when searching for objects still using those shares and do
not display an error message if they belong to a different
administrative unit.

git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@19726 594d385d-05f5-0310-b6e9-bd551577e9d8

trunk/gosa-plugins/goto/admin/systems/services/shares/class_goShareServer.inc

index c85f79c9321f31f2d02b7feadc7f8fbf3964bce2..3a2d343f77299676bc8fb50aa46730a178fa06dc 100644 (file)
@@ -221,7 +221,13 @@ class goShareServer extends goService{
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
     $cn = $ldap->getCn($this->dn);
-    $ldap->search("(&(|(objectClass=posixGroup)(objectClass=posixAccount)(objectClass=gosaGroupOfNames))(gotoShare=$cn|*))", array("dn"));
+    if (isset($this->config->current['HONOURUNITTAGS']) &&
+        preg_match('/true/i', $this->config->current['HONOURUNITTAGS']) &&
+        $this->gosaUnitTag != "") {
+      $ldap->search("(&(&(|(objectClass=posixGroup)(objectClass=posixAccount)(objectClass=gosaGroupOfNames))(gotoShare=$cn|*))(gosaUnitTag=$this->gosaUnitTag))", array("dn"));
+    } else {
+      $ldap->search("(&(|(objectClass=posixGroup)(objectClass=posixAccount)(objectClass=gosaGroupOfNames))(gotoShare=$cn|*))", array("dn"));
+    }
 
     if($ldap->count()){
       /* Number of entries shown in warning */
@@ -249,7 +255,13 @@ class goShareServer extends goService{
     $ldap = $this->config->get_ldap_link();
     $ldap->cd($this->config->current['BASE']);
     $cn = $ldap->getCn($this->dn);
-    $ldap->search("(|(gotoProfileServer=*|$id)(gotoShare=$cn|$id|*))", array("cn"));
+    if (isset($this->config->current['HONOURUNITTAGS']) &&
+        preg_match('/true/i', $this->config->current['HONOURUNITTAGS']) &&
+        $this->gosaUnitTag != "") {
+      $ldap->search("(&(|(gotoProfileServer=*|$id)(gotoShare=$cn|$id|*))(gosaUnitTag=$this->gosaUnitTag))", array("cn"));
+    } else {
+      $ldap->search("(|(gotoProfileServer=*|$id)(gotoShare=$cn|$id|*))", array("cn"));
+    }
     if ($ldap->count() != 0){
       while ($attrs= $ldap->fetch()){
         $obj[$ldap->getDN()]= $attrs['cn'][0];