summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 937e0f7)
raw | patch | inline | side by side (parent: 937e0f7)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 20 Jul 2009 07:00:30 +0000 (07:00 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 20 Jul 2009 07:00:30 +0000 (07:00 +0000) |
-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
-Added servers cn to remove checks
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13937 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/goto/admin/systems/services/shares/class_goShareServer.inc | patch | blob | history |
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 833239a230670617e8d20440761ec5dcfc6341c0..c85f79c9321f31f2d02b7feadc7f8fbf3964bce2 100644 (file)
}
}
+ 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 = '<p>';
+ while(($attrs = $ldap->fetch()) && $i >= 0){
+ $i --;
+ if(isset($attrs['dn'])){
+ $str .= '<i>' . $attrs['dn']."</i><br/>";
+ }
+ }
+ $str .= '</p>';
+ 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];
/* 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];