From 684b7a6f21ec3e450e2861d64c195f2a6793ae44 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 20 Sep 2010 06:47:45 +0000 Subject: [PATCH] Updated plugin::rename -Added migration for gotoHotplugDeviceDNs git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19763 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_plugin.inc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gosa-core/include/class_plugin.inc b/gosa-core/include/class_plugin.inc index 0dadccfb7..3c003145e 100644 --- a/gosa-core/include/class_plugin.inc +++ b/gosa-core/include/class_plugin.inc @@ -930,6 +930,27 @@ class plugin $o_ogroup->save(); } + // Migrate objectgroups if needed + $objects = get_sub_list("(&(objectClass=gotoEnvironment)(gotoHotplugDeviceDN=".LDAP::prepare4filter(LDAP::fix($src_dn))."))", + "users",array(get_ou("core","userRDN"), get_ou("core","groupRDN")), + $this->config->current['BASE'],array("dn", "gotoHotplugDeviceDN"), GL_SUBSEARCH | GL_NO_ACL_CHECK); + $ldap = $this->config->get_ldap_link(); + foreach($objects as $obj){ + $deviceDNS = array(); + for($i=0; $i < $obj["gotoHotplugDeviceDN"]['count']; $i++){ + $odn = $obj["gotoHotplugDeviceDN"][$i]; + if($odn == $src_dn){ + $odn = $dst_dn; + } + $deviceDNS[] = $odn; + } + $ldap->cd($obj['dn']); + $ldap->modify(array('gotoHotplugDeviceDN'=>$deviceDNS)); + if(!$ldap->success()){ + trigger_error(sprintf("Failed to update gotoHotplugDeviceDN for %s: %s", bold($obj['dn']), $ldap->get_error())); + } + } + // Migrate rfc groups if needed $groups = get_sub_list("(&(objectClass=posixGroup)(member=".LDAP::prepare4filter(LDAP::fix($src_dn))."))","groups", array(get_ou("core", "groupRDN")),$this->config->current['BASE'],array("dn"), GL_SUBSEARCH | GL_NO_ACL_CHECK); -- 2.30.2