From: hickert Date: Mon, 20 Jul 2009 07:00:30 +0000 (+0000) Subject: Updated share service X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=86dab3d5c2ad147fd79afcc1dc557cda8b3ad778;p=gosa.git Updated share service -Avoid service removal while service is in use. -Added servers cn to remove checks git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13937 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/goto/admin/systems/services/shares/class_goShareServer.inc b/gosa-plugins/goto/admin/systems/services/shares/class_goShareServer.inc index 833239a23..c85f79c93 100644 --- a/gosa-plugins/goto/admin/systems/services/shares/class_goShareServer.inc +++ b/gosa-plugins/goto/admin/systems/services/shares/class_goShareServer.inc @@ -215,6 +215,29 @@ class goShareServer extends goService{ } } + function allow_remove() + { + /* Check if the service is still in use */ + $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($ldap->count()){ + /* Number of entries shown in warning */ + $i = 3; + $str = '

'; + while(($attrs = $ldap->fetch()) && $i >= 0){ + $i --; + if(isset($attrs['dn'])){ + $str .= '' . $attrs['dn']."
"; + } + } + $str .= '

'; + return(sprintf(_("Cannot remove share - it is still in use by these objects: %s"), $str)); + } + } + function addToList($entry){ $key = key($entry); $this->goExportEntryList[$key]=$entry[$key]; @@ -225,7 +248,8 @@ class goShareServer extends goService{ /* Check if the share is used by someone */ $ldap = $this->config->get_ldap_link(); $ldap->cd($this->config->current['BASE']); - $ldap->search("(|(gotoProfileServer=*|$id)(gotoShare=*|$id|*||*))", array("cn")); + $cn = $ldap->getCn($this->dn); + $ldap->search("(|(gotoProfileServer=*|$id)(gotoShare=$cn|$id|*))", array("cn")); if ($ldap->count() != 0){ while ($attrs= $ldap->fetch()){ $obj[$ldap->getDN()]= $attrs['cn'][0];