From 1748a2d8a964793b8b60d2af323a3358b2bc2fd4 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 27 Oct 2008 14:37:57 +0000 Subject: [PATCH] Updated server->service->ldap -Update references git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@12786 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../services/ldap/class_goLdapServer.inc | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/gosa-plugins/goto/admin/systems/services/ldap/class_goLdapServer.inc b/gosa-plugins/goto/admin/systems/services/ldap/class_goLdapServer.inc index 4c1380fe7..3a86186ce 100644 --- a/gosa-plugins/goto/admin/systems/services/ldap/class_goLdapServer.inc +++ b/gosa-plugins/goto/admin/systems/services/ldap/class_goLdapServer.inc @@ -19,6 +19,7 @@ class goLdapServer extends goService{ var $cn = ""; var $goLdapServerStatus = ""; var $goLdapBase = ""; + var $oldBase = ""; var $view_logged =FALSE; var $krb_service_prefix = "ldap/"; @@ -37,6 +38,7 @@ class goLdapServer extends goService{ } $this->goLdapBase= "ldap://$srv:389/".$config->current['BASE']; } + $this->oldBase = $this->goLdapBase; } @@ -90,6 +92,34 @@ class goLdapServer extends goService{ } } + + function save() + { + goService::save(); + + /* Update object relation */ + if(!empty($this->oldBase) && $this->oldBase != $this->goLdapBase){ + $new = array(); + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search('(&(objectClass=GOhard)(gotoLdapServer=*'.$this->oldBase.'))',array("cn","gotoLdapServer")); + while($attrs = $ldap->fetch()){ + $ldapServer = array(); + for($i = 0 ; $i < $attrs['gotoLdapServer']['count'] ; $i ++ ){ + $ldapServer[] = preg_replace("/".normalizePreg($this->oldBase)."/",$this->goLdapBase,$attrs['gotoLdapServer'][$i]); + } + $new[$attrs['dn']]['gotoLdapServer'] = $ldapServer; + } + foreach($new as $dn => $data){ + $ldap->cd($dn); + $ldap->modify($data); + if(!$ldap->success()){ + msg_dialog::display(_("LDAP error"), msgPool::ldaperror($ldap->get_error(), $this->dn, 0, get_class())); + } + } + } + } + /* Return plugin informations for acl handling */ static function plInfo() -- 2.30.2