From: psc Date: Tue, 13 Oct 2009 14:24:11 +0000 (+0000) Subject: Added allow_remove function X-Git-Url: https://git.tokkee.org/?p=gosa.git;a=commitdiff_plain;h=653dd099d57a33849d5a61faedfef31057ad0f35 Added allow_remove function Added allow_remove function to avoid deleting repository services which are still in use. (Trac: #3285) git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@14591 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/trunk/gosa-plugins/fai/admin/systems/services/repository/class_servRepository.inc b/trunk/gosa-plugins/fai/admin/systems/services/repository/class_servRepository.inc index 645144cf2..3971481d2 100644 --- a/trunk/gosa-plugins/fai/admin/systems/services/repository/class_servRepository.inc +++ b/trunk/gosa-plugins/fai/admin/systems/services/repository/class_servRepository.inc @@ -238,6 +238,32 @@ class servrepository 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']); + foreach($this->repositories as $repository) { + $url = $repository['Url']; + $ldap->search("(&(objectClass=gotoWorkstation)(objectClass=FAIobject)(FAIdebianMirror=".$url."))",array("cn","FAIclass")); + if ($ldap->count() != 0){ + $obj= array(); + $found= false; + while($attrs = $ldap->fetch()){ + foreach($attrs['FAIclass'] as $class){ + $obj[$ldap->getDN()]= $attrs['cn'][0]; + $found= true; + } + } + + if ($found){ + $message = msgPool::stillInUse(_("Repository service")) . msgPool::buildList($obj); + return $message; + } + } + } + } + /* Check supplied data */ function check()