From 09a8d0cb989baabb101aa71a9f757f307663c64c Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 24 Sep 2007 07:55:18 +0000 Subject: [PATCH] Updated goPhoneServer : Update goFonHomeServer for users and conferences too, if server name has changes git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7381 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/systems/class_goFonServer.inc | 30 ++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/plugins/admin/systems/class_goFonServer.inc b/plugins/admin/systems/class_goFonServer.inc index 8f5fd0eab..8707485cc 100644 --- a/plugins/admin/systems/class_goFonServer.inc +++ b/plugins/admin/systems/class_goFonServer.inc @@ -25,12 +25,15 @@ class goFonServer extends goService{ var $goFonAreaCode = ""; var $goFonCountryCode = ""; var $view_logged =FALSE; - + + var $orig_dn = ""; function goFonServer(&$config,$dn) { goService::goService($config,$dn); $this->DisplayName = _("VoIP service"); + + $this->orig_dn = $dn; } @@ -120,6 +123,31 @@ class goFonServer extends goService{ } } + + function save() + { + goService::save(); + /* Update goFonAccounts if server was is renamed. + Set attribute goFonHomeServer to current dn + */ + if(in_array("goFonServer",$this->objectclasses)){ + if($this->orig_dn != "new" && $this->orig_dn != $this->dn){ + $ldap = $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(&(goFonHomeServer=*)(|(objectClass=goFonAccount)(objectClass=goFonConference)))",array("goFonHomeServer")); + $dns = array(); + while($attrs = $ldap->fetch()){ + $dns[] = $attrs['dn']; + } + foreach($dns as $dn){ + $ldap->cd($dn); + $ldap->modify(array("goFonHomeServer" => $this->dn)); + show_ldap_error($ldap->get_error(),sprintf(_("Updating gofon home server failed for '%s'."),$dn)); + } + } + } + } + /* Return plugin informations for acl handling */ function plInfo() -- 2.30.2