From: psc Date: Wed, 27 May 2009 10:15:32 +0000 (+0000) Subject: Add a allow_remove function to the goShareServer class X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=bc8f1acd62abe9c6101d5437e00f0f9c31ff2f21;p=gosa.git Add a allow_remove function to the goShareServer class to disallow removal of systems, when it provides shares that are in use. (Trac: #2638) git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@13672 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/trunk/gosa-plugins/goto/admin/systems/services/shares/class_goShareServer.inc b/trunk/gosa-plugins/goto/admin/systems/services/shares/class_goShareServer.inc index 833239a23..7d7b05d9a 100644 --- a/trunk/gosa-plugins/goto/admin/systems/services/shares/class_goShareServer.inc +++ b/trunk/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))(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]; diff --git a/trunk/gosa-plugins/goto/locale/de/LC_MESSAGES/messages.po b/trunk/gosa-plugins/goto/locale/de/LC_MESSAGES/messages.po index 5e54c9360..83d3a6f93 100644 --- a/trunk/gosa-plugins/goto/locale/de/LC_MESSAGES/messages.po +++ b/trunk/gosa-plugins/goto/locale/de/LC_MESSAGES/messages.po @@ -825,6 +825,10 @@ msgstr "Hotplug" msgid "Type" msgstr "Typ" +#: admin/systems/services/shares/class_goShareServer.inc:237 +msgid "Cannot remove share - it is still in use by these objects: %s" +msgstr "Freigabe kann nicht entfernt werden - sie wird noch von diesen Objekten benutzt: %s" + #: admin/devices/class_deviceGeneric.inc:265 msgid "Vendor" msgstr "Hersteller" diff --git a/trunk/gosa-plugins/goto/locale/messages.po b/trunk/gosa-plugins/goto/locale/messages.po index f39445b99..7fd039d1d 100644 --- a/trunk/gosa-plugins/goto/locale/messages.po +++ b/trunk/gosa-plugins/goto/locale/messages.po @@ -1358,6 +1358,10 @@ msgstr "" msgid "share" msgstr "" +#: admin/systems/services/shares/class_goShareServer.inc:237 +msgid "Cannot remove share - it is still in use by these objects: %s" +msgstr "" + #: admin/systems/services/shares/class_goShareServer.inc:390 msgid "File service - Shares" msgstr ""